Submission #1608488


Source Code Expand

#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7;
const int MAX_N=10000;
ll n,T,a,t[200000]={};

int main(){
	cin >> n >> T;
	REP(i,0,n) cin >> t[i];
	int s=t[n-1]+T,c=0;
	REP(i,0,n) c+=(t[i+1]-(t[i]+T)>=0?t[i+1]-(t[i]+T):0);
	cout << s-c << endl;
	return 0;
}

Submission Info

Submission Time
Task C - Sentou
User ecasdqina
Language C++14 (GCC 5.4.1)
Score 300
Code Size 393 Byte
Status AC
Exec Time 80 ms
Memory 1792 KB

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 79 ms 1792 KB
maxrand1 AC 80 ms 1792 KB
maxrand2 AC 79 ms 1792 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