#include <bits/stdc++.h>
#include "parks.h"
using namespace std;
typedef long long ll;
ll n;
vector<ll> uflnk;
vector<ll> sz;
ll find(ll a) {
if (a != uflnk[a]) uflnk[a] = find(uflnk[a]);
return uflnk[a];
}
bool same(ll a, ll b) {
return find(a) == find(b);
}
bool unite(ll a, ll b) {
a = find(a); b = find(b);
if (a == b) return false;
if (sz[a] > sz[b]) swap(a, b);
uflnk[a] = b;
sz[b] += sz[a];
return true;
}
int construct_roads(vector<int> x, vector<int> y) {
n = x.size();
vector<pair<pair<ll, ll>, ll>> coords(n);
for (int i = 0; i < n; i++) coords[i] = {{x[i], y[i]}, i};
sort(coords.begin(), coords.end());
for (int i = 0; i < n; i++) {
x[i] = coords[i].first.first;
y[i] = coords[i].first.second;
}
uflnk = vector<ll>(n);
sz = vector<ll>(n, 1);
for (int i = 0; i < n; i++) uflnk[i] = i;
unordered_map<ll, ll> pts;
vector<pair<ll, ll>> edges;
unordered_set<ll> hasEdge;
for (int i = 0; i < n; i++) {
ll hash = ((ll)x[i] << 31) | (ll)y[i];
pts[hash] = i;
}
for (ll i = 0; i < n; i++) {
ll hashL = (((ll)x[i]-2) << 31) | ((ll)y[i]);
if (pts.count(hashL)) {
if (!same(i, pts[hashL])) {
edges.push_back({i, pts[hashL]});
unite(i, pts[hashL]);
}
}
ll hashR = (((ll)x[i]+2) << 31) | ((ll)y[i]);
if (pts.count(hashR)) {
if (!same(i, pts[hashR])) {
edges.push_back({i, pts[hashR]});
unite(i, pts[hashR]);
}
}
ll hashD = (((ll)x[i]) << 31) | ((ll)y[i]-2);
if (pts.count(hashD)) {
if (!same(i, pts[hashD])) {
edges.push_back({i, pts[hashD]});
unite(i, pts[hashD]);
}
}
ll hashU = (((ll)x[i]) << 31) | ((ll)y[i]+2);
if (pts.count(hashU)) {
if (!same(i, pts[hashU])) {
edges.push_back({i, pts[hashU]});
unite(i, pts[hashU]);
}
}
}
unordered_map<ll, ll> poss;
unordered_set<ll> twos;
unordered_map<ll, ll> lnk, lnkU;
vector<pair<ll, ll>> edgeHashes(edges.size());
for (int i = 0; i < edges.size(); i++) {
auto e = edges[i];
ll midX = (x[e.first] + x[e.second]) / 2;
ll midY = (y[e.first] + y[e.second]) / 2;
ll leftX = midX - (midY - y[e.second]);
ll leftY = midY + (midX - x[e.second]);
ll rightX = midX + (midY - y[e.second]);
ll rightY = midY - (midX - x[e.second]);
ll hashL = (leftX << 31) | leftY;
ll hashR = (rightX << 31) | rightY;
if (twos.count(hashL)) twos.erase(hashL);
poss[hashL]++;
if (poss[hashL] >= 2) twos.insert(hashL);
if (twos.count(hashR)) twos.erase(hashR);
poss[hashR]++;
if (poss[hashR] >= 2) twos.insert(hashR);
lnk[hashL] ^= i;
lnk[hashR] ^= i;
lnkU[hashL] = i;
lnkU[hashR] = i;
edgeHashes[i] = {hashL, hashR};
}
vector<int> a(edges.size()), b(edges.size());
queue<ll> q;
for (auto &e : poss) {
if (e.second != 1) continue;
q.push(e.first);
}
unordered_set<ll> used;
while (used.size() < edges.size()) {
while (!q.empty()) {
ll hash = q.front(); q.pop();
if (poss[hash] != 1 || used.count(hash)) continue;
ll id = lnk[hash];
a[id] = hash >> 31;
b[id] = hash & ~(1 << 31);
used.insert(id);
if (twos.count(edgeHashes[id].first)) twos.erase(edgeHashes[id].first);
if (--poss[edgeHashes[id].first] == 1) q.push(edgeHashes[id].first);
if (poss[edgeHashes[id].first] >= 2) twos.insert(edgeHashes[id].first);
if (twos.count(edgeHashes[id].second)) twos.erase(edgeHashes[id].second);
if (--poss[edgeHashes[id].second] == 1) q.push(edgeHashes[id].second);
if (poss[edgeHashes[id].second] >= 2) twos.insert(edgeHashes[id].second);
lnk[edgeHashes[id].first] ^= id;
lnk[edgeHashes[id].second] ^= id;
}
if (used.size() < edges.size() && twos.empty()) {
throw;
for (auto &e : poss) {
if (e.second == 1) q.push(e.first);
if (e.second >= 2) twos.insert(e.first);
}
}
else if (used.size() < edges.size() && !twos.empty()) {
ll v = *twos.begin();
twos.erase(v);
for (int i = 0; i < 1; i = 10) {
i = lnkU[v];
if (used.count(i)) continue;
auto e = edges[i];
ll midX = (x[e.first] + x[e.second]) / 2;
ll midY = (y[e.first] + y[e.second]) / 2;
if (abs(midX - (v >> 31)) + abs(midY - (v & ~(1 << 31))) > 1) continue;
a[i] = v >> 31;
b[i] = v & ~(1 << 31);
poss[v] = 0;
ll otherX = a[i] + 2 * (midX - a[i]);
ll otherY = b[i] + 2 * (midY - b[i]);
ll otherHash = (otherX << 31) | otherY;
if (twos.count(otherHash)) twos.erase(otherHash);
poss[otherHash]--;
if (poss[otherHash] >= 2) twos.insert(otherHash);
lnk[otherHash] ^= i;
while (poss[otherHash] == 1) {
ll edge = lnk[otherHash];
auto e = edges[edge];
ll midX = (x[e.first] + x[e.second]) / 2;
ll midY = (y[e.first] + y[e.second]) / 2;
a[edge] = otherHash >> 31;
b[edge] = otherHash & ~(1 << 31);
ll otherX = a[edge] + 2 * (midX - a[edge]);
ll otherY = b[edge] + 2 * (midY - b[edge]);
otherHash = (otherX << 31) | otherY;
if (twos.count(otherHash)) twos.erase(otherHash);
poss[otherHash]--;
if (poss[otherHash] >= 2) twos.insert(otherHash);
lnk[otherHash] ^= edge;
used.insert(edge);
}
used.insert(i);
break;
}
}
}
uflnk = vector<ll>(n);
sz = vector<ll>(n, 1);
for (int i = 0; i < n; i++) uflnk[i] = i;
vector<int> u, v;
for (int i = 0; i < edges.size(); i++) {
u.push_back(coords[edges[i].first].second);
v.push_back(coords[edges[i].second].second);
unite(edges[i].first, edges[i].second);
}
if (sz[find(0)] < n) return 0;
build(u, v, a, b);
return 1;
}
Compilation message
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:84:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
84 | for (int i = 0; i < edges.size(); i++) {
| ~~^~~~~~~~~~~~~~
parks.cpp:184:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
184 | for (int i = 0; i < edges.size(); i++) {
| ~~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
91 ms |
50888 KB |
Output is correct |
10 |
Correct |
8 ms |
5080 KB |
Output is correct |
11 |
Correct |
44 ms |
27080 KB |
Output is correct |
12 |
Correct |
13 ms |
7664 KB |
Output is correct |
13 |
Correct |
33 ms |
22192 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
2 ms |
1116 KB |
Output is correct |
16 |
Correct |
93 ms |
50892 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
91 ms |
50888 KB |
Output is correct |
10 |
Correct |
8 ms |
5080 KB |
Output is correct |
11 |
Correct |
44 ms |
27080 KB |
Output is correct |
12 |
Correct |
13 ms |
7664 KB |
Output is correct |
13 |
Correct |
33 ms |
22192 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
2 ms |
1116 KB |
Output is correct |
16 |
Correct |
93 ms |
50892 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
212 ms |
76220 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
860 KB |
Output is correct |
26 |
Correct |
2 ms |
1372 KB |
Output is correct |
27 |
Correct |
3 ms |
1628 KB |
Output is correct |
28 |
Correct |
60 ms |
27716 KB |
Output is correct |
29 |
Correct |
114 ms |
44136 KB |
Output is correct |
30 |
Correct |
132 ms |
56312 KB |
Output is correct |
31 |
Correct |
185 ms |
76216 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
444 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
348 KB |
Output is correct |
43 |
Correct |
2 ms |
1144 KB |
Output is correct |
44 |
Correct |
3 ms |
1512 KB |
Output is correct |
45 |
Correct |
111 ms |
41580 KB |
Output is correct |
46 |
Correct |
192 ms |
62684 KB |
Output is correct |
47 |
Correct |
177 ms |
61680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
91 ms |
50888 KB |
Output is correct |
10 |
Correct |
8 ms |
5080 KB |
Output is correct |
11 |
Correct |
44 ms |
27080 KB |
Output is correct |
12 |
Correct |
13 ms |
7664 KB |
Output is correct |
13 |
Correct |
33 ms |
22192 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
2 ms |
1116 KB |
Output is correct |
16 |
Correct |
93 ms |
50892 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
212 ms |
76220 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
860 KB |
Output is correct |
26 |
Correct |
2 ms |
1372 KB |
Output is correct |
27 |
Correct |
3 ms |
1628 KB |
Output is correct |
28 |
Correct |
60 ms |
27716 KB |
Output is correct |
29 |
Correct |
114 ms |
44136 KB |
Output is correct |
30 |
Correct |
132 ms |
56312 KB |
Output is correct |
31 |
Correct |
185 ms |
76216 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
444 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
348 KB |
Output is correct |
43 |
Correct |
2 ms |
1144 KB |
Output is correct |
44 |
Correct |
3 ms |
1512 KB |
Output is correct |
45 |
Correct |
111 ms |
41580 KB |
Output is correct |
46 |
Correct |
192 ms |
62684 KB |
Output is correct |
47 |
Correct |
177 ms |
61680 KB |
Output is correct |
48 |
Correct |
0 ms |
600 KB |
Output is correct |
49 |
Correct |
0 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
436 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
0 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
186 ms |
76980 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
2 ms |
1116 KB |
Output is correct |
58 |
Correct |
5 ms |
2588 KB |
Output is correct |
59 |
Correct |
7 ms |
3544 KB |
Output is correct |
60 |
Correct |
81 ms |
38108 KB |
Output is correct |
61 |
Correct |
121 ms |
50816 KB |
Output is correct |
62 |
Correct |
140 ms |
58280 KB |
Output is correct |
63 |
Correct |
198 ms |
76592 KB |
Output is correct |
64 |
Correct |
0 ms |
348 KB |
Output is correct |
65 |
Correct |
0 ms |
348 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
226 ms |
102500 KB |
Output is correct |
68 |
Correct |
236 ms |
102512 KB |
Output is correct |
69 |
Correct |
234 ms |
102432 KB |
Output is correct |
70 |
Correct |
4 ms |
1884 KB |
Output is correct |
71 |
Correct |
8 ms |
3640 KB |
Output is correct |
72 |
Correct |
142 ms |
41216 KB |
Output is correct |
73 |
Correct |
239 ms |
64368 KB |
Output is correct |
74 |
Correct |
307 ms |
82768 KB |
Output is correct |
75 |
Correct |
197 ms |
83124 KB |
Output is correct |
76 |
Correct |
253 ms |
102416 KB |
Output is correct |
77 |
Correct |
4 ms |
2140 KB |
Output is correct |
78 |
Correct |
8 ms |
3804 KB |
Output is correct |
79 |
Correct |
128 ms |
41040 KB |
Output is correct |
80 |
Correct |
234 ms |
63636 KB |
Output is correct |
81 |
Correct |
293 ms |
82232 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
91 ms |
50888 KB |
Output is correct |
10 |
Correct |
8 ms |
5080 KB |
Output is correct |
11 |
Correct |
44 ms |
27080 KB |
Output is correct |
12 |
Correct |
13 ms |
7664 KB |
Output is correct |
13 |
Correct |
33 ms |
22192 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
2 ms |
1116 KB |
Output is correct |
16 |
Correct |
93 ms |
50892 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
227 ms |
78256 KB |
Output is correct |
21 |
Correct |
295 ms |
77624 KB |
Output is correct |
22 |
Correct |
288 ms |
78456 KB |
Output is correct |
23 |
Correct |
250 ms |
79704 KB |
Output is correct |
24 |
Correct |
56 ms |
23536 KB |
Output is correct |
25 |
Correct |
156 ms |
96272 KB |
Output is correct |
26 |
Correct |
180 ms |
96012 KB |
Output is correct |
27 |
Correct |
239 ms |
102364 KB |
Output is correct |
28 |
Correct |
225 ms |
101640 KB |
Output is correct |
29 |
Correct |
200 ms |
102232 KB |
Output is correct |
30 |
Correct |
192 ms |
101328 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
16 ms |
5964 KB |
Output is correct |
33 |
Correct |
25 ms |
12432 KB |
Output is correct |
34 |
Correct |
242 ms |
77884 KB |
Output is correct |
35 |
Correct |
9 ms |
4052 KB |
Output is correct |
36 |
Correct |
56 ms |
18864 KB |
Output is correct |
37 |
Correct |
114 ms |
37028 KB |
Output is correct |
38 |
Correct |
96 ms |
32508 KB |
Output is correct |
39 |
Correct |
137 ms |
44528 KB |
Output is correct |
40 |
Correct |
190 ms |
55856 KB |
Output is correct |
41 |
Correct |
255 ms |
67936 KB |
Output is correct |
42 |
Correct |
314 ms |
80192 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
0 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
0 ms |
348 KB |
Output is correct |
48 |
Correct |
0 ms |
348 KB |
Output is correct |
49 |
Correct |
0 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
0 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
2 ms |
1116 KB |
Output is correct |
55 |
Correct |
2 ms |
1372 KB |
Output is correct |
56 |
Correct |
114 ms |
41636 KB |
Output is correct |
57 |
Correct |
176 ms |
62944 KB |
Output is correct |
58 |
Correct |
178 ms |
62944 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
0 ms |
348 KB |
Output is correct |
61 |
Correct |
0 ms |
436 KB |
Output is correct |
62 |
Correct |
233 ms |
103304 KB |
Output is correct |
63 |
Correct |
228 ms |
102680 KB |
Output is correct |
64 |
Correct |
227 ms |
101912 KB |
Output is correct |
65 |
Correct |
4 ms |
1884 KB |
Output is correct |
66 |
Correct |
7 ms |
3416 KB |
Output is correct |
67 |
Correct |
127 ms |
41044 KB |
Output is correct |
68 |
Correct |
234 ms |
64152 KB |
Output is correct |
69 |
Correct |
301 ms |
81984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
91 ms |
50888 KB |
Output is correct |
10 |
Correct |
8 ms |
5080 KB |
Output is correct |
11 |
Correct |
44 ms |
27080 KB |
Output is correct |
12 |
Correct |
13 ms |
7664 KB |
Output is correct |
13 |
Correct |
33 ms |
22192 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
2 ms |
1116 KB |
Output is correct |
16 |
Correct |
93 ms |
50892 KB |
Output is correct |
17 |
Correct |
401 ms |
102256 KB |
Output is correct |
18 |
Correct |
401 ms |
102420 KB |
Output is correct |
19 |
Correct |
298 ms |
77624 KB |
Output is correct |
20 |
Correct |
196 ms |
81532 KB |
Output is correct |
21 |
Correct |
209 ms |
81896 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
36 ms |
12736 KB |
Output is correct |
24 |
Correct |
19 ms |
8088 KB |
Output is correct |
25 |
Correct |
71 ms |
28016 KB |
Output is correct |
26 |
Correct |
136 ms |
44648 KB |
Output is correct |
27 |
Correct |
124 ms |
41340 KB |
Output is correct |
28 |
Correct |
150 ms |
50168 KB |
Output is correct |
29 |
Correct |
202 ms |
64148 KB |
Output is correct |
30 |
Correct |
250 ms |
73676 KB |
Output is correct |
31 |
Correct |
298 ms |
82500 KB |
Output is correct |
32 |
Correct |
197 ms |
83256 KB |
Output is correct |
33 |
Correct |
248 ms |
102928 KB |
Output is correct |
34 |
Correct |
4 ms |
2136 KB |
Output is correct |
35 |
Correct |
8 ms |
3916 KB |
Output is correct |
36 |
Correct |
122 ms |
41048 KB |
Output is correct |
37 |
Correct |
201 ms |
63128 KB |
Output is correct |
38 |
Correct |
279 ms |
82128 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
91 ms |
50888 KB |
Output is correct |
10 |
Correct |
8 ms |
5080 KB |
Output is correct |
11 |
Correct |
44 ms |
27080 KB |
Output is correct |
12 |
Correct |
13 ms |
7664 KB |
Output is correct |
13 |
Correct |
33 ms |
22192 KB |
Output is correct |
14 |
Correct |
1 ms |
860 KB |
Output is correct |
15 |
Correct |
2 ms |
1116 KB |
Output is correct |
16 |
Correct |
93 ms |
50892 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
212 ms |
76220 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
860 KB |
Output is correct |
26 |
Correct |
2 ms |
1372 KB |
Output is correct |
27 |
Correct |
3 ms |
1628 KB |
Output is correct |
28 |
Correct |
60 ms |
27716 KB |
Output is correct |
29 |
Correct |
114 ms |
44136 KB |
Output is correct |
30 |
Correct |
132 ms |
56312 KB |
Output is correct |
31 |
Correct |
185 ms |
76216 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
444 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
0 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
348 KB |
Output is correct |
43 |
Correct |
2 ms |
1144 KB |
Output is correct |
44 |
Correct |
3 ms |
1512 KB |
Output is correct |
45 |
Correct |
111 ms |
41580 KB |
Output is correct |
46 |
Correct |
192 ms |
62684 KB |
Output is correct |
47 |
Correct |
177 ms |
61680 KB |
Output is correct |
48 |
Correct |
0 ms |
600 KB |
Output is correct |
49 |
Correct |
0 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
436 KB |
Output is correct |
51 |
Correct |
0 ms |
348 KB |
Output is correct |
52 |
Correct |
0 ms |
348 KB |
Output is correct |
53 |
Correct |
0 ms |
348 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
186 ms |
76980 KB |
Output is correct |
56 |
Correct |
0 ms |
348 KB |
Output is correct |
57 |
Correct |
2 ms |
1116 KB |
Output is correct |
58 |
Correct |
5 ms |
2588 KB |
Output is correct |
59 |
Correct |
7 ms |
3544 KB |
Output is correct |
60 |
Correct |
81 ms |
38108 KB |
Output is correct |
61 |
Correct |
121 ms |
50816 KB |
Output is correct |
62 |
Correct |
140 ms |
58280 KB |
Output is correct |
63 |
Correct |
198 ms |
76592 KB |
Output is correct |
64 |
Correct |
0 ms |
348 KB |
Output is correct |
65 |
Correct |
0 ms |
348 KB |
Output is correct |
66 |
Correct |
0 ms |
348 KB |
Output is correct |
67 |
Correct |
226 ms |
102500 KB |
Output is correct |
68 |
Correct |
236 ms |
102512 KB |
Output is correct |
69 |
Correct |
234 ms |
102432 KB |
Output is correct |
70 |
Correct |
4 ms |
1884 KB |
Output is correct |
71 |
Correct |
8 ms |
3640 KB |
Output is correct |
72 |
Correct |
142 ms |
41216 KB |
Output is correct |
73 |
Correct |
239 ms |
64368 KB |
Output is correct |
74 |
Correct |
307 ms |
82768 KB |
Output is correct |
75 |
Correct |
197 ms |
83124 KB |
Output is correct |
76 |
Correct |
253 ms |
102416 KB |
Output is correct |
77 |
Correct |
4 ms |
2140 KB |
Output is correct |
78 |
Correct |
8 ms |
3804 KB |
Output is correct |
79 |
Correct |
128 ms |
41040 KB |
Output is correct |
80 |
Correct |
234 ms |
63636 KB |
Output is correct |
81 |
Correct |
293 ms |
82232 KB |
Output is correct |
82 |
Correct |
0 ms |
348 KB |
Output is correct |
83 |
Correct |
0 ms |
348 KB |
Output is correct |
84 |
Correct |
0 ms |
348 KB |
Output is correct |
85 |
Correct |
227 ms |
78256 KB |
Output is correct |
86 |
Correct |
295 ms |
77624 KB |
Output is correct |
87 |
Correct |
288 ms |
78456 KB |
Output is correct |
88 |
Correct |
250 ms |
79704 KB |
Output is correct |
89 |
Correct |
56 ms |
23536 KB |
Output is correct |
90 |
Correct |
156 ms |
96272 KB |
Output is correct |
91 |
Correct |
180 ms |
96012 KB |
Output is correct |
92 |
Correct |
239 ms |
102364 KB |
Output is correct |
93 |
Correct |
225 ms |
101640 KB |
Output is correct |
94 |
Correct |
200 ms |
102232 KB |
Output is correct |
95 |
Correct |
192 ms |
101328 KB |
Output is correct |
96 |
Correct |
0 ms |
348 KB |
Output is correct |
97 |
Correct |
16 ms |
5964 KB |
Output is correct |
98 |
Correct |
25 ms |
12432 KB |
Output is correct |
99 |
Correct |
242 ms |
77884 KB |
Output is correct |
100 |
Correct |
9 ms |
4052 KB |
Output is correct |
101 |
Correct |
56 ms |
18864 KB |
Output is correct |
102 |
Correct |
114 ms |
37028 KB |
Output is correct |
103 |
Correct |
96 ms |
32508 KB |
Output is correct |
104 |
Correct |
137 ms |
44528 KB |
Output is correct |
105 |
Correct |
190 ms |
55856 KB |
Output is correct |
106 |
Correct |
255 ms |
67936 KB |
Output is correct |
107 |
Correct |
314 ms |
80192 KB |
Output is correct |
108 |
Correct |
0 ms |
348 KB |
Output is correct |
109 |
Correct |
0 ms |
348 KB |
Output is correct |
110 |
Correct |
0 ms |
348 KB |
Output is correct |
111 |
Correct |
0 ms |
348 KB |
Output is correct |
112 |
Correct |
0 ms |
348 KB |
Output is correct |
113 |
Correct |
0 ms |
348 KB |
Output is correct |
114 |
Correct |
0 ms |
348 KB |
Output is correct |
115 |
Correct |
0 ms |
348 KB |
Output is correct |
116 |
Correct |
0 ms |
348 KB |
Output is correct |
117 |
Correct |
0 ms |
348 KB |
Output is correct |
118 |
Correct |
0 ms |
348 KB |
Output is correct |
119 |
Correct |
2 ms |
1116 KB |
Output is correct |
120 |
Correct |
2 ms |
1372 KB |
Output is correct |
121 |
Correct |
114 ms |
41636 KB |
Output is correct |
122 |
Correct |
176 ms |
62944 KB |
Output is correct |
123 |
Correct |
178 ms |
62944 KB |
Output is correct |
124 |
Correct |
0 ms |
348 KB |
Output is correct |
125 |
Correct |
0 ms |
348 KB |
Output is correct |
126 |
Correct |
0 ms |
436 KB |
Output is correct |
127 |
Correct |
233 ms |
103304 KB |
Output is correct |
128 |
Correct |
228 ms |
102680 KB |
Output is correct |
129 |
Correct |
227 ms |
101912 KB |
Output is correct |
130 |
Correct |
4 ms |
1884 KB |
Output is correct |
131 |
Correct |
7 ms |
3416 KB |
Output is correct |
132 |
Correct |
127 ms |
41044 KB |
Output is correct |
133 |
Correct |
234 ms |
64152 KB |
Output is correct |
134 |
Correct |
301 ms |
81984 KB |
Output is correct |
135 |
Correct |
401 ms |
102256 KB |
Output is correct |
136 |
Correct |
401 ms |
102420 KB |
Output is correct |
137 |
Correct |
298 ms |
77624 KB |
Output is correct |
138 |
Correct |
196 ms |
81532 KB |
Output is correct |
139 |
Correct |
209 ms |
81896 KB |
Output is correct |
140 |
Correct |
0 ms |
344 KB |
Output is correct |
141 |
Correct |
36 ms |
12736 KB |
Output is correct |
142 |
Correct |
19 ms |
8088 KB |
Output is correct |
143 |
Correct |
71 ms |
28016 KB |
Output is correct |
144 |
Correct |
136 ms |
44648 KB |
Output is correct |
145 |
Correct |
124 ms |
41340 KB |
Output is correct |
146 |
Correct |
150 ms |
50168 KB |
Output is correct |
147 |
Correct |
202 ms |
64148 KB |
Output is correct |
148 |
Correct |
250 ms |
73676 KB |
Output is correct |
149 |
Correct |
298 ms |
82500 KB |
Output is correct |
150 |
Correct |
197 ms |
83256 KB |
Output is correct |
151 |
Correct |
248 ms |
102928 KB |
Output is correct |
152 |
Correct |
4 ms |
2136 KB |
Output is correct |
153 |
Correct |
8 ms |
3916 KB |
Output is correct |
154 |
Correct |
122 ms |
41048 KB |
Output is correct |
155 |
Correct |
201 ms |
63128 KB |
Output is correct |
156 |
Correct |
279 ms |
82128 KB |
Output is correct |
157 |
Correct |
0 ms |
344 KB |
Output is correct |
158 |
Correct |
0 ms |
348 KB |
Output is correct |
159 |
Correct |
0 ms |
348 KB |
Output is correct |
160 |
Correct |
0 ms |
348 KB |
Output is correct |
161 |
Correct |
237 ms |
77532 KB |
Output is correct |
162 |
Correct |
240 ms |
77888 KB |
Output is correct |
163 |
Correct |
241 ms |
77380 KB |
Output is correct |
164 |
Correct |
265 ms |
77628 KB |
Output is correct |
165 |
Correct |
263 ms |
78144 KB |
Output is correct |
166 |
Correct |
227 ms |
77376 KB |
Output is correct |
167 |
Runtime error |
52 ms |
33632 KB |
Execution killed with signal 6 |
168 |
Halted |
0 ms |
0 KB |
- |