Submission #2898111


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define ll long long
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define abs(a,b) (a-b>0?a-b:b-a)


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






Submission Info

Submission Time
Task C - Sentou
User HoMn
Language C++14 (GCC 5.4.1)
Score 0
Code Size 854 Byte
Status WA
Exec Time 80 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
WA × 1
AC × 5
WA × 8
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 WA 1 ms 256 KB
maxrand0 AC 80 ms 1024 KB
maxrand1 WA 80 ms 1024 KB
maxrand2 WA 80 ms 1024 KB
rand0 WA 1 ms 256 KB
rand1 WA 1 ms 256 KB
rand2 WA 1 ms 256 KB
rand3 WA 1 ms 256 KB
rand4 WA 1 ms 256 KB