답안 #861312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
861312 2023-10-16T02:22:17 Z sleepntsheep Labels (NOI20_labels) C++17
25 / 100
89 ms 19576 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] = 1];
    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] + n - hi << ' ';

    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 1 ms 2396 KB Output is correct
5 Incorrect 0 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 1 ms 2396 KB Output is correct
5 Incorrect 0 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 18752 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 89 ms 19576 KB Output is correct
4 Correct 12 ms 3164 KB Output is correct
5 Correct 20 ms 3420 KB Output is correct
6 Correct 48 ms 10584 KB Output is correct
7 Correct 45 ms 10320 KB Output is correct
8 Correct 21 ms 3412 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 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 1 ms 2396 KB Output is correct
5 Incorrect 0 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -