Submission #285458

#TimeUsernameProblemLanguageResultExecution timeMemory
285458arnold518Labels (NOI20_labels)C++14
100 / 100
107 ms6824 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 3e5; int N; ll A[MAXN+10]; int main() { scanf("%d", &N); for(int i=2; i<=N; i++) scanf("%lld", &A[i]), A[i]+=A[i-1]; ll p=0, q=0; for(int i=1; i<=N; i++) q=max(q, A[i]), p=min(p, A[i]); if(q-p+1!=N) return !printf("-1\n"); for(int i=1; i<=N; i++) printf("%lld ", A[i]-p+1); }

Compilation message (stderr)

Labels.cpp: In function 'int main()':
Labels.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |  scanf("%d", &N);
      |  ~~~~~^~~~~~~~~~
Labels.cpp:16:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  for(int i=2; i<=N; i++) scanf("%lld", &A[i]), A[i]+=A[i-1];
      |                          ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...