Submission #1099318

#TimeUsernameProblemLanguageResultExecution timeMemory
1099318NoMercyLabels (NOI20_labels)C++17
100 / 100
64 ms5592 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int32_t main () { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int N; cin >> N; vector<int> arr(N, 1); // set<int> s; // s.insert(1); int mn = 1, mx = 1; for (int i = 1;i < N;i ++) { int x; cin >> x; arr[i] = arr[i - 1] + x; // s.insert(arr[i]); mn = min(mn, arr[i]); mx = max(mx, arr[i]); } // cout << mx << " " << mn << "\n"; if ((mx - mn + 1) != N) { cout << "-1\n"; return 0; } mn = -mn + 1; for (int i = 0;i < N;i ++) { arr[i] += mn; cout << arr[i] << " "; } cout << "\n"; }
#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...