답안 #861313

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
861313 2023-10-16T02:23:03 Z sleepntsheep Labels (NOI20_labels) C++17
25 / 100
78 ms 18740 KB
#include <cstdio>
#include <cstring>
#include <cassert>
#include <string>
#include <deque>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <iostream>
#include <utility>
using namespace std;
using ll=long long;

#define N 300005
#define ALL(x) x.begin(), x.end()

int n, d[N], a[N];
map<int, int> fr;

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    cin >> n;
    for (int i = 0; i < n-1; ++i) cin >> d[i];
    ++fr[a[0] = 0];
    for (int i = 0; i < n-1; ++i) ++fr[a[i+1] = a[i] + d[i]];
    for (auto [x, y] : fr) if (y > 1) return cout << -1, 0;
    int hi = *max_element(a, a+n), lo = *min_element(a, a+n);
    if (hi-lo+1 != n) return cout << -1, 0;
    for (int i = 0; i < n; ++i) cout << a[i] -lo + 1 << ' ';

    return 0;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Incorrect 1 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Incorrect 1 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 18740 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 78 ms 18640 KB Output is correct
4 Correct 12 ms 2648 KB Output is correct
5 Correct 19 ms 2652 KB Output is correct
6 Correct 47 ms 9744 KB Output is correct
7 Correct 46 ms 9596 KB Output is correct
8 Correct 20 ms 2652 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Incorrect 1 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -