#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
#define lli long long
#define rep(i, a, b) for(lli i = (a); i <= (b); ++i)
#define repa(i, a, b) for(lli i = (a); i >= (b); --i)
#define nl "\n"
#define debugsl(x) cout << #x << " = " << x << ", "
#define debug(x) debugsl(x) << nl
#define debugarr(x, a, b) cout << #x << " = ["; rep(ii, a, b) cout << x[ii] << ", "; cout << "]" << nl
#define MAX_N 200002
int dx[6] = {0, -2, 0, 2, 2, -2}; // 0-NORTE, 1-OESTE, 2-SUR, 3-ESTE, 4-NORESTE, 5-SUROESTE
int dy[6] = {2, 0, -2, 0, 2, -2};
#define norte 0
#define oeste 1
#define sur 2
#define este 3
#define noreste 4
#define suroeste 5
map<pair<int, int>, int> fuentes;
int visitada[MAX_N];
int grupo[MAX_N], gfinal;
std::vector<int> u, v, a, b;
int comp(int a){
if (grupo[a] == a) return a;
else return grupo[a] = comp(grupo[a]);
}
bool une(int a, int b){
int ga = comp(a);
int gb = comp(b);
if (ga == gb) return false;
grupo[ga] = gb;
return true;
}
void dfs(int nodo, int padre, vector<int> &x, vector<int> &y){
bool hayfuente[6], diagimpar, camino[6];
int fuente[6];
visitada[nodo] = 1;
// VALIDA EN QUE DIRECCIONES TIENE FUENTE
rep(i, norte, suroeste) camino[i] = false, hayfuente[i] = fuentes.find({x[nodo] + dx[i], y[nodo] + dy[i]}) != fuentes.end();
// OBTEN LA FUENTE EN CADA DIRECCION
rep(i, norte, suroeste)
if (hayfuente[i]) fuente[i] = fuentes[{x[nodo] + dx[i], y[nodo] + dy[i]}];
else fuente[i] = -1;
// VALIDA EN QUE DIAGONAL ESTAS
diagimpar = (x[nodo] + y[nodo]) & 3;
// LOS CASOS QUE HAY QUE REVISAR ES CUANDO LA FUENTE QUE ESTAMOS PROCESANDO PERTENECE A UN CUADRADO DE 2x2,
// EN ESOS CASOS SE DEBE EVITAR COLOCAR LOS CAMINOS QUE COLISIONAN.
// EN PARTICULAR SE EVITARA COLOCAR LOS CAMINOS NORTE O ESTE QUE COLISIONARIAN CON UN CAMINO SUR U OESTE DE UN MISMO CUADRADO
if (hayfuente[norte] && hayfuente[este] && hayfuente[noreste]){ // EL NODO ES LA ESQUINA SUROESTE DE UN CUADRADO DE 2x2
// DEPENDIENDO DE LA DIAGONAL COLOCA UNICAMENTE EL CAMINO NORTE O EL ESTE
if (diagimpar){ // UNE SOLO AL NORTE
if (une(nodo, fuente[norte])){
u.push_back(nodo);
v.push_back(fuente[norte]);
a.push_back(x[nodo] - 1); // BANCA AL OESTE
b.push_back((y[nodo] + y[fuente[norte]]) / 2);
camino[norte] = true;
}
}
else{ // UNE SOLO AL ESTE
if (une(nodo, fuente[este])){
u.push_back(nodo);
v.push_back(fuente[este]);
a.push_back((x[nodo] + x[fuente[este]]) / 2);
b.push_back(y[nodo] - 1); // BANCA AL SUR
camino[este] = true;
}
}
}
else{
// SI NO ES UN CUADRO UNE LIBREMENTE AL NORTE Y AL ESTE
if (hayfuente[norte] && une(nodo, fuente[norte])){
u.push_back(nodo);
v.push_back(fuente[norte]);
b.push_back((y[nodo] + y[fuente[norte]]) / 2);
if (diagimpar) a.push_back(x[nodo] - 1);
else a.push_back(x[nodo] + 1);
camino[norte] = true;
}
if (hayfuente[este] && une(nodo, fuente[este])){
u.push_back(nodo);
v.push_back(fuente[este]);
a.push_back((x[nodo] + x[fuente[este]]) / 2);
if (diagimpar) b.push_back(y[nodo] + 1);
else b.push_back(y[nodo] - 1);
camino[este] = true;
}
}
// DESPUES DE UNIR, CONTINUA LA DFS A LAS FUENTES A LAS QUE CONSTRUISTE CAMINO
rep(i, norte, este) if (hayfuente[i] && camino[i]) dfs(fuente[i], nodo, x, y);
}
int construct_roads(std::vector<int> x, std::vector<int> y) {
if (x.size() == 1) {
build({}, {}, {}, {});
return 1;
}
// AGREGA LAS FUENTES A UN MAP PARA PODER BUSCARLAS FACILMENTE
rep(i, 0, x.size() - 1) fuentes[{x[i], y[i]}] = i;
// AHORA HAZ UNA BUSQUEDA EN PROFUNDIDAD DESDE CUALQUIER FUENTE,
// SE VAN A AGREGAR CAMINOS UNICAMENTE SI SON NECESARIOS PARA QUE EL GRAFO SEA CONEXO (SE VALIDA MEDIANTE UN DSU)
// PARA ACOMODAR LAS BANCAS DE FORMA QUE NO CHOQUEN SE UTILIZAN LAS DIAGONALES, EN ESTE CASO SE USAN LAS DE TIPO (x + y),
// LA IDEA ES QUE TODOS LOS CAMINOS VERTICALES QUE QUEDEN ENTRE UN PAR DE DIAGONALES TENGAN LA BANCA DEL MISMO LADO, LO MISMO CON LOS HORIZONTALES.
// ADEMAS, LOS CAMINOS ENTRE UN PAR DE DIAGONALES Y EL PAR DE DIAGONALES INMEDIATAMENTE SIGUIENTE ALTERNAN SU LADO.
// H
// \---\---\ \ \ LAS LETRAS H CORRESPONDEN A LA BANCA DEL CAMINO HORIZONTAL
// \ |\h |\ \ \ LAS LETRAS V CORRESPONDEN A LA BANCA DEL CAMINO VERTICAL
// \V| \ |V\ \ \ LAS LETRAS h EN EL DIBUJO SON BANCAS QUE COLISIONAN
// \| h\| \ \ \
// \---\---\ \ \
// H
// LAS BANCAS ENTRE UN PAR DE DIAGONALES NUNCA VAN A COLISIONAR.
// LA UNICA FORMA DE COLISIONAR ES DOS CAMINOS HORIZONTALES O VERTICALES ENCONTRADOS EN PARES DE DIAGONALES CONSECUTIVOS.
// PARA QUE ESTO SEA POSIBLE ES FORZOSO QUE HAYA UN CUADRO DE 2x2 CON FUENTES EN LAS 4 ESQUINAS, LO CUAL NO SUCEDE EN LOS SUBTASKS 4 y 5
// POR LO QUE ESTE CODIGO RESUELVE ESOS SUBTASKS
rep(i, 0, x.size() - 1) grupo[i] = i; // INICIALIZA EL DSU
rep(i, 0, x.size() - 1) if (!visitada[i]) dfs(i, -1, x, y);
// VERIFICA SI TODOS QUEDARON UNIDOS EN EL MISMO COMPONENTE
bool ok = true;
gfinal = comp(0);
rep(i, 1, x.size() - 1) if (comp(i) != gfinal){
ok = false;
break;
}
if (!ok) return 0;
build(u, v, a, b);
return 1;
}
Compilation message
parks.cpp:129:5: warning: multi-line comment [-Wcomment]
129 | // \| h\| \ \ \
| ^
parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:7:41: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
7 | #define rep(i, a, b) for(lli i = (a); i <= (b); ++i)
| ^
parks.cpp:118:5: note: in expansion of macro 'rep'
118 | rep(i, 0, x.size() - 1) fuentes[{x[i], y[i]}] = i;
| ^~~
parks.cpp:7:41: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
7 | #define rep(i, a, b) for(lli i = (a); i <= (b); ++i)
| ^
parks.cpp:137:5: note: in expansion of macro 'rep'
137 | rep(i, 0, x.size() - 1) grupo[i] = i; // INICIALIZA EL DSU
| ^~~
parks.cpp:7:41: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
7 | #define rep(i, a, b) for(lli i = (a); i <= (b); ++i)
| ^
parks.cpp:138:5: note: in expansion of macro 'rep'
138 | rep(i, 0, x.size() - 1) if (!visitada[i]) dfs(i, -1, x, y);
| ^~~
parks.cpp:7:41: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
7 | #define rep(i, a, b) for(lli i = (a); i <= (b); ++i)
| ^
parks.cpp:143:5: note: in expansion of macro 'rep'
143 | rep(i, 1, x.size() - 1) if (comp(i) != gfinal){
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
178 ms |
29600 KB |
Output is correct |
10 |
Correct |
17 ms |
3532 KB |
Output is correct |
11 |
Correct |
101 ms |
16836 KB |
Output is correct |
12 |
Correct |
25 ms |
5068 KB |
Output is correct |
13 |
Correct |
61 ms |
10108 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
588 KB |
Output is correct |
16 |
Correct |
172 ms |
22052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
178 ms |
29600 KB |
Output is correct |
10 |
Correct |
17 ms |
3532 KB |
Output is correct |
11 |
Correct |
101 ms |
16836 KB |
Output is correct |
12 |
Correct |
25 ms |
5068 KB |
Output is correct |
13 |
Correct |
61 ms |
10108 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
588 KB |
Output is correct |
16 |
Correct |
172 ms |
22052 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
785 ms |
32824 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
4 ms |
532 KB |
Output is correct |
26 |
Correct |
5 ms |
716 KB |
Output is correct |
27 |
Correct |
7 ms |
716 KB |
Output is correct |
28 |
Correct |
269 ms |
14852 KB |
Output is correct |
29 |
Correct |
408 ms |
24332 KB |
Output is correct |
30 |
Correct |
609 ms |
34332 KB |
Output is correct |
31 |
Correct |
960 ms |
38952 KB |
Output is correct |
32 |
Correct |
1 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
204 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
204 KB |
Output is correct |
38 |
Correct |
1 ms |
204 KB |
Output is correct |
39 |
Correct |
1 ms |
204 KB |
Output is correct |
40 |
Correct |
1 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
204 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
5 ms |
460 KB |
Output is correct |
44 |
Correct |
6 ms |
588 KB |
Output is correct |
45 |
Correct |
270 ms |
13652 KB |
Output is correct |
46 |
Correct |
533 ms |
20044 KB |
Output is correct |
47 |
Correct |
518 ms |
19988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
178 ms |
29600 KB |
Output is correct |
10 |
Correct |
17 ms |
3532 KB |
Output is correct |
11 |
Correct |
101 ms |
16836 KB |
Output is correct |
12 |
Correct |
25 ms |
5068 KB |
Output is correct |
13 |
Correct |
61 ms |
10108 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
588 KB |
Output is correct |
16 |
Correct |
172 ms |
22052 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
785 ms |
32824 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
4 ms |
532 KB |
Output is correct |
26 |
Correct |
5 ms |
716 KB |
Output is correct |
27 |
Correct |
7 ms |
716 KB |
Output is correct |
28 |
Correct |
269 ms |
14852 KB |
Output is correct |
29 |
Correct |
408 ms |
24332 KB |
Output is correct |
30 |
Correct |
609 ms |
34332 KB |
Output is correct |
31 |
Correct |
960 ms |
38952 KB |
Output is correct |
32 |
Correct |
1 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
204 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
204 KB |
Output is correct |
38 |
Correct |
1 ms |
204 KB |
Output is correct |
39 |
Correct |
1 ms |
204 KB |
Output is correct |
40 |
Correct |
1 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
204 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
5 ms |
460 KB |
Output is correct |
44 |
Correct |
6 ms |
588 KB |
Output is correct |
45 |
Correct |
270 ms |
13652 KB |
Output is correct |
46 |
Correct |
533 ms |
20044 KB |
Output is correct |
47 |
Correct |
518 ms |
19988 KB |
Output is correct |
48 |
Correct |
1 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
1 ms |
204 KB |
Output is correct |
51 |
Correct |
1 ms |
204 KB |
Output is correct |
52 |
Correct |
1 ms |
204 KB |
Output is correct |
53 |
Correct |
1 ms |
204 KB |
Output is correct |
54 |
Correct |
1 ms |
204 KB |
Output is correct |
55 |
Correct |
867 ms |
30360 KB |
Output is correct |
56 |
Correct |
1 ms |
204 KB |
Output is correct |
57 |
Correct |
4 ms |
588 KB |
Output is correct |
58 |
Correct |
13 ms |
1356 KB |
Output is correct |
59 |
Correct |
20 ms |
1512 KB |
Output is correct |
60 |
Correct |
367 ms |
19056 KB |
Output is correct |
61 |
Correct |
507 ms |
21944 KB |
Output is correct |
62 |
Correct |
701 ms |
25524 KB |
Output is correct |
63 |
Correct |
947 ms |
34752 KB |
Output is correct |
64 |
Correct |
1 ms |
204 KB |
Output is correct |
65 |
Correct |
1 ms |
204 KB |
Output is correct |
66 |
Correct |
1 ms |
204 KB |
Output is correct |
67 |
Correct |
478 ms |
39072 KB |
Output is correct |
68 |
Correct |
439 ms |
36388 KB |
Output is correct |
69 |
Correct |
488 ms |
38204 KB |
Output is correct |
70 |
Correct |
7 ms |
716 KB |
Output is correct |
71 |
Correct |
14 ms |
1144 KB |
Output is correct |
72 |
Correct |
353 ms |
13696 KB |
Output is correct |
73 |
Correct |
558 ms |
20360 KB |
Output is correct |
74 |
Correct |
828 ms |
27024 KB |
Output is correct |
75 |
Correct |
577 ms |
40780 KB |
Output is correct |
76 |
Correct |
442 ms |
37928 KB |
Output is correct |
77 |
Correct |
8 ms |
844 KB |
Output is correct |
78 |
Correct |
14 ms |
1356 KB |
Output is correct |
79 |
Correct |
274 ms |
13644 KB |
Output is correct |
80 |
Correct |
507 ms |
20360 KB |
Output is correct |
81 |
Correct |
755 ms |
27348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
178 ms |
29600 KB |
Output is correct |
10 |
Correct |
17 ms |
3532 KB |
Output is correct |
11 |
Correct |
101 ms |
16836 KB |
Output is correct |
12 |
Correct |
25 ms |
5068 KB |
Output is correct |
13 |
Correct |
61 ms |
10108 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
588 KB |
Output is correct |
16 |
Correct |
172 ms |
22052 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
905 ms |
27532 KB |
Output is correct |
21 |
Correct |
596 ms |
37304 KB |
Output is correct |
22 |
Correct |
1008 ms |
27232 KB |
Output is correct |
23 |
Correct |
470 ms |
33980 KB |
Output is correct |
24 |
Correct |
672 ms |
17444 KB |
Output is correct |
25 |
Correct |
761 ms |
20848 KB |
Output is correct |
26 |
Correct |
585 ms |
20752 KB |
Output is correct |
27 |
Correct |
527 ms |
27152 KB |
Output is correct |
28 |
Correct |
452 ms |
27084 KB |
Output is correct |
29 |
Correct |
675 ms |
27248 KB |
Output is correct |
30 |
Correct |
801 ms |
27168 KB |
Output is correct |
31 |
Correct |
1 ms |
204 KB |
Output is correct |
32 |
Correct |
44 ms |
2440 KB |
Output is correct |
33 |
Correct |
255 ms |
8812 KB |
Output is correct |
34 |
Correct |
625 ms |
55612 KB |
Output is correct |
35 |
Correct |
20 ms |
1356 KB |
Output is correct |
36 |
Correct |
156 ms |
5572 KB |
Output is correct |
37 |
Correct |
377 ms |
10696 KB |
Output is correct |
38 |
Correct |
385 ms |
11396 KB |
Output is correct |
39 |
Correct |
546 ms |
15172 KB |
Output is correct |
40 |
Correct |
619 ms |
19636 KB |
Output is correct |
41 |
Correct |
805 ms |
23496 KB |
Output is correct |
42 |
Correct |
1094 ms |
27824 KB |
Output is correct |
43 |
Correct |
1 ms |
204 KB |
Output is correct |
44 |
Correct |
1 ms |
204 KB |
Output is correct |
45 |
Correct |
1 ms |
204 KB |
Output is correct |
46 |
Correct |
1 ms |
204 KB |
Output is correct |
47 |
Correct |
1 ms |
204 KB |
Output is correct |
48 |
Correct |
1 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
1 ms |
204 KB |
Output is correct |
51 |
Correct |
1 ms |
204 KB |
Output is correct |
52 |
Correct |
1 ms |
204 KB |
Output is correct |
53 |
Correct |
1 ms |
204 KB |
Output is correct |
54 |
Correct |
4 ms |
460 KB |
Output is correct |
55 |
Correct |
6 ms |
588 KB |
Output is correct |
56 |
Correct |
404 ms |
13684 KB |
Output is correct |
57 |
Correct |
597 ms |
19952 KB |
Output is correct |
58 |
Correct |
562 ms |
19924 KB |
Output is correct |
59 |
Correct |
1 ms |
204 KB |
Output is correct |
60 |
Correct |
1 ms |
204 KB |
Output is correct |
61 |
Correct |
1 ms |
204 KB |
Output is correct |
62 |
Correct |
516 ms |
39080 KB |
Output is correct |
63 |
Correct |
526 ms |
36464 KB |
Output is correct |
64 |
Correct |
486 ms |
38088 KB |
Output is correct |
65 |
Correct |
10 ms |
708 KB |
Output is correct |
66 |
Correct |
13 ms |
1100 KB |
Output is correct |
67 |
Correct |
334 ms |
13700 KB |
Output is correct |
68 |
Correct |
515 ms |
20392 KB |
Output is correct |
69 |
Correct |
779 ms |
27032 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
178 ms |
29600 KB |
Output is correct |
10 |
Correct |
17 ms |
3532 KB |
Output is correct |
11 |
Correct |
101 ms |
16836 KB |
Output is correct |
12 |
Correct |
25 ms |
5068 KB |
Output is correct |
13 |
Correct |
61 ms |
10108 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
588 KB |
Output is correct |
16 |
Correct |
172 ms |
22052 KB |
Output is correct |
17 |
Correct |
458 ms |
37224 KB |
Output is correct |
18 |
Correct |
560 ms |
39856 KB |
Output is correct |
19 |
Correct |
708 ms |
32540 KB |
Output is correct |
20 |
Correct |
601 ms |
26604 KB |
Output is correct |
21 |
Correct |
455 ms |
23920 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
79 ms |
5196 KB |
Output is correct |
24 |
Correct |
37 ms |
2564 KB |
Output is correct |
25 |
Correct |
175 ms |
7684 KB |
Output is correct |
26 |
Correct |
355 ms |
12644 KB |
Output is correct |
27 |
Correct |
295 ms |
14264 KB |
Output is correct |
28 |
Correct |
386 ms |
17444 KB |
Output is correct |
29 |
Correct |
506 ms |
21076 KB |
Output is correct |
30 |
Correct |
662 ms |
23964 KB |
Output is correct |
31 |
Correct |
677 ms |
27668 KB |
Output is correct |
32 |
Correct |
548 ms |
40700 KB |
Output is correct |
33 |
Correct |
553 ms |
38000 KB |
Output is correct |
34 |
Correct |
8 ms |
844 KB |
Output is correct |
35 |
Correct |
18 ms |
1276 KB |
Output is correct |
36 |
Correct |
261 ms |
13732 KB |
Output is correct |
37 |
Correct |
464 ms |
20396 KB |
Output is correct |
38 |
Correct |
687 ms |
27504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
178 ms |
29600 KB |
Output is correct |
10 |
Correct |
17 ms |
3532 KB |
Output is correct |
11 |
Correct |
101 ms |
16836 KB |
Output is correct |
12 |
Correct |
25 ms |
5068 KB |
Output is correct |
13 |
Correct |
61 ms |
10108 KB |
Output is correct |
14 |
Correct |
2 ms |
460 KB |
Output is correct |
15 |
Correct |
2 ms |
588 KB |
Output is correct |
16 |
Correct |
172 ms |
22052 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
23 |
Correct |
785 ms |
32824 KB |
Output is correct |
24 |
Correct |
1 ms |
204 KB |
Output is correct |
25 |
Correct |
4 ms |
532 KB |
Output is correct |
26 |
Correct |
5 ms |
716 KB |
Output is correct |
27 |
Correct |
7 ms |
716 KB |
Output is correct |
28 |
Correct |
269 ms |
14852 KB |
Output is correct |
29 |
Correct |
408 ms |
24332 KB |
Output is correct |
30 |
Correct |
609 ms |
34332 KB |
Output is correct |
31 |
Correct |
960 ms |
38952 KB |
Output is correct |
32 |
Correct |
1 ms |
204 KB |
Output is correct |
33 |
Correct |
1 ms |
204 KB |
Output is correct |
34 |
Correct |
1 ms |
204 KB |
Output is correct |
35 |
Correct |
1 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
204 KB |
Output is correct |
38 |
Correct |
1 ms |
204 KB |
Output is correct |
39 |
Correct |
1 ms |
204 KB |
Output is correct |
40 |
Correct |
1 ms |
204 KB |
Output is correct |
41 |
Correct |
1 ms |
204 KB |
Output is correct |
42 |
Correct |
1 ms |
204 KB |
Output is correct |
43 |
Correct |
5 ms |
460 KB |
Output is correct |
44 |
Correct |
6 ms |
588 KB |
Output is correct |
45 |
Correct |
270 ms |
13652 KB |
Output is correct |
46 |
Correct |
533 ms |
20044 KB |
Output is correct |
47 |
Correct |
518 ms |
19988 KB |
Output is correct |
48 |
Correct |
1 ms |
204 KB |
Output is correct |
49 |
Correct |
1 ms |
204 KB |
Output is correct |
50 |
Correct |
1 ms |
204 KB |
Output is correct |
51 |
Correct |
1 ms |
204 KB |
Output is correct |
52 |
Correct |
1 ms |
204 KB |
Output is correct |
53 |
Correct |
1 ms |
204 KB |
Output is correct |
54 |
Correct |
1 ms |
204 KB |
Output is correct |
55 |
Correct |
867 ms |
30360 KB |
Output is correct |
56 |
Correct |
1 ms |
204 KB |
Output is correct |
57 |
Correct |
4 ms |
588 KB |
Output is correct |
58 |
Correct |
13 ms |
1356 KB |
Output is correct |
59 |
Correct |
20 ms |
1512 KB |
Output is correct |
60 |
Correct |
367 ms |
19056 KB |
Output is correct |
61 |
Correct |
507 ms |
21944 KB |
Output is correct |
62 |
Correct |
701 ms |
25524 KB |
Output is correct |
63 |
Correct |
947 ms |
34752 KB |
Output is correct |
64 |
Correct |
1 ms |
204 KB |
Output is correct |
65 |
Correct |
1 ms |
204 KB |
Output is correct |
66 |
Correct |
1 ms |
204 KB |
Output is correct |
67 |
Correct |
478 ms |
39072 KB |
Output is correct |
68 |
Correct |
439 ms |
36388 KB |
Output is correct |
69 |
Correct |
488 ms |
38204 KB |
Output is correct |
70 |
Correct |
7 ms |
716 KB |
Output is correct |
71 |
Correct |
14 ms |
1144 KB |
Output is correct |
72 |
Correct |
353 ms |
13696 KB |
Output is correct |
73 |
Correct |
558 ms |
20360 KB |
Output is correct |
74 |
Correct |
828 ms |
27024 KB |
Output is correct |
75 |
Correct |
577 ms |
40780 KB |
Output is correct |
76 |
Correct |
442 ms |
37928 KB |
Output is correct |
77 |
Correct |
8 ms |
844 KB |
Output is correct |
78 |
Correct |
14 ms |
1356 KB |
Output is correct |
79 |
Correct |
274 ms |
13644 KB |
Output is correct |
80 |
Correct |
507 ms |
20360 KB |
Output is correct |
81 |
Correct |
755 ms |
27348 KB |
Output is correct |
82 |
Correct |
1 ms |
204 KB |
Output is correct |
83 |
Correct |
1 ms |
204 KB |
Output is correct |
84 |
Correct |
1 ms |
204 KB |
Output is correct |
85 |
Correct |
905 ms |
27532 KB |
Output is correct |
86 |
Correct |
596 ms |
37304 KB |
Output is correct |
87 |
Correct |
1008 ms |
27232 KB |
Output is correct |
88 |
Correct |
470 ms |
33980 KB |
Output is correct |
89 |
Correct |
672 ms |
17444 KB |
Output is correct |
90 |
Correct |
761 ms |
20848 KB |
Output is correct |
91 |
Correct |
585 ms |
20752 KB |
Output is correct |
92 |
Correct |
527 ms |
27152 KB |
Output is correct |
93 |
Correct |
452 ms |
27084 KB |
Output is correct |
94 |
Correct |
675 ms |
27248 KB |
Output is correct |
95 |
Correct |
801 ms |
27168 KB |
Output is correct |
96 |
Correct |
1 ms |
204 KB |
Output is correct |
97 |
Correct |
44 ms |
2440 KB |
Output is correct |
98 |
Correct |
255 ms |
8812 KB |
Output is correct |
99 |
Correct |
625 ms |
55612 KB |
Output is correct |
100 |
Correct |
20 ms |
1356 KB |
Output is correct |
101 |
Correct |
156 ms |
5572 KB |
Output is correct |
102 |
Correct |
377 ms |
10696 KB |
Output is correct |
103 |
Correct |
385 ms |
11396 KB |
Output is correct |
104 |
Correct |
546 ms |
15172 KB |
Output is correct |
105 |
Correct |
619 ms |
19636 KB |
Output is correct |
106 |
Correct |
805 ms |
23496 KB |
Output is correct |
107 |
Correct |
1094 ms |
27824 KB |
Output is correct |
108 |
Correct |
1 ms |
204 KB |
Output is correct |
109 |
Correct |
1 ms |
204 KB |
Output is correct |
110 |
Correct |
1 ms |
204 KB |
Output is correct |
111 |
Correct |
1 ms |
204 KB |
Output is correct |
112 |
Correct |
1 ms |
204 KB |
Output is correct |
113 |
Correct |
1 ms |
204 KB |
Output is correct |
114 |
Correct |
1 ms |
204 KB |
Output is correct |
115 |
Correct |
1 ms |
204 KB |
Output is correct |
116 |
Correct |
1 ms |
204 KB |
Output is correct |
117 |
Correct |
1 ms |
204 KB |
Output is correct |
118 |
Correct |
1 ms |
204 KB |
Output is correct |
119 |
Correct |
4 ms |
460 KB |
Output is correct |
120 |
Correct |
6 ms |
588 KB |
Output is correct |
121 |
Correct |
404 ms |
13684 KB |
Output is correct |
122 |
Correct |
597 ms |
19952 KB |
Output is correct |
123 |
Correct |
562 ms |
19924 KB |
Output is correct |
124 |
Correct |
1 ms |
204 KB |
Output is correct |
125 |
Correct |
1 ms |
204 KB |
Output is correct |
126 |
Correct |
1 ms |
204 KB |
Output is correct |
127 |
Correct |
516 ms |
39080 KB |
Output is correct |
128 |
Correct |
526 ms |
36464 KB |
Output is correct |
129 |
Correct |
486 ms |
38088 KB |
Output is correct |
130 |
Correct |
10 ms |
708 KB |
Output is correct |
131 |
Correct |
13 ms |
1100 KB |
Output is correct |
132 |
Correct |
334 ms |
13700 KB |
Output is correct |
133 |
Correct |
515 ms |
20392 KB |
Output is correct |
134 |
Correct |
779 ms |
27032 KB |
Output is correct |
135 |
Correct |
458 ms |
37224 KB |
Output is correct |
136 |
Correct |
560 ms |
39856 KB |
Output is correct |
137 |
Correct |
708 ms |
32540 KB |
Output is correct |
138 |
Correct |
601 ms |
26604 KB |
Output is correct |
139 |
Correct |
455 ms |
23920 KB |
Output is correct |
140 |
Correct |
1 ms |
204 KB |
Output is correct |
141 |
Correct |
79 ms |
5196 KB |
Output is correct |
142 |
Correct |
37 ms |
2564 KB |
Output is correct |
143 |
Correct |
175 ms |
7684 KB |
Output is correct |
144 |
Correct |
355 ms |
12644 KB |
Output is correct |
145 |
Correct |
295 ms |
14264 KB |
Output is correct |
146 |
Correct |
386 ms |
17444 KB |
Output is correct |
147 |
Correct |
506 ms |
21076 KB |
Output is correct |
148 |
Correct |
662 ms |
23964 KB |
Output is correct |
149 |
Correct |
677 ms |
27668 KB |
Output is correct |
150 |
Correct |
548 ms |
40700 KB |
Output is correct |
151 |
Correct |
553 ms |
38000 KB |
Output is correct |
152 |
Correct |
8 ms |
844 KB |
Output is correct |
153 |
Correct |
18 ms |
1276 KB |
Output is correct |
154 |
Correct |
261 ms |
13732 KB |
Output is correct |
155 |
Correct |
464 ms |
20396 KB |
Output is correct |
156 |
Correct |
687 ms |
27504 KB |
Output is correct |
157 |
Correct |
1 ms |
204 KB |
Output is correct |
158 |
Correct |
0 ms |
204 KB |
Output is correct |
159 |
Correct |
1 ms |
204 KB |
Output is correct |
160 |
Correct |
1 ms |
204 KB |
Output is correct |
161 |
Correct |
702 ms |
27148 KB |
Output is correct |
162 |
Correct |
598 ms |
49140 KB |
Output is correct |
163 |
Correct |
752 ms |
41868 KB |
Output is correct |
164 |
Correct |
711 ms |
40520 KB |
Output is correct |
165 |
Correct |
703 ms |
34780 KB |
Output is correct |
166 |
Correct |
700 ms |
29140 KB |
Output is correct |
167 |
Correct |
146 ms |
6708 KB |
Output is correct |
168 |
Correct |
71 ms |
3556 KB |
Output is correct |
169 |
Correct |
221 ms |
8724 KB |
Output is correct |
170 |
Correct |
442 ms |
15888 KB |
Output is correct |
171 |
Correct |
616 ms |
20772 KB |
Output is correct |
172 |
Correct |
292 ms |
13964 KB |
Output is correct |
173 |
Correct |
400 ms |
16684 KB |
Output is correct |
174 |
Correct |
477 ms |
19428 KB |
Output is correct |
175 |
Correct |
544 ms |
22036 KB |
Output is correct |
176 |
Correct |
659 ms |
24964 KB |
Output is correct |
177 |
Correct |
793 ms |
27632 KB |
Output is correct |