Submission #1520326
Source Code Expand
#include <bits/stdc++.h> using namespace std; template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //typedef //------------------------------------------ typedef pair<int, int> PII; typedef pair<long, long> PLL; typedef long long LL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define PB emplace_back #define MP make_pair #define SZ(a) int((a).size()) //repetition //------------------------------------------ #define FOR(i,a,b) for(LL i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define SORT(c) sort((c).begin(),(c).end()) //constant //-------------------------------------------- //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) const LL MOD=(LL)1e9+7LL; int main(){ int N;cin>>N; LL T;cin>>T; vector<LL>t(N); REP(i,N)cin>>t[i]; LL res=0; FOR(i,1,N){ res+=min(t[i]-t[i-1],T); } res+=T; cout<<res<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Sentou |
User | blue0620 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1025 Byte |
Status | AC |
Exec Time | 80 ms |
Memory | 1792 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 |