제출 #833667

#제출 시각아이디문제언어결과실행 시간메모리
833667LiudasLabels (NOI20_labels)C++17
100 / 100
206 ms21056 KiB
#include <iostream> #include <vector> #include <set> #include <map> #include <climits> #include <algorithm> #define int long long using namespace std; signed main(){ int N; cin >> N; vector<int> arr(N-1); for(int i = 0; i < N-1; i++){ cin >> arr[i]; } set<int> is; is.insert(1); vector<int> brr(1, 1); int last = 1; for(int i = 0; i < N-1; i ++){ int a = arr[i] + last; last = a; is.insert(a); brr.push_back(a); } if(*(--is.end()) - *is.begin() < N - 1){ cout << -1 <<endl; return 0; } int shift = *is.begin() - 1; for(int i : brr){ cout << i - shift << " "; } cout << endl; 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...