Submission #1012389

#TimeUsernameProblemLanguageResultExecution timeMemory
1012389LuvidiLabels (NOI20_labels)C++17
100 / 100
40 ms9100 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> #define fs first #define sc second #define pb push_back void solve() { int n; cin>>n; ll d[n-1],a[n],m1=0,m2=0; a[0]=0; for(int i=0;i<n-1;i++){ cin>>d[i]; a[i+1]=a[i]+d[i]; m1=min(m1,a[i+1]); m2=max(m2,a[i+1]); } if(m2-m1!=n-1){ cout<<-1; return; } for(int i=0;i<n;i++)cout<<a[i]-m1+1<<' '; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); }
#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...