Submission #261327

#TimeUsernameProblemLanguageResultExecution timeMemory
261327NightlightLabels (NOI20_labels)C++14
100 / 100
122 ms5568 KiB
#include <bits/stdc++.h> using namespace std; int N; int A[300005], mx, mn, D; int main() { scanf("%d", &N); A[1] = mx = mn = 1; for(int i = 2; i <= N; i++) { scanf("%d", &D); A[i] = A[i - 1] + D; mx = max(mx, A[i]); mn = min(mn, A[i]); } if(mx - mn == N - 1) { for(int i = 1; i <= N; i++) { printf("%d ", A[i] + (1 - mn)); } }else puts("-1"); cin >> N; }

Compilation message (stderr)

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