Submission #1255057


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)


typedef long long ll;
int N, T, t[201010];
//-----------------------------------------------------------------------------------
int main() {
    cin >> N >> T;
    rep(i, 0, N) scanf("%d", &t[i]);

    ll ans = 0;
    rep(i, 1, N) ans += min(T, t[i] - t[i - 1]);
    ans += T;

    cout << ans << endl;
}

Submission Info

Submission Time
Task C - Sentou
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 300
Code Size 409 Byte
Status AC
Exec Time 25 ms
Memory 1024 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     rep(i, 0, N) scanf("%d", &t[i]);
                                    ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 5
AC × 13
Set Name Test Cases
Sample example0, example1, example2, example3, example4
All example0, example1, example2, example3, example4, maxrand0, maxrand1, maxrand2, rand0, rand1, rand2, rand3, rand4
Case Name Status Exec Time Memory
example0 AC 1 ms 256 KB
example1 AC 1 ms 256 KB
example2 AC 1 ms 256 KB
example3 AC 1 ms 256 KB
example4 AC 1 ms 256 KB
maxrand0 AC 25 ms 1024 KB
maxrand1 AC 25 ms 1024 KB
maxrand2 AC 25 ms 1024 KB
rand0 AC 1 ms 256 KB
rand1 AC 1 ms 256 KB
rand2 AC 1 ms 256 KB
rand3 AC 1 ms 256 KB
rand4 AC 1 ms 256 KB