# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
320592 | saarang123 | Labels (NOI20_labels) | C++14 | 80 ms | 4860 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
signed main() {
std::ios::sync_with_stdio(0);
std::cout.tie(0);
std::cin.tie(0);
int n; cin >> n;
vector<int> d(n, -1), a(n);
for(int i = 1; i < n; i++) cin >> d[i];
int max_id = 0, min_id = 0;
a[0] = 1;
for(int i = 1; i < n; i++) {
a[i] = d[i] + a[i - 1];
if(a[i] > a[max_id]) max_id = i;
if(a[i] < a[min_id]) min_id = i;
}
auto left = [&] (int x) {
for(int i = x - 1; i >= 0; i--)
a[i] = a[i + 1] - d[i + 1];
};
auto right = [&] (int x) {
for(int i = x + 1; i < n; i++)
a[i] = d[i] + a[i - 1];
};
a[max_id] = n;
left(max_id); right(max_id);
if(a[min_id] > 1) cout << -1 << '\n';
else {
for(int i = 0; i < n; i++) cout << a[i] << ' '; cout << '\n';
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |