답안 #320574

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
320574 2020-11-09T06:27:26 Z vishesh312 Labels (NOI20_labels) C++17
47 / 100
1000 ms 3920 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define deb(x)        cerr << #x << " = " << x << "\n";
#define deb2(x, y)    cerr << #x << " = " << x << ", " << #y << " = " << y << "\n";
#define deb3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << "\n";

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f  first
#define s  second

#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()

using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
using ordered_multiset = tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;  

ll binpow(ll a, ll b) {
    //a = a % mod;
    ll res = 1;
    while ( b > 0) {
        if (b&1) {
            res = (a*res);//%mod;
        }
        a = (a*a);//%mod;
        b >>= 1;
    }
    return res;
}

void solve(int tc) {
    int n;
    cin >> n;
    vector<int>v(n-1);
    vector<vector<int>> out;
    for (auto &x : v) cin >> x;
    for (int first = 1; first <= n; ++first) {
        vector<int> ans(n);
        ans[0] = first;
        for (int i = 1; i < n; ++i) {
            ans[i] = ans[i-1] + v[i-1];
        }
        if (*max_element(all(ans))<=n and *min_element(all(ans))>0 and sz(out)<2)out.pb(ans);
    }
    if (sz(out)>1) cout << -1 << '\n'; else for (auto a : out) for (auto b : a) cout << b << " ";
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    int tc = 1;
    //cin >> tc;

    for (int i = 1; i <= tc; ++i) {
        solve(i);
    }

    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 1 ms 504 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Correct 0 ms 364 KB Output is correct
21 Correct 0 ms 364 KB Output is correct
22 Correct 0 ms 364 KB Output is correct
23 Correct 0 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 0 ms 364 KB Output is correct
26 Correct 0 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 0 ms 364 KB Output is correct
29 Correct 0 ms 364 KB Output is correct
30 Correct 0 ms 364 KB Output is correct
31 Correct 0 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 0 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 0 ms 364 KB Output is correct
36 Correct 0 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 0 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 0 ms 364 KB Output is correct
41 Correct 0 ms 364 KB Output is correct
42 Correct 0 ms 364 KB Output is correct
43 Correct 0 ms 384 KB Output is correct
44 Correct 0 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 0 ms 364 KB Output is correct
47 Correct 0 ms 364 KB Output is correct
48 Correct 0 ms 364 KB Output is correct
49 Correct 0 ms 364 KB Output is correct
50 Correct 1 ms 364 KB Output is correct
51 Correct 0 ms 364 KB Output is correct
52 Correct 1 ms 364 KB Output is correct
53 Correct 0 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 1 ms 504 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Correct 0 ms 364 KB Output is correct
21 Correct 0 ms 364 KB Output is correct
22 Correct 0 ms 364 KB Output is correct
23 Correct 0 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 0 ms 364 KB Output is correct
26 Correct 0 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 0 ms 364 KB Output is correct
29 Correct 0 ms 364 KB Output is correct
30 Correct 0 ms 364 KB Output is correct
31 Correct 0 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 0 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 0 ms 364 KB Output is correct
36 Correct 0 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 0 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 0 ms 364 KB Output is correct
41 Correct 0 ms 364 KB Output is correct
42 Correct 0 ms 364 KB Output is correct
43 Correct 0 ms 384 KB Output is correct
44 Correct 0 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 0 ms 364 KB Output is correct
47 Correct 0 ms 364 KB Output is correct
48 Correct 0 ms 364 KB Output is correct
49 Correct 0 ms 364 KB Output is correct
50 Correct 1 ms 364 KB Output is correct
51 Correct 0 ms 364 KB Output is correct
52 Correct 1 ms 364 KB Output is correct
53 Correct 0 ms 364 KB Output is correct
54 Correct 4 ms 364 KB Output is correct
55 Correct 4 ms 364 KB Output is correct
56 Correct 3 ms 364 KB Output is correct
57 Correct 6 ms 512 KB Output is correct
58 Correct 4 ms 364 KB Output is correct
59 Correct 4 ms 364 KB Output is correct
60 Correct 4 ms 364 KB Output is correct
61 Correct 4 ms 364 KB Output is correct
62 Correct 4 ms 364 KB Output is correct
63 Correct 4 ms 364 KB Output is correct
64 Correct 4 ms 364 KB Output is correct
65 Correct 4 ms 364 KB Output is correct
66 Correct 4 ms 364 KB Output is correct
67 Correct 4 ms 364 KB Output is correct
68 Correct 3 ms 364 KB Output is correct
69 Correct 4 ms 364 KB Output is correct
70 Correct 4 ms 364 KB Output is correct
71 Correct 5 ms 364 KB Output is correct
72 Correct 3 ms 364 KB Output is correct
73 Correct 4 ms 364 KB Output is correct
74 Correct 4 ms 364 KB Output is correct
75 Correct 4 ms 364 KB Output is correct
76 Correct 4 ms 364 KB Output is correct
77 Correct 4 ms 364 KB Output is correct
78 Correct 4 ms 364 KB Output is correct
79 Correct 4 ms 364 KB Output is correct
80 Correct 5 ms 364 KB Output is correct
81 Correct 4 ms 364 KB Output is correct
82 Correct 5 ms 364 KB Output is correct
83 Correct 3 ms 364 KB Output is correct
84 Correct 4 ms 364 KB Output is correct
85 Correct 4 ms 364 KB Output is correct
86 Correct 4 ms 364 KB Output is correct
87 Correct 4 ms 364 KB Output is correct
88 Correct 4 ms 364 KB Output is correct
89 Correct 3 ms 508 KB Output is correct
90 Correct 4 ms 364 KB Output is correct
91 Correct 4 ms 364 KB Output is correct
92 Correct 5 ms 364 KB Output is correct
93 Correct 5 ms 364 KB Output is correct
94 Correct 4 ms 364 KB Output is correct
95 Correct 4 ms 364 KB Output is correct
96 Correct 0 ms 364 KB Output is correct
97 Correct 0 ms 364 KB Output is correct
98 Correct 4 ms 504 KB Output is correct
99 Correct 1 ms 364 KB Output is correct
100 Correct 4 ms 364 KB Output is correct
101 Correct 4 ms 364 KB Output is correct
102 Correct 4 ms 364 KB Output is correct
103 Correct 4 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1026 ms 3920 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 1 ms 504 KB Output is correct
19 Correct 0 ms 364 KB Output is correct
20 Correct 0 ms 364 KB Output is correct
21 Correct 0 ms 364 KB Output is correct
22 Correct 0 ms 364 KB Output is correct
23 Correct 0 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 0 ms 364 KB Output is correct
26 Correct 0 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 0 ms 364 KB Output is correct
29 Correct 0 ms 364 KB Output is correct
30 Correct 0 ms 364 KB Output is correct
31 Correct 0 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 0 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 0 ms 364 KB Output is correct
36 Correct 0 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 0 ms 364 KB Output is correct
39 Correct 1 ms 364 KB Output is correct
40 Correct 0 ms 364 KB Output is correct
41 Correct 0 ms 364 KB Output is correct
42 Correct 0 ms 364 KB Output is correct
43 Correct 0 ms 384 KB Output is correct
44 Correct 0 ms 364 KB Output is correct
45 Correct 1 ms 364 KB Output is correct
46 Correct 0 ms 364 KB Output is correct
47 Correct 0 ms 364 KB Output is correct
48 Correct 0 ms 364 KB Output is correct
49 Correct 0 ms 364 KB Output is correct
50 Correct 1 ms 364 KB Output is correct
51 Correct 0 ms 364 KB Output is correct
52 Correct 1 ms 364 KB Output is correct
53 Correct 0 ms 364 KB Output is correct
54 Correct 4 ms 364 KB Output is correct
55 Correct 4 ms 364 KB Output is correct
56 Correct 3 ms 364 KB Output is correct
57 Correct 6 ms 512 KB Output is correct
58 Correct 4 ms 364 KB Output is correct
59 Correct 4 ms 364 KB Output is correct
60 Correct 4 ms 364 KB Output is correct
61 Correct 4 ms 364 KB Output is correct
62 Correct 4 ms 364 KB Output is correct
63 Correct 4 ms 364 KB Output is correct
64 Correct 4 ms 364 KB Output is correct
65 Correct 4 ms 364 KB Output is correct
66 Correct 4 ms 364 KB Output is correct
67 Correct 4 ms 364 KB Output is correct
68 Correct 3 ms 364 KB Output is correct
69 Correct 4 ms 364 KB Output is correct
70 Correct 4 ms 364 KB Output is correct
71 Correct 5 ms 364 KB Output is correct
72 Correct 3 ms 364 KB Output is correct
73 Correct 4 ms 364 KB Output is correct
74 Correct 4 ms 364 KB Output is correct
75 Correct 4 ms 364 KB Output is correct
76 Correct 4 ms 364 KB Output is correct
77 Correct 4 ms 364 KB Output is correct
78 Correct 4 ms 364 KB Output is correct
79 Correct 4 ms 364 KB Output is correct
80 Correct 5 ms 364 KB Output is correct
81 Correct 4 ms 364 KB Output is correct
82 Correct 5 ms 364 KB Output is correct
83 Correct 3 ms 364 KB Output is correct
84 Correct 4 ms 364 KB Output is correct
85 Correct 4 ms 364 KB Output is correct
86 Correct 4 ms 364 KB Output is correct
87 Correct 4 ms 364 KB Output is correct
88 Correct 4 ms 364 KB Output is correct
89 Correct 3 ms 508 KB Output is correct
90 Correct 4 ms 364 KB Output is correct
91 Correct 4 ms 364 KB Output is correct
92 Correct 5 ms 364 KB Output is correct
93 Correct 5 ms 364 KB Output is correct
94 Correct 4 ms 364 KB Output is correct
95 Correct 4 ms 364 KB Output is correct
96 Correct 0 ms 364 KB Output is correct
97 Correct 0 ms 364 KB Output is correct
98 Correct 4 ms 504 KB Output is correct
99 Correct 1 ms 364 KB Output is correct
100 Correct 4 ms 364 KB Output is correct
101 Correct 4 ms 364 KB Output is correct
102 Correct 4 ms 364 KB Output is correct
103 Correct 4 ms 364 KB Output is correct
104 Execution timed out 1026 ms 3920 KB Time limit exceeded
105 Halted 0 ms 0 KB -