Submission #586508

# Submission time Handle Problem Language Result Execution time Memory
586508 2022-06-30T10:59:49 Z krit3379 Labels (NOI20_labels) C++17
0 / 100
45 ms 6948 KB
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define N 300005

long long a[N],d[N],mi,ma;

int main(){
    int n,i;
    scanf("%d",&n);
    for(i=2;i<=n;i++)scanf("%lld",&d[i]);
    for(i=2;i<=n;i++)a[i]=a[i-1]+d[i],mi=min(mi,a[i]);
    for(i=1;i<=n;i++){
        a[i]+=mi+1;
        ma=max(a[i],ma);
    }
    if(ma==n)for(i=1;i<=n;i++)printf("%lld ",a[i]);
    else printf("-1");
    return 0;
}

Compilation message

Labels.cpp: In function 'int main()':
Labels.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
Labels.cpp:12:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for(i=2;i<=n;i++)scanf("%lld",&d[i]);
      |                      ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 45 ms 6948 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 21 ms 5032 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -