Submission #3234653


Source Code Expand

#include <iostream>
#include<vector>
using namespace std;

int main() {
	long long n,T;cin>>n>>T;
	vector<long long> t(n);
	long long ans=0;
	for(int i=0;i<n;i++){
		cin>>t[i];
	}
	for(int i=0;i<n-1;i++){
		if(t[i+1]-t[i]<T){
			ans+=t[i+1]-t[i];
		}else{
			ans+=T;
		}
	}
	ans+=T;
	cout<<ans<<endl;


	return 0;
}

Submission Info

Submission Time
Task C - Sentou
User ator
Language C++14 (GCC 5.4.1)
Score 300
Code Size 340 Byte
Status AC
Exec Time 84 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 81 ms 1792 KB
maxrand1 AC 84 ms 1792 KB
maxrand2 AC 80 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