제출 #833653

#제출 시각아이디문제언어결과실행 시간메모리
833653_martynasLabels (NOI20_labels)C++11
100 / 100
114 ms9028 KiB
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int n; cin >> n; vector<long long> D(n-1); for(int i = 0; i < n-1; i++) cin >> D[i]; partial_sum(D.begin(), D.end(), D.begin()); long long mn = *min_element(D.begin(), D.end()); long long fi = 1; if(mn < 0) { fi += labs(mn); } vector<long long> ans(n); ans[0] = fi; for(int i = 1; i < n; i++) { ans[i] = fi+D[i-1]; } if(*max_element(ans.begin(), ans.end()) != n) { cout << "-1"; } else { for(int i = 0; i < n; i++) { cout << ans[i] << " "; } } cout << "\n"; return 0; }
#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...