Submission #485092

# Submission time Handle Problem Language Result Execution time Memory
485092 2021-11-06T07:22:30 Z nhanbin03 Watermelon (INOI20_watermelon) C++14
100 / 100
102 ms 18704 KB
#include <bits/stdc++.h>
#define task "INOI20_watermelon"
#define X first
#define Y second
#define left ___left
#define right ___right

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = 1e5 + 10;

int n, k;
int a[N], inDeg[N], ans[N], rev[N];
vector<int> adj[N], pos[N];

bool buildDAG(int maxVal) {
    for (int i = 1; i <= n; i++) {
        pos[a[i]].push_back(i);
    }
    set<int> posSet;
    for (int i = maxVal; i >= 1; i--) {
        if (pos[i].empty()) return 0;
        for (int j = pos[i].size() - 1; j >= 0; j--)  {
            int x = pos[i][j];
            auto it = posSet.lower_bound(x);
            if (it != posSet.end()) {
                adj[x].push_back(*it);
                inDeg[*it]++;
            }
            if (it != posSet.begin()) {
                it--;
                if (j == 0 || pos[i][j - 1] < *it) {
                    adj[x].push_back(*it);
                    inDeg[*it]++;
                }
            }
            posSet.insert(x);
        }
    }
    return 1;
}

void solve() {
    priority_queue<int, vector<int>, greater<int>> pq;
    for (int i = 1; i <= n; i++) {
        if (inDeg[i] == 0) {
            pq.push(i);
        }
    }
    for (int i = 1; i <= n; i++) {
        int u = pq.top(); pq.pop();
        ans[u] = i;
        for (int v : adj[u]) {
            inDeg[v]--;
            if (inDeg[v] == 0) pq.push(v);
        }
    }
    for (int i = 1; i <= n; i++) {
        assert(inDeg[i] == 0);
        rev[ans[i]] = i;
    }
}

bool check() {
    vector<int> left(n + 1), right(n + 1), tmp(n + 1, -1);
    set<int> cur;
    for (int i = 1; i < n; i++) {
        left[i + 1] = i;
        right[i] = i + 1;
        if (ans[i] < ans[i + 1]) cur.insert(i);
    }
    int cnt = 0;
    while (cur.size()) {
        cnt++;
        set<int> nxt;
        for (auto it = cur.begin(); it != cur.end(); it++) {
            int x = *it;
//            cout << x << endl;
            tmp[x] = cnt;
            right[left[x]] = right[x];
            left[right[x]] = left[x];
            if (left[x] != 0 && ans[left[x]] < ans[right[x]]) nxt.insert(left[x]);
        }
//        cout << endl;
        cur = nxt;
    }
//    for (int i = 1; i <= n; i++) {
//        cout << tmp[i] << " " << a[i] << endl;
//    }cout << endl;
    for (int i = 1; i <= n; i++) {
        if (tmp[i] != -1 && a[i] != tmp[i]) return 0;
    }
    return 1;
}

