#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
const int mxN = 2e5 + 1;
const int dx[mxN] = {0, 1, 0, -1}, dy[mxN] = {1, 0, -1, 0};
bool vis[mxN];
pair<pii, int> pts[mxN];
pii opts[mxN];
map<pii, int> allpts;
int n;
vector<pii> edges;
map<pair<pii, pii>, int> alledges;
vector<pii> imp;
bool CheckConnected() {
queue<pii> q;
set<pii> track;
q.push(pts[0].ff);
track.insert(pts[0].ff);
while (!q.empty()) {
pii cur = q.front();
q.pop();
for (int k = 0; k < 4; k++) {
int nx = cur.ff + dx[k] * 2;
int ny = cur.ss + dy[k] * 2;
if (allpts.find({nx, ny}) != allpts.end() && track.find({nx, ny}) == track.end()) {
q.push({nx, ny});
track.insert({nx, ny});
edges.pb({allpts[cur], allpts[{nx, ny}]});
}
}
}
return (int(track.size()) == n);
}
void st123() {
int arr[3][mxN + 10];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < mxN + 10; j++) {
arr[i][j] = -1;
}
}
for (int i = 0; i < n; i++) {
arr[(pts[i].ff.ff >> 1) - 1][pts[i].ff.ss] = pts[i].ss;
}
bool con01 = false, con12 = false;
bool notfix = false;
vector<int> u, v, a, b;
for (int i = 0; i < mxN + 6; i += 2) {
// if (i <= 10) cout << arr[0][i] << ' ' << arr[1][i] << ' ' << arr[2][i] << endl;
if (arr[0][i] >= 0 && arr[0][i + 2] >= 0) {
u.pb(arr[0][i]); v.pb(arr[0][i + 2]);
a.pb(1); b.pb(i + 1);
}
if (arr[2][i] >= 0 && arr[2][i + 2] >= 0) {
u.pb(arr[2][i]); v.pb(arr[2][i + 2]);
a.pb(7); b.pb(i + 1);
}
bool special = false;
if (notfix) {
u.pb(arr[0][i]); v.pb(arr[1][i]);
a.pb(3); b.pb(i + 1);
special = true;
notfix = false;
}
bool usemid = false;
if (!(arr[1][i + 2] >= 0 && arr[2][i + 2] >= 0 && !con12)) special = true;
if (arr[1][i] >= 0 && arr[1][i + 2] >= 0) {
u.pb(arr[1][i]); v.pb(arr[1][i + 2]);
a.pb((special ? 5 : 3)); b.pb(i + 1);
usemid = !special;
}
if (arr[0][i + 2] >= 0 && arr[1][i + 2] >= 0 && !con01) {
if (!usemid) {
u.pb(arr[0][i + 2]); v.pb(arr[1][i + 2]);
a.pb(3); b.pb(i + 1);
} else notfix = true;
con01 = true;
} else con01 = false;
if (arr[1][i + 2] >= 0 && arr[2][i + 2] >= 0 && !con12) {
u.pb(arr[1][i + 2]); v.pb(arr[2][i + 2]);
a.pb(5); b.pb(i + 1);
con12 = true;
} else con12 = false;
}
build(u, v, a, b);
return;
}
void st45() {
set<pair<pii, pii> > edgeset;
for (pii &cur : edges) {
pair<pii, pii> edge = {opts[cur.ff], opts[cur.ss]};
if (edge.ff.ff > edge.ss.ff) {
swap(edge.ff, edge.ss);
swap(cur.ff, cur.ss);
} else if (edge.ff.ff == edge.ss.ff && edge.ff.ss > edge.ss.ss) {
swap(edge.ff, edge.ss);
swap(cur.ff, cur.ss);
}
edgeset.insert(edge);
}
vector<int> ordering[4];
for (int i = 0; i < int(edges.size()); i++) {
pii fir = opts[edges[i].ff], sec = opts[edges[i].ss];
alledges[{fir, sec}] = i;
pii important;
bool left, right, middle;
if (fir.ff == sec.ff) {
// -2
left = (edgeset.find({{fir.ff - 2, fir.ss}, fir}) != edgeset.end());
right = (edgeset.find({{sec.ff - 2, sec.ss}, sec}) != edgeset.end());
middle = (edgeset.find({{fir.ff - 2, fir.ss}, {sec.ff - 2, sec.ss}}) != edgeset.end());
if (left && right) important.ff = 3;
else if (middle) important.ff = 2;
else if (left || right) important.ff = 1;
else important.ff = 0;
// +2
left = (edgeset.find({fir, {fir.ff + 2, fir.ss}}) != edgeset.end());
right = (edgeset.find({sec, {sec.ff + 2, sec.ss}}) != edgeset.end());
middle = (edgeset.find({{fir.ff + 2, fir.ss}, {sec.ff + 2, sec.ss}}) != edgeset.end());
if (left && right) important.ss = 3;
else if (middle) important.ss = 2;
else if (left || right) important.ss = 1;
else important.ss = 0;
} else if (fir.ss == sec.ss) {
// -2
left = (edgeset.find({{fir.ff, fir.ss - 2}, fir}) != edgeset.end());
right = (edgeset.find({{sec.ff, sec.ss - 2}, sec}) != edgeset.end());
middle = (edgeset.find({{fir.ff, fir.ss - 2}, {sec.ff, sec.ss - 2}}) != edgeset.end());
if (left && right) important.ff = 3;
else if (middle) important.ff = 2;
else if (left || right) important.ff = 1;
else important.ff = 0;
// +2
left = (edgeset.find({fir, {fir.ff, fir.ss + 2}}) != edgeset.end());
right = (edgeset.find({sec, {sec.ff, sec.ss + 2}}) != edgeset.end());
middle = (edgeset.find({{fir.ff, fir.ss + 2}, {sec.ff, sec.ss + 2}}) != edgeset.end());
if (left && right) important.ss = 3;
else if (middle) important.ss = 2;
else if (left || right) important.ss = 1;
else important.ss = 0;
}
imp.pb(important);
ordering[max(important.ff, important.ss)].pb(i);
}
int m = edges.size();
vector<pii> coor(m);
set<pii> appear;
for (int urgency = 3; urgency >= 0; urgency--) {
for (int &starting : ordering[urgency]) {
if (vis[starting]) continue;
queue<int> q;
q.push(starting);
vis[starting] = true;
while (!q.empty()) {
int cur = q.front();
q.pop();
pii fir = opts[edges[cur].ff], sec = opts[edges[cur].ss];
if (imp[cur].ff >= imp[cur].ss && appear.find({fir.ff + 1, fir.ss + 1}) == appear.end()) {
// add
coor[cur] = {fir.ff + 1, fir.ss + 1};
if (alledges.find({fir, {fir.ff + 2, fir.ss}}) != alledges.end()) {
int ptr = alledges[{fir, {fir.ff + 2, fir.ss}}];
if (!vis[ptr]) {
q.push(ptr);
vis[ptr] = true;
}
}
if (alledges.find({fir, {fir.ff, fir.ss + 2}}) != alledges.end()) {
int ptr = alledges[{fir, {fir.ff, fir.ss + 2}}];
if (!vis[ptr]) {
q.push(ptr);
vis[ptr] = true;
}
}
if (alledges.find({{fir.ff + 2, fir.ss}, {fir.ff + 2, fir.ss + 2}}) != alledges.end()) {
int ptr = alledges[{{fir.ff + 2, fir.ss}, {fir.ff + 2, fir.ss + 2}}];
if (!vis[ptr]) {
q.push(ptr);
vis[ptr] = true;
}
}
if (alledges.find({{fir.ff, fir.ss + 2}, {fir.ff + 2, fir.ss + 2}}) != alledges.end()) {
int ptr = alledges[{{fir.ff, fir.ss + 2}, {fir.ff + 2, fir.ss + 2}}];
if (!vis[ptr]) {
q.push(ptr);
vis[ptr] = true;
}
}
} else if (appear.find({sec.ff - 1, sec.ss - 1}) == appear.end()) {
// minus
coor[cur] = {sec.ff - 1, sec.ss - 1};
if (alledges.find({{sec.ff - 2, sec.ss}, sec}) != alledges.end()) {
int ptr = alledges[{{sec.ff - 2, sec.ss}, sec}];
if (!vis[ptr]) {
q.push(ptr);
vis[ptr] = true;
}
}
if (alledges.find({{sec.ff, sec.ss - 2}, sec}) != alledges.end()) {
int ptr = alledges[{{sec.ff, sec.ss - 2}, sec}];
if (!vis[ptr]) {
q.push(ptr);
vis[ptr] = true;
}
}
if (alledges.find({{sec.ff - 2, sec.ss - 2}, {sec.ff - 2, sec.ss}}) != alledges.end()) {
int ptr = alledges[{{sec.ff - 2, sec.ss - 2}, {sec.ff - 2, sec.ss}}];
if (!vis[ptr]) {
q.push(ptr);
vis[ptr] = true;
}
}
if (alledges.find({{sec.ff - 2, sec.ss - 2}, {sec.ff, sec.ss - 2}}) != alledges.end()) {
int ptr = alledges[{{sec.ff - 2, sec.ss - 2}, {sec.ff, sec.ss - 2}}];
if (!vis[ptr]) {
q.push(ptr);
vis[ptr] = true;
}
}
} else throw runtime_error("fucked up");
appear.insert(coor[cur]);
// cout << edges[cur].ff << ' ' << edges[cur].ss << ' ' << coor[cur].ff << ' ' << coor[cur].ss << endl;
}
}
}
vector<int> u(m), v(m), a(m), b(m);
for (int i = 0; i < m; i++) {
u[i] = edges[i].ff;
v[i] = edges[i].ss;
a[i] = coor[i].ff;
b[i] = coor[i].ss;
}
build(u, v, a, b);
return;
}
int construct_roads(vector<int> ox, vector<int> oy) {
n = ox.size();
int maxx = 0;
for (int i = 0; i < n; i++) {
pts[i] = {{ox[i], oy[i]}, i};
opts[i] = pts[i].ff;
allpts[pts[i].ff] = i;
maxx = max(maxx, pts[i].ff.ff);
}
// for (int i = 0; i < n; i++) {
// cout << pts[i].ff.ff << ' ' << pts[i].ff.ss << ' ' << pts[i].ss << endl;
// }
if (!CheckConnected()) return 0;
if (maxx <= 6) st123();
else st45();
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
3 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2644 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
316 KB |
Output is correct |
9 |
Correct |
182 ms |
20360 KB |
Output is correct |
10 |
Correct |
16 ms |
4620 KB |
Output is correct |
11 |
Correct |
92 ms |
11996 KB |
Output is correct |
12 |
Correct |
21 ms |
5452 KB |
Output is correct |
13 |
Correct |
43 ms |
6344 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
468 KB |
Output is correct |
16 |
Correct |
184 ms |
20860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
3 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2644 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
316 KB |
Output is correct |
9 |
Correct |
182 ms |
20360 KB |
Output is correct |
10 |
Correct |
16 ms |
4620 KB |
Output is correct |
11 |
Correct |
92 ms |
11996 KB |
Output is correct |
12 |
Correct |
21 ms |
5452 KB |
Output is correct |
13 |
Correct |
43 ms |
6344 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
468 KB |
Output is correct |
16 |
Correct |
184 ms |
20860 KB |
Output is correct |
17 |
Correct |
5 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
2 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
2 ms |
2644 KB |
Output is correct |
23 |
Correct |
511 ms |
41124 KB |
Output is correct |
24 |
Correct |
2 ms |
2644 KB |
Output is correct |
25 |
Correct |
4 ms |
2900 KB |
Output is correct |
26 |
Correct |
3 ms |
724 KB |
Output is correct |
27 |
Correct |
3 ms |
716 KB |
Output is correct |
28 |
Correct |
201 ms |
18272 KB |
Output is correct |
29 |
Correct |
265 ms |
25672 KB |
Output is correct |
30 |
Correct |
375 ms |
34920 KB |
Output is correct |
31 |
Correct |
506 ms |
41988 KB |
Output is correct |
32 |
Correct |
2 ms |
2644 KB |
Output is correct |
33 |
Correct |
2 ms |
2644 KB |
Output is correct |
34 |
Correct |
2 ms |
2624 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
1 ms |
212 KB |
Output is correct |
37 |
Correct |
3 ms |
2620 KB |
Output is correct |
38 |
Correct |
3 ms |
2644 KB |
Output is correct |
39 |
Correct |
2 ms |
2644 KB |
Output is correct |
40 |
Correct |
2 ms |
2644 KB |
Output is correct |
41 |
Correct |
1 ms |
212 KB |
Output is correct |
42 |
Correct |
2 ms |
2644 KB |
Output is correct |
43 |
Correct |
2 ms |
468 KB |
Output is correct |
44 |
Correct |
3 ms |
580 KB |
Output is correct |
45 |
Correct |
193 ms |
20832 KB |
Output is correct |
46 |
Correct |
311 ms |
30240 KB |
Output is correct |
47 |
Correct |
442 ms |
30184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
3 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2644 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
316 KB |
Output is correct |
9 |
Correct |
182 ms |
20360 KB |
Output is correct |
10 |
Correct |
16 ms |
4620 KB |
Output is correct |
11 |
Correct |
92 ms |
11996 KB |
Output is correct |
12 |
Correct |
21 ms |
5452 KB |
Output is correct |
13 |
Correct |
43 ms |
6344 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
468 KB |
Output is correct |
16 |
Correct |
184 ms |
20860 KB |
Output is correct |
17 |
Correct |
5 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
2 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
2 ms |
2644 KB |
Output is correct |
23 |
Correct |
511 ms |
41124 KB |
Output is correct |
24 |
Correct |
2 ms |
2644 KB |
Output is correct |
25 |
Correct |
4 ms |
2900 KB |
Output is correct |
26 |
Correct |
3 ms |
724 KB |
Output is correct |
27 |
Correct |
3 ms |
716 KB |
Output is correct |
28 |
Correct |
201 ms |
18272 KB |
Output is correct |
29 |
Correct |
265 ms |
25672 KB |
Output is correct |
30 |
Correct |
375 ms |
34920 KB |
Output is correct |
31 |
Correct |
506 ms |
41988 KB |
Output is correct |
32 |
Correct |
2 ms |
2644 KB |
Output is correct |
33 |
Correct |
2 ms |
2644 KB |
Output is correct |
34 |
Correct |
2 ms |
2624 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
1 ms |
212 KB |
Output is correct |
37 |
Correct |
3 ms |
2620 KB |
Output is correct |
38 |
Correct |
3 ms |
2644 KB |
Output is correct |
39 |
Correct |
2 ms |
2644 KB |
Output is correct |
40 |
Correct |
2 ms |
2644 KB |
Output is correct |
41 |
Correct |
1 ms |
212 KB |
Output is correct |
42 |
Correct |
2 ms |
2644 KB |
Output is correct |
43 |
Correct |
2 ms |
468 KB |
Output is correct |
44 |
Correct |
3 ms |
580 KB |
Output is correct |
45 |
Correct |
193 ms |
20832 KB |
Output is correct |
46 |
Correct |
311 ms |
30240 KB |
Output is correct |
47 |
Correct |
442 ms |
30184 KB |
Output is correct |
48 |
Correct |
4 ms |
2644 KB |
Output is correct |
49 |
Correct |
2 ms |
2644 KB |
Output is correct |
50 |
Correct |
2 ms |
2644 KB |
Output is correct |
51 |
Correct |
2 ms |
2644 KB |
Output is correct |
52 |
Correct |
3 ms |
2620 KB |
Output is correct |
53 |
Correct |
3 ms |
2644 KB |
Output is correct |
54 |
Correct |
2 ms |
2644 KB |
Output is correct |
55 |
Correct |
701 ms |
41576 KB |
Output is correct |
56 |
Correct |
2 ms |
2644 KB |
Output is correct |
57 |
Correct |
7 ms |
3056 KB |
Output is correct |
58 |
Correct |
12 ms |
3848 KB |
Output is correct |
59 |
Correct |
6 ms |
1492 KB |
Output is correct |
60 |
Correct |
224 ms |
22108 KB |
Output is correct |
61 |
Correct |
329 ms |
30296 KB |
Output is correct |
62 |
Correct |
425 ms |
36720 KB |
Output is correct |
63 |
Correct |
552 ms |
41804 KB |
Output is correct |
64 |
Correct |
1 ms |
212 KB |
Output is correct |
65 |
Correct |
2 ms |
2644 KB |
Output is correct |
66 |
Correct |
1 ms |
316 KB |
Output is correct |
67 |
Correct |
508 ms |
38456 KB |
Output is correct |
68 |
Correct |
449 ms |
38440 KB |
Output is correct |
69 |
Correct |
446 ms |
39108 KB |
Output is correct |
70 |
Correct |
4 ms |
852 KB |
Output is correct |
71 |
Correct |
5 ms |
1236 KB |
Output is correct |
72 |
Correct |
220 ms |
20524 KB |
Output is correct |
73 |
Correct |
388 ms |
30720 KB |
Output is correct |
74 |
Correct |
508 ms |
38404 KB |
Output is correct |
75 |
Correct |
542 ms |
40696 KB |
Output is correct |
76 |
Correct |
440 ms |
39292 KB |
Output is correct |
77 |
Correct |
6 ms |
968 KB |
Output is correct |
78 |
Correct |
17 ms |
1364 KB |
Output is correct |
79 |
Correct |
243 ms |
21664 KB |
Output is correct |
80 |
Correct |
323 ms |
31976 KB |
Output is correct |
81 |
Correct |
492 ms |
40028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
3 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2644 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
316 KB |
Output is correct |
9 |
Correct |
182 ms |
20360 KB |
Output is correct |
10 |
Correct |
16 ms |
4620 KB |
Output is correct |
11 |
Correct |
92 ms |
11996 KB |
Output is correct |
12 |
Correct |
21 ms |
5452 KB |
Output is correct |
13 |
Correct |
43 ms |
6344 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
468 KB |
Output is correct |
16 |
Correct |
184 ms |
20860 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
320 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
949 ms |
71924 KB |
Output is correct |
21 |
Correct |
953 ms |
71424 KB |
Output is correct |
22 |
Correct |
1052 ms |
71532 KB |
Output is correct |
23 |
Correct |
732 ms |
60616 KB |
Output is correct |
24 |
Correct |
149 ms |
20240 KB |
Output is correct |
25 |
Correct |
176 ms |
20192 KB |
Output is correct |
26 |
Correct |
180 ms |
20268 KB |
Output is correct |
27 |
Correct |
1246 ms |
70848 KB |
Output is correct |
28 |
Correct |
1146 ms |
70828 KB |
Output is correct |
29 |
Correct |
1238 ms |
70808 KB |
Output is correct |
30 |
Correct |
1290 ms |
70868 KB |
Output is correct |
31 |
Correct |
1 ms |
212 KB |
Output is correct |
32 |
Correct |
50 ms |
5588 KB |
Output is correct |
33 |
Correct |
59 ms |
10392 KB |
Output is correct |
34 |
Correct |
825 ms |
72068 KB |
Output is correct |
35 |
Correct |
10 ms |
1620 KB |
Output is correct |
36 |
Correct |
37 ms |
6096 KB |
Output is correct |
37 |
Correct |
65 ms |
11016 KB |
Output is correct |
38 |
Correct |
447 ms |
29136 KB |
Output is correct |
39 |
Correct |
643 ms |
39664 KB |
Output is correct |
40 |
Correct |
850 ms |
50476 KB |
Output is correct |
41 |
Correct |
1081 ms |
61076 KB |
Output is correct |
42 |
Correct |
1308 ms |
71884 KB |
Output is correct |
43 |
Correct |
2 ms |
2644 KB |
Output is correct |
44 |
Correct |
2 ms |
2644 KB |
Output is correct |
45 |
Correct |
2 ms |
2644 KB |
Output is correct |
46 |
Correct |
1 ms |
212 KB |
Output is correct |
47 |
Correct |
0 ms |
212 KB |
Output is correct |
48 |
Correct |
2 ms |
2644 KB |
Output is correct |
49 |
Correct |
2 ms |
2644 KB |
Output is correct |
50 |
Correct |
2 ms |
2644 KB |
Output is correct |
51 |
Correct |
2 ms |
2644 KB |
Output is correct |
52 |
Correct |
0 ms |
212 KB |
Output is correct |
53 |
Correct |
2 ms |
2616 KB |
Output is correct |
54 |
Correct |
2 ms |
580 KB |
Output is correct |
55 |
Correct |
2 ms |
596 KB |
Output is correct |
56 |
Correct |
176 ms |
20928 KB |
Output is correct |
57 |
Correct |
274 ms |
30356 KB |
Output is correct |
58 |
Correct |
282 ms |
30408 KB |
Output is correct |
59 |
Correct |
0 ms |
212 KB |
Output is correct |
60 |
Correct |
2 ms |
2644 KB |
Output is correct |
61 |
Correct |
1 ms |
212 KB |
Output is correct |
62 |
Correct |
384 ms |
38564 KB |
Output is correct |
63 |
Correct |
400 ms |
38560 KB |
Output is correct |
64 |
Correct |
387 ms |
39220 KB |
Output is correct |
65 |
Correct |
4 ms |
852 KB |
Output is correct |
66 |
Correct |
5 ms |
1236 KB |
Output is correct |
67 |
Correct |
186 ms |
20664 KB |
Output is correct |
68 |
Correct |
306 ms |
30768 KB |
Output is correct |
69 |
Correct |
476 ms |
38632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
3 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2644 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
316 KB |
Output is correct |
9 |
Correct |
182 ms |
20360 KB |
Output is correct |
10 |
Correct |
16 ms |
4620 KB |
Output is correct |
11 |
Correct |
92 ms |
11996 KB |
Output is correct |
12 |
Correct |
21 ms |
5452 KB |
Output is correct |
13 |
Correct |
43 ms |
6344 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
468 KB |
Output is correct |
16 |
Correct |
184 ms |
20860 KB |
Output is correct |
17 |
Correct |
876 ms |
71276 KB |
Output is correct |
18 |
Correct |
897 ms |
71564 KB |
Output is correct |
19 |
Correct |
891 ms |
71400 KB |
Output is correct |
20 |
Correct |
1143 ms |
69060 KB |
Output is correct |
21 |
Correct |
1124 ms |
61836 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
122 ms |
11480 KB |
Output is correct |
24 |
Correct |
19 ms |
2924 KB |
Output is correct |
25 |
Correct |
51 ms |
7812 KB |
Output is correct |
26 |
Correct |
84 ms |
12860 KB |
Output is correct |
27 |
Correct |
545 ms |
35904 KB |
Output is correct |
28 |
Correct |
730 ms |
44908 KB |
Output is correct |
29 |
Correct |
910 ms |
53964 KB |
Output is correct |
30 |
Correct |
1079 ms |
62528 KB |
Output is correct |
31 |
Correct |
1244 ms |
71688 KB |
Output is correct |
32 |
Correct |
491 ms |
40500 KB |
Output is correct |
33 |
Correct |
439 ms |
39104 KB |
Output is correct |
34 |
Correct |
4 ms |
980 KB |
Output is correct |
35 |
Correct |
10 ms |
1416 KB |
Output is correct |
36 |
Correct |
199 ms |
21548 KB |
Output is correct |
37 |
Correct |
314 ms |
31900 KB |
Output is correct |
38 |
Correct |
469 ms |
39844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
3 ms |
2644 KB |
Output is correct |
5 |
Correct |
3 ms |
2644 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
316 KB |
Output is correct |
9 |
Correct |
182 ms |
20360 KB |
Output is correct |
10 |
Correct |
16 ms |
4620 KB |
Output is correct |
11 |
Correct |
92 ms |
11996 KB |
Output is correct |
12 |
Correct |
21 ms |
5452 KB |
Output is correct |
13 |
Correct |
43 ms |
6344 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
3 ms |
468 KB |
Output is correct |
16 |
Correct |
184 ms |
20860 KB |
Output is correct |
17 |
Correct |
5 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
2 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
2 ms |
2644 KB |
Output is correct |
23 |
Correct |
511 ms |
41124 KB |
Output is correct |
24 |
Correct |
2 ms |
2644 KB |
Output is correct |
25 |
Correct |
4 ms |
2900 KB |
Output is correct |
26 |
Correct |
3 ms |
724 KB |
Output is correct |
27 |
Correct |
3 ms |
716 KB |
Output is correct |
28 |
Correct |
201 ms |
18272 KB |
Output is correct |
29 |
Correct |
265 ms |
25672 KB |
Output is correct |
30 |
Correct |
375 ms |
34920 KB |
Output is correct |
31 |
Correct |
506 ms |
41988 KB |
Output is correct |
32 |
Correct |
2 ms |
2644 KB |
Output is correct |
33 |
Correct |
2 ms |
2644 KB |
Output is correct |
34 |
Correct |
2 ms |
2624 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
1 ms |
212 KB |
Output is correct |
37 |
Correct |
3 ms |
2620 KB |
Output is correct |
38 |
Correct |
3 ms |
2644 KB |
Output is correct |
39 |
Correct |
2 ms |
2644 KB |
Output is correct |
40 |
Correct |
2 ms |
2644 KB |
Output is correct |
41 |
Correct |
1 ms |
212 KB |
Output is correct |
42 |
Correct |
2 ms |
2644 KB |
Output is correct |
43 |
Correct |
2 ms |
468 KB |
Output is correct |
44 |
Correct |
3 ms |
580 KB |
Output is correct |
45 |
Correct |
193 ms |
20832 KB |
Output is correct |
46 |
Correct |
311 ms |
30240 KB |
Output is correct |
47 |
Correct |
442 ms |
30184 KB |
Output is correct |
48 |
Correct |
4 ms |
2644 KB |
Output is correct |
49 |
Correct |
2 ms |
2644 KB |
Output is correct |
50 |
Correct |
2 ms |
2644 KB |
Output is correct |
51 |
Correct |
2 ms |
2644 KB |
Output is correct |
52 |
Correct |
3 ms |
2620 KB |
Output is correct |
53 |
Correct |
3 ms |
2644 KB |
Output is correct |
54 |
Correct |
2 ms |
2644 KB |
Output is correct |
55 |
Correct |
701 ms |
41576 KB |
Output is correct |
56 |
Correct |
2 ms |
2644 KB |
Output is correct |
57 |
Correct |
7 ms |
3056 KB |
Output is correct |
58 |
Correct |
12 ms |
3848 KB |
Output is correct |
59 |
Correct |
6 ms |
1492 KB |
Output is correct |
60 |
Correct |
224 ms |
22108 KB |
Output is correct |
61 |
Correct |
329 ms |
30296 KB |
Output is correct |
62 |
Correct |
425 ms |
36720 KB |
Output is correct |
63 |
Correct |
552 ms |
41804 KB |
Output is correct |
64 |
Correct |
1 ms |
212 KB |
Output is correct |
65 |
Correct |
2 ms |
2644 KB |
Output is correct |
66 |
Correct |
1 ms |
316 KB |
Output is correct |
67 |
Correct |
508 ms |
38456 KB |
Output is correct |
68 |
Correct |
449 ms |
38440 KB |
Output is correct |
69 |
Correct |
446 ms |
39108 KB |
Output is correct |
70 |
Correct |
4 ms |
852 KB |
Output is correct |
71 |
Correct |
5 ms |
1236 KB |
Output is correct |
72 |
Correct |
220 ms |
20524 KB |
Output is correct |
73 |
Correct |
388 ms |
30720 KB |
Output is correct |
74 |
Correct |
508 ms |
38404 KB |
Output is correct |
75 |
Correct |
542 ms |
40696 KB |
Output is correct |
76 |
Correct |
440 ms |
39292 KB |
Output is correct |
77 |
Correct |
6 ms |
968 KB |
Output is correct |
78 |
Correct |
17 ms |
1364 KB |
Output is correct |
79 |
Correct |
243 ms |
21664 KB |
Output is correct |
80 |
Correct |
323 ms |
31976 KB |
Output is correct |
81 |
Correct |
492 ms |
40028 KB |
Output is correct |
82 |
Correct |
1 ms |
212 KB |
Output is correct |
83 |
Correct |
1 ms |
320 KB |
Output is correct |
84 |
Correct |
1 ms |
212 KB |
Output is correct |
85 |
Correct |
949 ms |
71924 KB |
Output is correct |
86 |
Correct |
953 ms |
71424 KB |
Output is correct |
87 |
Correct |
1052 ms |
71532 KB |
Output is correct |
88 |
Correct |
732 ms |
60616 KB |
Output is correct |
89 |
Correct |
149 ms |
20240 KB |
Output is correct |
90 |
Correct |
176 ms |
20192 KB |
Output is correct |
91 |
Correct |
180 ms |
20268 KB |
Output is correct |
92 |
Correct |
1246 ms |
70848 KB |
Output is correct |
93 |
Correct |
1146 ms |
70828 KB |
Output is correct |
94 |
Correct |
1238 ms |
70808 KB |
Output is correct |
95 |
Correct |
1290 ms |
70868 KB |
Output is correct |
96 |
Correct |
1 ms |
212 KB |
Output is correct |
97 |
Correct |
50 ms |
5588 KB |
Output is correct |
98 |
Correct |
59 ms |
10392 KB |
Output is correct |
99 |
Correct |
825 ms |
72068 KB |
Output is correct |
100 |
Correct |
10 ms |
1620 KB |
Output is correct |
101 |
Correct |
37 ms |
6096 KB |
Output is correct |
102 |
Correct |
65 ms |
11016 KB |
Output is correct |
103 |
Correct |
447 ms |
29136 KB |
Output is correct |
104 |
Correct |
643 ms |
39664 KB |
Output is correct |
105 |
Correct |
850 ms |
50476 KB |
Output is correct |
106 |
Correct |
1081 ms |
61076 KB |
Output is correct |
107 |
Correct |
1308 ms |
71884 KB |
Output is correct |
108 |
Correct |
2 ms |
2644 KB |
Output is correct |
109 |
Correct |
2 ms |
2644 KB |
Output is correct |
110 |
Correct |
2 ms |
2644 KB |
Output is correct |
111 |
Correct |
1 ms |
212 KB |
Output is correct |
112 |
Correct |
0 ms |
212 KB |
Output is correct |
113 |
Correct |
2 ms |
2644 KB |
Output is correct |
114 |
Correct |
2 ms |
2644 KB |
Output is correct |
115 |
Correct |
2 ms |
2644 KB |
Output is correct |
116 |
Correct |
2 ms |
2644 KB |
Output is correct |
117 |
Correct |
0 ms |
212 KB |
Output is correct |
118 |
Correct |
2 ms |
2616 KB |
Output is correct |
119 |
Correct |
2 ms |
580 KB |
Output is correct |
120 |
Correct |
2 ms |
596 KB |
Output is correct |
121 |
Correct |
176 ms |
20928 KB |
Output is correct |
122 |
Correct |
274 ms |
30356 KB |
Output is correct |
123 |
Correct |
282 ms |
30408 KB |
Output is correct |
124 |
Correct |
0 ms |
212 KB |
Output is correct |
125 |
Correct |
2 ms |
2644 KB |
Output is correct |
126 |
Correct |
1 ms |
212 KB |
Output is correct |
127 |
Correct |
384 ms |
38564 KB |
Output is correct |
128 |
Correct |
400 ms |
38560 KB |
Output is correct |
129 |
Correct |
387 ms |
39220 KB |
Output is correct |
130 |
Correct |
4 ms |
852 KB |
Output is correct |
131 |
Correct |
5 ms |
1236 KB |
Output is correct |
132 |
Correct |
186 ms |
20664 KB |
Output is correct |
133 |
Correct |
306 ms |
30768 KB |
Output is correct |
134 |
Correct |
476 ms |
38632 KB |
Output is correct |
135 |
Correct |
876 ms |
71276 KB |
Output is correct |
136 |
Correct |
897 ms |
71564 KB |
Output is correct |
137 |
Correct |
891 ms |
71400 KB |
Output is correct |
138 |
Correct |
1143 ms |
69060 KB |
Output is correct |
139 |
Correct |
1124 ms |
61836 KB |
Output is correct |
140 |
Correct |
0 ms |
212 KB |
Output is correct |
141 |
Correct |
122 ms |
11480 KB |
Output is correct |
142 |
Correct |
19 ms |
2924 KB |
Output is correct |
143 |
Correct |
51 ms |
7812 KB |
Output is correct |
144 |
Correct |
84 ms |
12860 KB |
Output is correct |
145 |
Correct |
545 ms |
35904 KB |
Output is correct |
146 |
Correct |
730 ms |
44908 KB |
Output is correct |
147 |
Correct |
910 ms |
53964 KB |
Output is correct |
148 |
Correct |
1079 ms |
62528 KB |
Output is correct |
149 |
Correct |
1244 ms |
71688 KB |
Output is correct |
150 |
Correct |
491 ms |
40500 KB |
Output is correct |
151 |
Correct |
439 ms |
39104 KB |
Output is correct |
152 |
Correct |
4 ms |
980 KB |
Output is correct |
153 |
Correct |
10 ms |
1416 KB |
Output is correct |
154 |
Correct |
199 ms |
21548 KB |
Output is correct |
155 |
Correct |
314 ms |
31900 KB |
Output is correct |
156 |
Correct |
469 ms |
39844 KB |
Output is correct |
157 |
Correct |
2 ms |
2644 KB |
Output is correct |
158 |
Correct |
1 ms |
212 KB |
Output is correct |
159 |
Correct |
1 ms |
212 KB |
Output is correct |
160 |
Correct |
0 ms |
212 KB |
Output is correct |
161 |
Runtime error |
889 ms |
104168 KB |
Execution killed with signal 6 |
162 |
Halted |
0 ms |
0 KB |
- |