# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
594620 |
2022-07-12T18:01:49 Z |
Ozy |
Mars (APIO22_mars) |
C++17 |
|
19 ms |
2236 KB |
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define inicio "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
vector <std::vector<std::string>> A;
std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n)
{
swap(A,a);
string st = inicio;
lli pos,largo;
largo = 2*n + 1;
if (k == 0) {
rep(x,0,2) {
rep(y,0,2) {
pos = (x+i)*largo + (j+y) + 1;
A[x][y][pos] = A[x][y][0];
}
}
}
rep(x,0,2) {
rep(y,0,2) {
rep(q,1,99) if (A[x][y][q] == '1') st[q] = '1';
}
}
if (k < n-1) return st;
lli act,nue,res = 0;
queue<lli> cola;
lli visitados[200];
rep(q,1,120) visitados[q] = 0;
rep(i,1,99) {
if (visitados[i] == 1) continue;
if (st[i] == '1') {
res++;
cola.push(i);
while (!cola.empty()) {
act = cola.front();
cola.pop();
if (visitados[act] == 1) continue;
visitados[act] = 1;
nue = act+1;
if (act%largo != 0) if (st[nue] == '1') cola.push(nue);
nue = act-1;
if (nue%largo != 0) if (st[nue] == '1')cola.push(nue);
nue = act+largo;
if (nue <= (largo*largo)) if (st[nue] == '1') cola.push(nue);
nue = act-largo;
if (nue > 0) if (st[nue] == '1') cola.push(nue);
}
}
}
string fin = inicio;
lli cont = 0;
while (res > 0) {
if (res&1) fin[cont] = '1';
res /= 2;
cont++;
}
return fin;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2000 KB |
Output is correct |
2 |
Correct |
7 ms |
1860 KB |
Output is correct |
3 |
Correct |
8 ms |
2220 KB |
Output is correct |
4 |
Correct |
8 ms |
1952 KB |
Output is correct |
5 |
Correct |
8 ms |
2192 KB |
Output is correct |
6 |
Correct |
4 ms |
1884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2000 KB |
Output is correct |
2 |
Correct |
7 ms |
1860 KB |
Output is correct |
3 |
Correct |
8 ms |
2220 KB |
Output is correct |
4 |
Correct |
8 ms |
1952 KB |
Output is correct |
5 |
Correct |
8 ms |
2192 KB |
Output is correct |
6 |
Correct |
4 ms |
1884 KB |
Output is correct |
7 |
Correct |
11 ms |
2112 KB |
Output is correct |
8 |
Correct |
16 ms |
2236 KB |
Output is correct |
9 |
Correct |
19 ms |
1988 KB |
Output is correct |
10 |
Correct |
16 ms |
2200 KB |
Output is correct |
11 |
Correct |
16 ms |
2140 KB |
Output is correct |
12 |
Correct |
16 ms |
2220 KB |
Output is correct |
13 |
Correct |
19 ms |
1988 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2000 KB |
Output is correct |
2 |
Correct |
7 ms |
1860 KB |
Output is correct |
3 |
Correct |
8 ms |
2220 KB |
Output is correct |
4 |
Correct |
8 ms |
1952 KB |
Output is correct |
5 |
Correct |
8 ms |
2192 KB |
Output is correct |
6 |
Correct |
4 ms |
1884 KB |
Output is correct |
7 |
Correct |
11 ms |
2112 KB |
Output is correct |
8 |
Correct |
16 ms |
2236 KB |
Output is correct |
9 |
Correct |
19 ms |
1988 KB |
Output is correct |
10 |
Correct |
16 ms |
2200 KB |
Output is correct |
11 |
Correct |
16 ms |
2140 KB |
Output is correct |
12 |
Correct |
16 ms |
2220 KB |
Output is correct |
13 |
Correct |
19 ms |
1988 KB |
Output is correct |
14 |
Runtime error |
2 ms |
456 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2000 KB |
Output is correct |
2 |
Correct |
7 ms |
1860 KB |
Output is correct |
3 |
Correct |
8 ms |
2220 KB |
Output is correct |
4 |
Correct |
8 ms |
1952 KB |
Output is correct |
5 |
Correct |
8 ms |
2192 KB |
Output is correct |
6 |
Correct |
4 ms |
1884 KB |
Output is correct |
7 |
Correct |
11 ms |
2112 KB |
Output is correct |
8 |
Correct |
16 ms |
2236 KB |
Output is correct |
9 |
Correct |
19 ms |
1988 KB |
Output is correct |
10 |
Correct |
16 ms |
2200 KB |
Output is correct |
11 |
Correct |
16 ms |
2140 KB |
Output is correct |
12 |
Correct |
16 ms |
2220 KB |
Output is correct |
13 |
Correct |
19 ms |
1988 KB |
Output is correct |
14 |
Runtime error |
2 ms |
456 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2000 KB |
Output is correct |
2 |
Correct |
7 ms |
1860 KB |
Output is correct |
3 |
Correct |
8 ms |
2220 KB |
Output is correct |
4 |
Correct |
8 ms |
1952 KB |
Output is correct |
5 |
Correct |
8 ms |
2192 KB |
Output is correct |
6 |
Correct |
4 ms |
1884 KB |
Output is correct |
7 |
Correct |
11 ms |
2112 KB |
Output is correct |
8 |
Correct |
16 ms |
2236 KB |
Output is correct |
9 |
Correct |
19 ms |
1988 KB |
Output is correct |
10 |
Correct |
16 ms |
2200 KB |
Output is correct |
11 |
Correct |
16 ms |
2140 KB |
Output is correct |
12 |
Correct |
16 ms |
2220 KB |
Output is correct |
13 |
Correct |
19 ms |
1988 KB |
Output is correct |
14 |
Runtime error |
2 ms |
456 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2000 KB |
Output is correct |
2 |
Correct |
7 ms |
1860 KB |
Output is correct |
3 |
Correct |
8 ms |
2220 KB |
Output is correct |
4 |
Correct |
8 ms |
1952 KB |
Output is correct |
5 |
Correct |
8 ms |
2192 KB |
Output is correct |
6 |
Correct |
4 ms |
1884 KB |
Output is correct |
7 |
Correct |
11 ms |
2112 KB |
Output is correct |
8 |
Correct |
16 ms |
2236 KB |
Output is correct |
9 |
Correct |
19 ms |
1988 KB |
Output is correct |
10 |
Correct |
16 ms |
2200 KB |
Output is correct |
11 |
Correct |
16 ms |
2140 KB |
Output is correct |
12 |
Correct |
16 ms |
2220 KB |
Output is correct |
13 |
Correct |
19 ms |
1988 KB |
Output is correct |
14 |
Runtime error |
2 ms |
456 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2000 KB |
Output is correct |
2 |
Correct |
7 ms |
1860 KB |
Output is correct |
3 |
Correct |
8 ms |
2220 KB |
Output is correct |
4 |
Correct |
8 ms |
1952 KB |
Output is correct |
5 |
Correct |
8 ms |
2192 KB |
Output is correct |
6 |
Correct |
4 ms |
1884 KB |
Output is correct |
7 |
Correct |
11 ms |
2112 KB |
Output is correct |
8 |
Correct |
16 ms |
2236 KB |
Output is correct |
9 |
Correct |
19 ms |
1988 KB |
Output is correct |
10 |
Correct |
16 ms |
2200 KB |
Output is correct |
11 |
Correct |
16 ms |
2140 KB |
Output is correct |
12 |
Correct |
16 ms |
2220 KB |
Output is correct |
13 |
Correct |
19 ms |
1988 KB |
Output is correct |
14 |
Runtime error |
2 ms |
456 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2000 KB |
Output is correct |
2 |
Correct |
7 ms |
1860 KB |
Output is correct |
3 |
Correct |
8 ms |
2220 KB |
Output is correct |
4 |
Correct |
8 ms |
1952 KB |
Output is correct |
5 |
Correct |
8 ms |
2192 KB |
Output is correct |
6 |
Correct |
4 ms |
1884 KB |
Output is correct |
7 |
Correct |
11 ms |
2112 KB |
Output is correct |
8 |
Correct |
16 ms |
2236 KB |
Output is correct |
9 |
Correct |
19 ms |
1988 KB |
Output is correct |
10 |
Correct |
16 ms |
2200 KB |
Output is correct |
11 |
Correct |
16 ms |
2140 KB |
Output is correct |
12 |
Correct |
16 ms |
2220 KB |
Output is correct |
13 |
Correct |
19 ms |
1988 KB |
Output is correct |
14 |
Runtime error |
2 ms |
456 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2000 KB |
Output is correct |
2 |
Correct |
7 ms |
1860 KB |
Output is correct |
3 |
Correct |
8 ms |
2220 KB |
Output is correct |
4 |
Correct |
8 ms |
1952 KB |
Output is correct |
5 |
Correct |
8 ms |
2192 KB |
Output is correct |
6 |
Correct |
4 ms |
1884 KB |
Output is correct |
7 |
Correct |
11 ms |
2112 KB |
Output is correct |
8 |
Correct |
16 ms |
2236 KB |
Output is correct |
9 |
Correct |
19 ms |
1988 KB |
Output is correct |
10 |
Correct |
16 ms |
2200 KB |
Output is correct |
11 |
Correct |
16 ms |
2140 KB |
Output is correct |
12 |
Correct |
16 ms |
2220 KB |
Output is correct |
13 |
Correct |
19 ms |
1988 KB |
Output is correct |
14 |
Runtime error |
2 ms |
456 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
2000 KB |
Output is correct |
2 |
Correct |
7 ms |
1860 KB |
Output is correct |
3 |
Correct |
8 ms |
2220 KB |
Output is correct |
4 |
Correct |
8 ms |
1952 KB |
Output is correct |
5 |
Correct |
8 ms |
2192 KB |
Output is correct |
6 |
Correct |
4 ms |
1884 KB |
Output is correct |
7 |
Correct |
11 ms |
2112 KB |
Output is correct |
8 |
Correct |
16 ms |
2236 KB |
Output is correct |
9 |
Correct |
19 ms |
1988 KB |
Output is correct |
10 |
Correct |
16 ms |
2200 KB |
Output is correct |
11 |
Correct |
16 ms |
2140 KB |
Output is correct |
12 |
Correct |
16 ms |
2220 KB |
Output is correct |
13 |
Correct |
19 ms |
1988 KB |
Output is correct |
14 |
Runtime error |
2 ms |
456 KB |
Execution killed with signal 6 |
15 |
Halted |
0 ms |
0 KB |
- |