Submission #330055

#TimeUsernameProblemLanguageResultExecution timeMemory
330055M_WLabels (NOI20_labels)C++14
100 / 100
82 ms5612 KiB
#include <bits/stdc++.h> using namespace std; int a[300300]; int main(){ int N, minn = 1, maxx = 1; scanf("%d", &N); a[0] = 1; for(int i = 1, tmp; i < N; i++){ scanf("%d", &tmp); a[i] = a[i - 1] + tmp; minn = min(minn, a[i]); maxx = max(maxx, a[i]); if(maxx - minn >= N){ printf("-1"); exit(0); } } int c = 1 - minn; if(maxx - minn < N - 1){ printf("-1"); exit(0); } for(int i = 0; i < N; i++) printf("%d ", a[i] + c); }

Compilation message (stderr)

Labels.cpp: In function 'int main()':
Labels.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    6 |  scanf("%d", &N);
      |  ~~~~~^~~~~~~~~~
Labels.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |   scanf("%d", &tmp);
      |   ~~~~~^~~~~~~~~~~~
#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...