Submission #284837

#TimeUsernameProblemLanguageResultExecution timeMemory
2848373zpLabels (NOI20_labels)C++14
100 / 100
231 ms3580 KiB
#include<bits/stdc++.h> using namespace std; int a[300009]; main(){ int n; cin >> n; int mn= 0, mx = 0; for(int i = 2; i <= n; i++){ int x; cin>>x; a[i] = a[i-1] + x; mn = min(mn, a[i]); mx = max(mx, a[i]); } if(mx - mn != n - 1){ cout << -1<<endl; return 0; } for(int i = 1; i <= n; i++){ cout<<a[i] - mn + 1 <<" "; } cout<<endl; }

Compilation message (stderr)

Labels.cpp:4:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      |      ^
#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...