| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 600201 | rajatshenoi | Labels (NOI20_labels) | C++14 | 212 ms | 11388 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(int argc, char const *argv[])
{
int N; cin >> N;
vector<ll> v(N - 1, 0);
if (N == 2)
{
int d;
cin >> d;
if (d == 0)
{
cout << "-1" << endl;
return 0;
}
if (d == 1)
{
cout << "1 2" << endl;
return 0;
}
if (d == -1)
{
cout << "2 1" << endl;
return 0;
}
}
for (int i = 0; i < N - 1; i++)
cin >> v[i];
vector<ll> temp(N, 0);
temp[0] = 1;
for (int i = 1; i < N; i++) {
temp[i] = temp[i - 1] + v[i - 1];
}
sort(temp.begin(), temp.end());
ll diff = temp[N - 1] - temp[0];
if (diff != N - 1) {
cout << "-1" << endl;
return 0;
}
ll sum = 2 - temp[0];
vector<ll> out(N, 0);
for (int i = 0; i < N - 1; i++) {
out[i] = sum;
sum += v[i];
}
out[N - 1] = sum;
for (auto el : out)
cout << el << " ";
cout << endl;
return 0;
}| # | 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... | ||||
