제출 #892467

#제출 시각아이디문제언어결과실행 시간메모리
892467vjudge1Labels (NOI20_labels)C++17
100 / 100
46 ms4736 KiB
#include <iostream> using namespace std; long long int a[300005]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int n, c = 0, ma = 0, mi = 0; cin >> n; for (int i = 2; i <= n; i++) { cin >> a[i]; c += a[i]; ma = max(ma, c); mi = min(mi, c); } if (ma - mi == n - 1) { long long int c = 0, h = 1 - mi; for (int i = 1; i <= n; i++) { c += a[i]; cout << h + c << " "; } } else cout << -1; }
#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...