Submission #8523170


Source Code Expand

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int maxn = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

#define dbg(x1) cout<<#x1<<" = "<<(x1)<<endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<" "<<#x3<<" = "<<(x3)<<endl
int a[maxn];
int main() {
    //freopen(".in", "r", stdin);
    int n,t;scanf("%d%d",&n,&t);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    ll ans=t;
    ll pre=t;
    for(int i=1;i<=n;i++)
    {
        if(pre>a[i])
        {
            ans+=t;
            ans-=(pre-a[i]);
            pre=a[i]+t;
        }
        else
        {
            ans+=t;
            pre=a[i]+t;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:27:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     int n,t;scanf("%d%d",&n,&t);
                                ^
./Main.cpp:28:44: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1;i<=n;i++) scanf("%d",&a[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 24 ms 1024 KB
maxrand1 AC 24 ms 1024 KB
maxrand2 AC 24 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