bool findNext() {
    set<int> s;
    for (int i = n; i >= 1; i--) {
        int u = rev[i];
//        cout << i << " " << u << endl;
        for (int v : adj[u]) {
            inDeg[v]++;
            s.erase(v);
        }
//        for (auto it = s.begin(); it != s.end(); it++) cout << *it << " "; cout << endl;
        auto it = s.lower_bound(u);
        if (it != s.end()) {
            priority_queue<int, vector<int>, greater<int>> pq;
            int u = *it;
            pq.push(u);
            for (int j = i; j <= n; j++) {
                int u = pq.top(); pq.pop();
                if (j == i) {
                    pq.push(rev[i]);
//                    cout << rev[i] << endl;
                    for (auto it = s.begin(); it != s.end(); it++) {
//                        cout << *it << " ";
                        if (*it != u) pq.push(*it);
                    }
//                    cout << endl;
                }
                ans[u] = j;
                for (int v : adj[u]) {
                    inDeg[v]--;
//                    cout << u << " " << v << " " << inDeg[v] << endl;
                    if (inDeg[v] == 0) pq.push(v);
                }
            }
            return 1;
        }
        s.insert(u);
    }
    return 0;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cout.tie(0);
    if (fopen(task ".inp","r")) {
        freopen(task ".inp","r",stdin);
        freopen(task ".out","w",stdout);
    }
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    if (a[n] != -1) {
        cout << -1;
        return 0;
    }
    int maxVal = 0;
    for (int i = 1; i <= n; i++) {
        maxVal = max(maxVal, a[i]);
    }
    for (int i = n; i >= 1; i--) {
        if (a[i] == -1) a[i] = ++maxVal;
    }
//    for (int i = 1; i <= n; i++) {
//        cout << a[i] << " ";
//    }
//    cout << "\n";
    if (!buildDAG(maxVal)) {
        cout << -1;
        return 0;
    }
//    for (int i = 1; i <= n; i++) {
//        cout << i << ": ";
//        for (int j : adj[i]) {
//            cout << j << " ";
//        }
//        cout << "\n";
//    }
    solve();
    if (!check()) {
        cout << -1;
        return 0;
    }
    for (int i = 1; i < k; i++) {
        if (!findNext()) {
            cout << -1;
            return 0;
        }
        for (int j = 1; j <= n; j++) {
//            cout << ans[j] << " ";
            assert(inDeg[j] == 0);
            rev[ans[j]] = j;
        }
//        cout << endl;
    }
    for (int i = 1; i <= n; i++) {
        cout << ans[i] << " ";
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:144:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  144 |         freopen(task ".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:145:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  145 |         freopen(task ".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 4 ms 5048 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 4 ms 4940 KB Output is correct
6 Correct 3 ms 4940 KB Output is correct
7 Correct 3 ms 4940 KB Output is correct
8 Correct 5 ms 4940 KB Output is correct
9 Correct 4 ms 5016 KB Output is correct
10 Correct 3 ms 4940 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 3 ms 4940 KB Output is correct
13 Correct 3 ms 5020 KB Output is correct
14 Correct 3 ms 4940 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 4940 KB Output is correct
17 Correct 3 ms 5016 KB Output is correct
18 Correct 4 ms 4940 KB Output is correct
19 Correct 4 ms 4940 KB Output is correct
20 Correct 3 ms 5020 KB Output is correct
21 Correct 4 ms 4940 KB Output is correct
22 Correct 4 ms 4940 KB Output is correct
23 Correct 3 ms 4940 KB Output is correct
24 Correct 4 ms 4940 KB Output is correct
25 Correct 3 ms 4940 KB Output is correct
26 Correct 4 ms 5016 KB Output is correct
27 Correct 3 ms 5068 KB Output is correct
28 Correct 3 ms 4940 KB Output is correct
29 Correct 3 ms 4940 KB Output is correct
30 Correct 3 ms 4940 KB Output is correct
31 Correct 4 ms 5020 KB Output is correct
32 Correct 3 ms 4940 KB Output is correct
33 Correct 3 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 4 ms 5048 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 4 ms 4940 KB Output is correct
6 Correct 3 ms 4940 KB Output is correct
7 Correct 3 ms 4940 KB Output is correct
8 Correct 5 ms 4940 KB Output is correct
9 Correct 4 ms 5016 KB Output is correct
10 Correct 3 ms 4940 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 3 ms 4940 KB Output is correct
13 Correct 3 ms 5020 KB Output is correct
14 Correct 3 ms 4940 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 4940 KB Output is correct
17 Correct 3 ms 5016 KB Output is correct
18 Correct 4 ms 4940 KB Output is correct
19 Correct 4 ms 4940 KB Output is correct
20 Correct 3 ms 5020 KB Output is correct
21 Correct 4 ms 4940 KB Output is correct
22 Correct 4 ms 4940 KB Output is correct
23 Correct 3 ms 4940 KB Output is correct
24 Correct 4 ms 4940 KB Output is correct
25 Correct 3 ms 4940 KB Output is correct
26 Correct 4 ms 5016 KB Output is correct
27 Correct 3 ms 5068 KB Output is correct
28 Correct 3 ms 4940 KB Output is correct
29 Correct 3 ms 4940 KB Output is correct
30 Correct 3 ms 4940 KB Output is correct
31 Correct 4 ms 5020 KB Output is correct
32 Correct 3 ms 4940 KB Output is correct
33 Correct 3 ms 4940 KB Output is correct
34 Correct 4 ms 5196 KB Output is correct
35 Correct 5 ms 5196 KB Output is correct
36 Correct 3 ms 5068 KB Output is correct
37 Correct 5 ms 5068 KB Output is correct
38 Correct 5 ms 5196 KB Output is correct
39 Correct 5 ms 5196 KB Output is correct
40 Correct 5 ms 5196 KB Output is correct
41 Correct 5 ms 5276 KB Output is correct
42 Correct 4 ms 5196 KB Output is correct
43 Correct 5 ms 5196 KB Output is correct
44 Correct 5 ms 5196 KB Output is correct
45 Correct 5 ms 5244 KB Output is correct
46 Correct 4 ms 5280 KB Output is correct
47 Correct 3 ms 5068 KB Output is correct
48 Correct 3 ms 5024 KB Output is correct
49 Correct 3 ms 5024 KB Output is correct
50 Correct 3 ms 5064 KB Output is correct
51 Correct 3 ms 5068 KB Output is correct
52 Correct 3 ms 5068 KB Output is correct
53 Correct 4 ms 5196 KB Output is correct
54 Correct 4 ms 5140 KB Output is correct
55 Correct 3 ms 5020 KB Output is correct
56 Correct 4 ms 5068 KB Output is correct
57 Correct 6 ms 5196 KB Output is correct
58 Correct 4 ms 5196 KB Output is correct
59 Correct 6 ms 5280 KB Output is correct
60 Correct 4 ms 5196 KB Output is correct
61 Correct 5 ms 5196 KB Output is correct
62 Correct 4 ms 5196 KB Output is correct
63 Correct 4 ms 5196 KB Output is correct
64 Correct 3 ms 5068 KB Output is correct
65 Correct 4 ms 5196 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 10624 KB Output is correct
2 Correct 11 ms 5964 KB Output is correct
3 Correct 41 ms 10628 KB Output is correct
4 Correct 9 ms 5972 KB Output is correct
5 Correct 40 ms 10684 KB Output is correct
6 Correct 45 ms 10708 KB Output is correct
7 Correct 43 ms 10620 KB Output is correct
8 Correct 43 ms 10652 KB Output is correct
9 Correct 43 ms 10604 KB Output is correct
10 Correct 38 ms 10660 KB Output is correct
11 Correct 81 ms 16060 KB Output is correct
12 Correct 88 ms 16148 KB Output is correct
13 Correct 88 ms 16060 KB Output is correct
14 Correct 81 ms 16076 KB Output is correct
15 Correct 16 ms 6988 KB Output is correct
16 Correct 16 ms 6980 KB Output is correct
17 Correct 16 ms 6984 KB Output is correct
18 Correct 18 ms 7048 KB Output is correct
19 Correct 24 ms 6980 KB Output is correct
20 Correct 17 ms 6988 KB Output is correct
21 Correct 23 ms 7020 KB Output is correct
22 Correct 26 ms 7064 KB Output is correct
23 Correct 16 ms 7016 KB Output is correct
24 Correct 70 ms 16664 KB Output is correct
25 Correct 71 ms 16656 KB Output is correct
26 Correct 71 ms 16836 KB Output is correct
27 Correct 82 ms 16424 KB Output is correct
28 Correct 73 ms 16804 KB Output is correct
29 Correct 71 ms 16412 KB Output is correct
30 Correct 23 ms 8316 KB Output is correct
31 Correct 59 ms 10576 KB Output is correct
32 Correct 88 ms 14996 KB Output is correct
33 Correct 91 ms 16148 KB Output is correct
34 Correct 8 ms 6220 KB Output is correct
35 Correct 16 ms 7236 KB Output is correct
36 Correct 40 ms 10564 KB Output is correct
37 Correct 93 ms 16080 KB Output is correct
38 Correct 81 ms 16564 KB Output is correct
39 Correct 90 ms 16128 KB Output is correct
40 Correct 63 ms 17532 KB Output is correct
41 Correct 78 ms 18704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 10624 KB Output is correct
2 Correct 11 ms 5964 KB Output is correct
3 Correct 41 ms 10628 KB Output is correct
4 Correct 9 ms 5972 KB Output is correct
5 Correct 40 ms 10684 KB Output is correct
6 Correct 45 ms 10708 KB Output is correct
7 Correct 43 ms 10620 KB Output is correct
8 Correct 43 ms 10652 KB Output is correct
9 Correct 43 ms 10604 KB Output is correct
10 Correct 38 ms 10660 KB Output is correct
11 Correct 81 ms 16060 KB Output is correct
12 Correct 88 ms 16148 KB Output is correct
13 Correct 88 ms 16060 KB Output is correct
14 Correct 81 ms 16076 KB Output is correct
15 Correct 16 ms 6988 KB Output is correct
16 Correct 16 ms 6980 KB Output is correct
17 Correct 16 ms 6984 KB Output is correct
18 Correct 18 ms 7048 KB Output is correct
19 Correct 24 ms 6980 KB Output is correct
20 Correct 17 ms 6988 KB Output is correct
21 Correct 23 ms 7020 KB Output is correct
22 Correct 26 ms 7064 KB Output is correct
23 Correct 16 ms 7016 KB Output is correct
24 Correct 70 ms 16664 KB Output is correct
25 Correct 71 ms 16656 KB Output is correct
26 Correct 71 ms 16836 KB Output is correct
27 Correct 82 ms 16424 KB Output is correct
28 Correct 73 ms 16804 KB Output is correct
29 Correct 71 ms 16412 KB Output is correct
30 Correct 23 ms 8316 KB Output is correct
31 Correct 59 ms 10576 KB Output is correct
32 Correct 88 ms 14996 KB Output is correct
33 Correct 91 ms 16148 KB Output is correct
34 Correct 8 ms 6220 KB Output is correct
35 Correct 16 ms 7236 KB Output is correct
36 Correct 40 ms 10564 KB Output is correct
37 Correct 93 ms 16080 KB Output is correct
38 Correct 81 ms 16564 KB Output is correct
39 Correct 90 ms 16128 KB Output is correct
40 Correct 63 ms 17532 KB Output is correct
41 Correct 78 ms 18704 KB Output is correct
42 Correct 42 ms 10652 KB Output is correct
43 Correct 9 ms 5976 KB Output is correct
44 Correct 38 ms 10656 KB Output is correct
45 Correct 9 ms 5964 KB Output is correct
46 Correct 9 ms 5964 KB Output is correct
47 Correct 10 ms 5964 KB Output is correct
48 Correct 10 ms 5964 KB Output is correct
49 Correct 40 ms 10632 KB Output is correct
50 Correct 40 ms 10632 KB Output is correct
51 Correct 39 ms 10632 KB Output is correct
52 Correct 80 ms 16044 KB Output is correct
53 Correct 83 ms 16096 KB Output is correct
54 Correct 23 ms 6980 KB Output is correct
55 Correct 17 ms 7080 KB Output is correct
56 Correct 81 ms 14976 KB Output is correct
57 Correct 90 ms 16068 KB Output is correct
58 Correct 91 ms 16132 KB Output is correct
59 Correct 83 ms 16332 KB Output is correct
60 Correct 93 ms 16244 KB Output is correct
61 Correct 69 ms 17472 KB Output is correct
62 Correct 66 ms 18656 KB Output is correct
63 Correct 77 ms 16540 KB Output is correct
64 Correct 68 ms 16836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 4 ms 5048 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 4 ms 4940 KB Output is correct
5 Correct 4 ms 4940 KB Output is correct
6 Correct 3 ms 4940 KB Output is correct
7 Correct 3 ms 4940 KB Output is correct
8 Correct 5 ms 4940 KB Output is correct
9 Correct 4 ms 5016 KB Output is correct
10 Correct 3 ms 4940 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 3 ms 4940 KB Output is correct
13 Correct 3 ms 5020 KB Output is correct
14 Correct 3 ms 4940 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 4940 KB Output is correct
17 Correct 3 ms 5016 KB Output is correct
18 Correct 4 ms 4940 KB Output is correct
19 Correct 4 ms 4940 KB Output is correct
20 Correct 3 ms 5020 KB Output is correct
21 Correct 4 ms 4940 KB Output is correct
22 Correct 4 ms 4940 KB Output is correct
23 Correct 3 ms 4940 KB Output is correct
24 Correct 4 ms 4940 KB Output is correct
25 Correct 3 ms 4940 KB Output is correct
26 Correct 4 ms 5016 KB Output is correct
27 Correct 3 ms 5068 KB Output is correct
28 Correct 3 ms 4940 KB Output is correct
29 Correct 3 ms 4940 KB Output is correct
30 Correct 3 ms 4940 KB Output is correct
31 Correct 4 ms 5020 KB Output is correct
32 Correct 3 ms 4940 KB Output is correct
33 Correct 3 ms 4940 KB Output is correct
34 Correct 4 ms 5196 KB Output is correct
35 Correct 5 ms 5196 KB Output is correct
36 Correct 3 ms 5068 KB Output is correct
37 Correct 5 ms 5068 KB Output is correct
38 Correct 5 ms 5196 KB Output is correct
39 Correct 5 ms 5196 KB Output is correct
40 Correct 5 ms 5196 KB Output is correct
41 Correct 5 ms 5276 KB Output is correct
42 Correct 4 ms 5196 KB Output is correct
43 Correct 5 ms 5196 KB Output is correct
44 Correct 5 ms 5196 KB Output is correct
45 Correct 5 ms 5244 KB Output is correct
46 Correct 4 ms 5280 KB Output is correct
47 Correct 3 ms 5068 KB Output is correct
48 Correct 3 ms 5024 KB Output is correct
49 Correct 3 ms 5024 KB Output is correct
50 Correct 3 ms 5064 KB Output is correct
51 Correct 3 ms 5068 KB Output is correct
52 Correct 3 ms 5068 KB Output is correct
53 Correct 4 ms 5196 KB Output is correct
54 Correct 4 ms 5140 KB Output is correct
55 Correct 3 ms 5020 KB Output is correct
56 Correct 4 ms 5068 KB Output is correct
57 Correct 6 ms 5196 KB Output is correct
58 Correct 4 ms 5196 KB Output is correct
59 Correct 6 ms 5280 KB Output is correct
60 Correct 4 ms 5196 KB Output is correct
61 Correct 5 ms 5196 KB Output is correct
62 Correct 4 ms 5196 KB Output is correct
63 Correct 4 ms 5196 KB Output is correct
64 Correct 3 ms 5068 KB Output is correct
65 Correct 4 ms 5196 KB Output is correct
66 Correct 43 ms 10624 KB Output is correct
67 Correct 11 ms 5964 KB Output is correct
68 Correct 41 ms 10628 KB Output is correct
69 Correct 9 ms 5972 KB Output is correct
70 Correct 40 ms 10684 KB Output is correct
71 Correct 45 ms 10708 KB Output is correct
72 Correct 43 ms 10620 KB Output is correct
73 Correct 43 ms 10652 KB Output is correct
74 Correct 43 ms 10604 KB Output is correct
75 Correct 38 ms 10660 KB Output is correct
76 Correct 81 ms 16060 KB Output is correct
77 Correct 88 ms 16148 KB Output is correct
78 Correct 88 ms 16060 KB Output is correct
79 Correct 81 ms 16076 KB Output is correct
80 Correct 16 ms 6988 KB Output is correct
81 Correct 16 ms 6980 KB Output is correct
82 Correct 16 ms 6984 KB Output is correct
83 Correct 18 ms 7048 KB Output is correct
84 Correct 24 ms 6980 KB Output is correct
85 Correct 17 ms 6988 KB Output is correct
86 Correct 23 ms 7020 KB Output is correct
87 Correct 26 ms 7064 KB Output is correct
88 Correct 16 ms 7016 KB Output is correct
89 Correct 70 ms 16664 KB Output is correct
90 Correct 71 ms 16656 KB Output is correct
91 Correct 71 ms 16836 KB Output is correct
92 Correct 82 ms 16424 KB Output is correct
93 Correct 73 ms 16804 KB Output is correct
94 Correct 71 ms 16412 KB Output is correct
95 Correct 23 ms 8316 KB Output is correct
96 Correct 59 ms 10576 KB Output is correct
97 Correct 88 ms 14996 KB Output is correct
98 Correct 91 ms 16148 KB Output is correct
99 Correct 8 ms 6220 KB Output is correct
100 Correct 16 ms 7236 KB Output is correct
101 Correct 40 ms 10564 KB Output is correct
102 Correct 93 ms 16080 KB Output is correct
103 Correct 81 ms 16564 KB Output is correct
104 Correct 90 ms 16128 KB Output is correct
105 Correct 63 ms 17532 KB Output is correct
106 Correct 78 ms 18704 KB Output is correct
107 Correct 42 ms 10652 KB Output is correct
108 Correct 9 ms 5976 KB Output is correct
109 Correct 38 ms 10656 KB Output is correct
110 Correct 9 ms 5964 KB Output is correct
111 Correct 9 ms 5964 KB Output is correct
112 Correct 10 ms 5964 KB Output is correct
113 Correct 10 ms 5964 KB Output is correct
114 Correct 40 ms 10632 KB Output is correct
115 Correct 40 ms 10632 KB Output is correct
116 Correct 39 ms 10632 KB Output is correct
117 Correct 80 ms 16044 KB Output is correct
118 Correct 83 ms 16096 KB Output is correct
119 Correct 23 ms 6980 KB Output is correct
120 Correct 17 ms 7080 KB Output is correct
121 Correct 81 ms 14976 KB Output is correct
122 Correct 90 ms 16068 KB Output is correct
123 Correct 91 ms 16132 KB Output is correct
124 Correct 83 ms 16332 KB Output is correct
125 Correct 93 ms 16244 KB Output is correct
126 Correct 69 ms 17472 KB Output is correct
127 Correct 66 ms 18656 KB Output is correct
128 Correct 77 ms 16540 KB Output is correct
129 Correct 68 ms 16836 KB Output is correct
130 Correct 3 ms 4940 KB Output is correct
131 Correct 3 ms 4940 KB Output is correct
132 Correct 4 ms 4940 KB Output is correct
133 Correct 92 ms 16324 KB Output is correct
134 Correct 88 ms 16260 KB Output is correct
135 Correct 99 ms 16316 KB Output is correct
136 Correct 17 ms 7532 KB Output is correct
137 Correct 16 ms 7592 KB Output is correct
138 Correct 18 ms 7592 KB Output is correct
139 Correct 16 ms 7628 KB Output is correct
140 Correct 17 ms 7544 KB Output is correct
141 Correct 17 ms 7628 KB Output is correct
142 Correct 85 ms 16444 KB Output is correct
143 Correct 84 ms 16328 KB Output is correct
144 Correct 100 ms 16488 KB Output is correct
145 Correct 82 ms 15300 KB Output is correct
146 Correct 102 ms 16448 KB Output is correct
147 Correct 86 ms 16624 KB Output is correct
148 Correct 83 ms 17788 KB Output is correct
149 Correct 91 ms 17784 KB Output is correct
150 Correct 97 ms 17792 KB Output is correct
151 Correct 78 ms 17048 KB Output is correct
152 Correct 81 ms 16964 KB Output is correct
153 Correct 78 ms 17024 KB Output is correct
154 Correct 71 ms 16960 KB Output is correct
155 Correct 75 ms 17204 KB Output is correct
156 Correct 71 ms 17232 KB Output is correct
157 Correct 71 ms 17356 KB Output is correct
158 Correct 75 ms 17076 KB Output is correct
159 Correct 73 ms 17068 KB Output is correct
160 Correct 71 ms 16964 KB Output is correct