# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
982792 |
2024-05-14T18:08:45 Z |
vjudge1 |
Mars (APIO22_mars) |
C++17 |
|
98 ms |
4588 KB |
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
string process (vector <vector <string> > a, int i, int j, int k, int n) {
n = 2*n+1;
if (n == 3) {
vector <vector <char> > mat(n, vector <char> (n, false));
for (ll ii = 0; ii < 3; ii++) {
for (ll jj = 0; jj < 3; jj++) {
mat[ii][jj] = a[ii][jj][0];
}
}
vector <vector <char> > vis(n, vector <char> (n, false));
ll ans = 0;
for (ll i = 0; i < n; i++) {
for (ll j = 0; j < n; j++) {
if (mat[i][j] == '0') continue;
if (vis[i][j]) continue;
ans++;
queue <ll> q;
q.push(i);
q.push(j);
while (q.size()) {
ll i = q.front(); q.pop();
ll j = q.front(); q.pop();
if (mat[i][j] == '0') continue;
if (vis[i][j]) continue;
vis[i][j] = true;
if (0 < i) {
q.push(i-1);
q.push(j);
}
if (i < n-1) {
q.push(i+1);
q.push(j);
}
if (0 < j) {
q.push(i);
q.push(j-1);
}
if (j < n-1) {
q.push(i);
q.push(j+1);
}
}
}
}
string sans(100, '0');
for (ll i = 0; i < 10; i++) {
sans[i] = (ans>>i&1 ? '1' : '0');
}
return sans;
}
vector <vector <bitset <100> > > aa(3, vector <bitset <100> > (3, bitset <100> (0)));
if (k == 0) {
for (ll ii = i; ii < i+3; ii++) {
for (ll jj = j; jj < j+3; jj++) {
swap(a[ii-i][jj-j][0], a[ii-i][jj-j][(ii/2)*((n+1)/2)+(jj/2)]);
}
}
}
for (ll i = 0; i < 3; i++) {
for (ll j = 0; j < 3; j++) {
for (ll k = 0; k < 100; k++) {
aa[i][j][k] = a[i][j][k] == '1';
}
}
}
aa[0][0] |= aa[0][2];
aa[0][0] |= aa[2][0];
aa[0][0] |= aa[2][2];
aa[0][1] |= aa[2][1];
aa[1][0] |= aa[1][2];
if (k+1 != n/2) {
string ans = "";
for (ll k = 0; k < 100; k++) ans += char('0'+aa[0][0][k]);
return ans;
}
// final phase
vector <vector <char> > mat(n, vector <char> (n, '*'));
for (ll sti = 0; sti < 2; sti++) {
for (ll stj = 0; stj < 2; stj++) {
for (ll i = sti; i < n; i += 2) {
for (ll j = stj; j < n; j += 2) {
ll pos = (i/2)*((n+1)/2)+(j/2);
mat[i][j] = '0'+aa[sti][stj][pos];
}
}
}}
vector <vector <char> > vis(n, vector <char> (n, false));
ll ans = 0;
for (ll i = 0; i < n; i++) {
for (ll j = 0; j < n; j++) {
if (mat[i][j] == '0') continue;
if (vis[i][j]) continue;
ans++;
queue <ll> q;
q.push(i);
q.push(j);
while (q.size()) {
ll i = q.front(); q.pop();
ll j = q.front(); q.pop();
if (mat[i][j] == '0') continue;
if (vis[i][j]) continue;
vis[i][j] = true;
if (0 < i) {
q.push(i-1);
q.push(j);
}
if (i < n-1) {
q.push(i+1);
q.push(j);
}
if (0 < j) {
q.push(i);
q.push(j-1);
}
if (j < n-1) {
q.push(i);
q.push(j+1);
}
}
}
}
string sans(100, '0');
for (ll i = 0; i < 10; i++) {
sans[i] = (ans>>i&1 ? '1' : '0');
}
return sans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4308 KB |
Output is correct |
2 |
Correct |
6 ms |
3604 KB |
Output is correct |
3 |
Correct |
8 ms |
3744 KB |
Output is correct |
4 |
Correct |
6 ms |
4388 KB |
Output is correct |
5 |
Correct |
5 ms |
3888 KB |
Output is correct |
6 |
Correct |
4 ms |
3964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4308 KB |
Output is correct |
2 |
Correct |
6 ms |
3604 KB |
Output is correct |
3 |
Correct |
8 ms |
3744 KB |
Output is correct |
4 |
Correct |
6 ms |
4388 KB |
Output is correct |
5 |
Correct |
5 ms |
3888 KB |
Output is correct |
6 |
Correct |
4 ms |
3964 KB |
Output is correct |
7 |
Correct |
8 ms |
3776 KB |
Output is correct |
8 |
Correct |
9 ms |
4124 KB |
Output is correct |
9 |
Correct |
10 ms |
3848 KB |
Output is correct |
10 |
Correct |
8 ms |
3640 KB |
Output is correct |
11 |
Correct |
12 ms |
3948 KB |
Output is correct |
12 |
Correct |
12 ms |
4116 KB |
Output is correct |
13 |
Correct |
10 ms |
3676 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4308 KB |
Output is correct |
2 |
Correct |
6 ms |
3604 KB |
Output is correct |
3 |
Correct |
8 ms |
3744 KB |
Output is correct |
4 |
Correct |
6 ms |
4388 KB |
Output is correct |
5 |
Correct |
5 ms |
3888 KB |
Output is correct |
6 |
Correct |
4 ms |
3964 KB |
Output is correct |
7 |
Correct |
8 ms |
3776 KB |
Output is correct |
8 |
Correct |
9 ms |
4124 KB |
Output is correct |
9 |
Correct |
10 ms |
3848 KB |
Output is correct |
10 |
Correct |
8 ms |
3640 KB |
Output is correct |
11 |
Correct |
12 ms |
3948 KB |
Output is correct |
12 |
Correct |
12 ms |
4116 KB |
Output is correct |
13 |
Correct |
10 ms |
3676 KB |
Output is correct |
14 |
Correct |
22 ms |
3700 KB |
Output is correct |
15 |
Correct |
31 ms |
4552 KB |
Output is correct |
16 |
Correct |
30 ms |
4460 KB |
Output is correct |
17 |
Correct |
30 ms |
4276 KB |
Output is correct |
18 |
Correct |
26 ms |
4280 KB |
Output is correct |
19 |
Correct |
32 ms |
4516 KB |
Output is correct |
20 |
Correct |
31 ms |
4452 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4308 KB |
Output is correct |
2 |
Correct |
6 ms |
3604 KB |
Output is correct |
3 |
Correct |
8 ms |
3744 KB |
Output is correct |
4 |
Correct |
6 ms |
4388 KB |
Output is correct |
5 |
Correct |
5 ms |
3888 KB |
Output is correct |
6 |
Correct |
4 ms |
3964 KB |
Output is correct |
7 |
Correct |
8 ms |
3776 KB |
Output is correct |
8 |
Correct |
9 ms |
4124 KB |
Output is correct |
9 |
Correct |
10 ms |
3848 KB |
Output is correct |
10 |
Correct |
8 ms |
3640 KB |
Output is correct |
11 |
Correct |
12 ms |
3948 KB |
Output is correct |
12 |
Correct |
12 ms |
4116 KB |
Output is correct |
13 |
Correct |
10 ms |
3676 KB |
Output is correct |
14 |
Correct |
22 ms |
3700 KB |
Output is correct |
15 |
Correct |
31 ms |
4552 KB |
Output is correct |
16 |
Correct |
30 ms |
4460 KB |
Output is correct |
17 |
Correct |
30 ms |
4276 KB |
Output is correct |
18 |
Correct |
26 ms |
4280 KB |
Output is correct |
19 |
Correct |
32 ms |
4516 KB |
Output is correct |
20 |
Correct |
31 ms |
4452 KB |
Output is correct |
21 |
Correct |
46 ms |
3904 KB |
Output is correct |
22 |
Correct |
68 ms |
4068 KB |
Output is correct |
23 |
Correct |
66 ms |
4528 KB |
Output is correct |
24 |
Correct |
71 ms |
3908 KB |
Output is correct |
25 |
Correct |
67 ms |
4400 KB |
Output is correct |
26 |
Correct |
66 ms |
4272 KB |
Output is correct |
27 |
Correct |
65 ms |
3956 KB |
Output is correct |
28 |
Correct |
70 ms |
4588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4308 KB |
Output is correct |
2 |
Correct |
6 ms |
3604 KB |
Output is correct |
3 |
Correct |
8 ms |
3744 KB |
Output is correct |
4 |
Correct |
6 ms |
4388 KB |
Output is correct |
5 |
Correct |
5 ms |
3888 KB |
Output is correct |
6 |
Correct |
4 ms |
3964 KB |
Output is correct |
7 |
Correct |
8 ms |
3776 KB |
Output is correct |
8 |
Correct |
9 ms |
4124 KB |
Output is correct |
9 |
Correct |
10 ms |
3848 KB |
Output is correct |
10 |
Correct |
8 ms |
3640 KB |
Output is correct |
11 |
Correct |
12 ms |
3948 KB |
Output is correct |
12 |
Correct |
12 ms |
4116 KB |
Output is correct |
13 |
Correct |
10 ms |
3676 KB |
Output is correct |
14 |
Correct |
22 ms |
3700 KB |
Output is correct |
15 |
Correct |
31 ms |
4552 KB |
Output is correct |
16 |
Correct |
30 ms |
4460 KB |
Output is correct |
17 |
Correct |
30 ms |
4276 KB |
Output is correct |
18 |
Correct |
26 ms |
4280 KB |
Output is correct |
19 |
Correct |
32 ms |
4516 KB |
Output is correct |
20 |
Correct |
31 ms |
4452 KB |
Output is correct |
21 |
Correct |
46 ms |
3904 KB |
Output is correct |
22 |
Correct |
68 ms |
4068 KB |
Output is correct |
23 |
Correct |
66 ms |
4528 KB |
Output is correct |
24 |
Correct |
71 ms |
3908 KB |
Output is correct |
25 |
Correct |
67 ms |
4400 KB |
Output is correct |
26 |
Correct |
66 ms |
4272 KB |
Output is correct |
27 |
Correct |
65 ms |
3956 KB |
Output is correct |
28 |
Correct |
70 ms |
4588 KB |
Output is correct |
29 |
Correct |
98 ms |
4220 KB |
Output is correct |
30 |
Runtime error |
3 ms |
472 KB |
Execution killed with signal 6 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4308 KB |
Output is correct |
2 |
Correct |
6 ms |
3604 KB |
Output is correct |
3 |
Correct |
8 ms |
3744 KB |
Output is correct |
4 |
Correct |
6 ms |
4388 KB |
Output is correct |
5 |
Correct |
5 ms |
3888 KB |
Output is correct |
6 |
Correct |
4 ms |
3964 KB |
Output is correct |
7 |
Correct |
8 ms |
3776 KB |
Output is correct |
8 |
Correct |
9 ms |
4124 KB |
Output is correct |
9 |
Correct |
10 ms |
3848 KB |
Output is correct |
10 |
Correct |
8 ms |
3640 KB |
Output is correct |
11 |
Correct |
12 ms |
3948 KB |
Output is correct |
12 |
Correct |
12 ms |
4116 KB |
Output is correct |
13 |
Correct |
10 ms |
3676 KB |
Output is correct |
14 |
Correct |
22 ms |
3700 KB |
Output is correct |
15 |
Correct |
31 ms |
4552 KB |
Output is correct |
16 |
Correct |
30 ms |
4460 KB |
Output is correct |
17 |
Correct |
30 ms |
4276 KB |
Output is correct |
18 |
Correct |
26 ms |
4280 KB |
Output is correct |
19 |
Correct |
32 ms |
4516 KB |
Output is correct |
20 |
Correct |
31 ms |
4452 KB |
Output is correct |
21 |
Correct |
46 ms |
3904 KB |
Output is correct |
22 |
Correct |
68 ms |
4068 KB |
Output is correct |
23 |
Correct |
66 ms |
4528 KB |
Output is correct |
24 |
Correct |
71 ms |
3908 KB |
Output is correct |
25 |
Correct |
67 ms |
4400 KB |
Output is correct |
26 |
Correct |
66 ms |
4272 KB |
Output is correct |
27 |
Correct |
65 ms |
3956 KB |
Output is correct |
28 |
Correct |
70 ms |
4588 KB |
Output is correct |
29 |
Correct |
98 ms |
4220 KB |
Output is correct |
30 |
Runtime error |
3 ms |
472 KB |
Execution killed with signal 6 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4308 KB |
Output is correct |
2 |
Correct |
6 ms |
3604 KB |
Output is correct |
3 |
Correct |
8 ms |
3744 KB |
Output is correct |
4 |
Correct |
6 ms |
4388 KB |
Output is correct |
5 |
Correct |
5 ms |
3888 KB |
Output is correct |
6 |
Correct |
4 ms |
3964 KB |
Output is correct |
7 |
Correct |
8 ms |
3776 KB |
Output is correct |
8 |
Correct |
9 ms |
4124 KB |
Output is correct |
9 |
Correct |
10 ms |
3848 KB |
Output is correct |
10 |
Correct |
8 ms |
3640 KB |
Output is correct |
11 |
Correct |
12 ms |
3948 KB |
Output is correct |
12 |
Correct |
12 ms |
4116 KB |
Output is correct |
13 |
Correct |
10 ms |
3676 KB |
Output is correct |
14 |
Correct |
22 ms |
3700 KB |
Output is correct |
15 |
Correct |
31 ms |
4552 KB |
Output is correct |
16 |
Correct |
30 ms |
4460 KB |
Output is correct |
17 |
Correct |
30 ms |
4276 KB |
Output is correct |
18 |
Correct |
26 ms |
4280 KB |
Output is correct |
19 |
Correct |
32 ms |
4516 KB |
Output is correct |
20 |
Correct |
31 ms |
4452 KB |
Output is correct |
21 |
Correct |
46 ms |
3904 KB |
Output is correct |
22 |
Correct |
68 ms |
4068 KB |
Output is correct |
23 |
Correct |
66 ms |
4528 KB |
Output is correct |
24 |
Correct |
71 ms |
3908 KB |
Output is correct |
25 |
Correct |
67 ms |
4400 KB |
Output is correct |
26 |
Correct |
66 ms |
4272 KB |
Output is correct |
27 |
Correct |
65 ms |
3956 KB |
Output is correct |
28 |
Correct |
70 ms |
4588 KB |
Output is correct |
29 |
Correct |
98 ms |
4220 KB |
Output is correct |
30 |
Runtime error |
3 ms |
472 KB |
Execution killed with signal 6 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4308 KB |
Output is correct |
2 |
Correct |
6 ms |
3604 KB |
Output is correct |
3 |
Correct |
8 ms |
3744 KB |
Output is correct |
4 |
Correct |
6 ms |
4388 KB |
Output is correct |
5 |
Correct |
5 ms |
3888 KB |
Output is correct |
6 |
Correct |
4 ms |
3964 KB |
Output is correct |
7 |
Correct |
8 ms |
3776 KB |
Output is correct |
8 |
Correct |
9 ms |
4124 KB |
Output is correct |
9 |
Correct |
10 ms |
3848 KB |
Output is correct |
10 |
Correct |
8 ms |
3640 KB |
Output is correct |
11 |
Correct |
12 ms |
3948 KB |
Output is correct |
12 |
Correct |
12 ms |
4116 KB |
Output is correct |
13 |
Correct |
10 ms |
3676 KB |
Output is correct |
14 |
Correct |
22 ms |
3700 KB |
Output is correct |
15 |
Correct |
31 ms |
4552 KB |
Output is correct |
16 |
Correct |
30 ms |
4460 KB |
Output is correct |
17 |
Correct |
30 ms |
4276 KB |
Output is correct |
18 |
Correct |
26 ms |
4280 KB |
Output is correct |
19 |
Correct |
32 ms |
4516 KB |
Output is correct |
20 |
Correct |
31 ms |
4452 KB |
Output is correct |
21 |
Correct |
46 ms |
3904 KB |
Output is correct |
22 |
Correct |
68 ms |
4068 KB |
Output is correct |
23 |
Correct |
66 ms |
4528 KB |
Output is correct |
24 |
Correct |
71 ms |
3908 KB |
Output is correct |
25 |
Correct |
67 ms |
4400 KB |
Output is correct |
26 |
Correct |
66 ms |
4272 KB |
Output is correct |
27 |
Correct |
65 ms |
3956 KB |
Output is correct |
28 |
Correct |
70 ms |
4588 KB |
Output is correct |
29 |
Correct |
98 ms |
4220 KB |
Output is correct |
30 |
Runtime error |
3 ms |
472 KB |
Execution killed with signal 6 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4308 KB |
Output is correct |
2 |
Correct |
6 ms |
3604 KB |
Output is correct |
3 |
Correct |
8 ms |
3744 KB |
Output is correct |
4 |
Correct |
6 ms |
4388 KB |
Output is correct |
5 |
Correct |
5 ms |
3888 KB |
Output is correct |
6 |
Correct |
4 ms |
3964 KB |
Output is correct |
7 |
Correct |
8 ms |
3776 KB |
Output is correct |
8 |
Correct |
9 ms |
4124 KB |
Output is correct |
9 |
Correct |
10 ms |
3848 KB |
Output is correct |
10 |
Correct |
8 ms |
3640 KB |
Output is correct |
11 |
Correct |
12 ms |
3948 KB |
Output is correct |
12 |
Correct |
12 ms |
4116 KB |
Output is correct |
13 |
Correct |
10 ms |
3676 KB |
Output is correct |
14 |
Correct |
22 ms |
3700 KB |
Output is correct |
15 |
Correct |
31 ms |
4552 KB |
Output is correct |
16 |
Correct |
30 ms |
4460 KB |
Output is correct |
17 |
Correct |
30 ms |
4276 KB |
Output is correct |
18 |
Correct |
26 ms |
4280 KB |
Output is correct |
19 |
Correct |
32 ms |
4516 KB |
Output is correct |
20 |
Correct |
31 ms |
4452 KB |
Output is correct |
21 |
Correct |
46 ms |
3904 KB |
Output is correct |
22 |
Correct |
68 ms |
4068 KB |
Output is correct |
23 |
Correct |
66 ms |
4528 KB |
Output is correct |
24 |
Correct |
71 ms |
3908 KB |
Output is correct |
25 |
Correct |
67 ms |
4400 KB |
Output is correct |
26 |
Correct |
66 ms |
4272 KB |
Output is correct |
27 |
Correct |
65 ms |
3956 KB |
Output is correct |
28 |
Correct |
70 ms |
4588 KB |
Output is correct |
29 |
Correct |
98 ms |
4220 KB |
Output is correct |
30 |
Runtime error |
3 ms |
472 KB |
Execution killed with signal 6 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4308 KB |
Output is correct |
2 |
Correct |
6 ms |
3604 KB |
Output is correct |
3 |
Correct |
8 ms |
3744 KB |
Output is correct |
4 |
Correct |
6 ms |
4388 KB |
Output is correct |
5 |
Correct |
5 ms |
3888 KB |
Output is correct |
6 |
Correct |
4 ms |
3964 KB |
Output is correct |
7 |
Correct |
8 ms |
3776 KB |
Output is correct |
8 |
Correct |
9 ms |
4124 KB |
Output is correct |
9 |
Correct |
10 ms |
3848 KB |
Output is correct |
10 |
Correct |
8 ms |
3640 KB |
Output is correct |
11 |
Correct |
12 ms |
3948 KB |
Output is correct |
12 |
Correct |
12 ms |
4116 KB |
Output is correct |
13 |
Correct |
10 ms |
3676 KB |
Output is correct |
14 |
Correct |
22 ms |
3700 KB |
Output is correct |
15 |
Correct |
31 ms |
4552 KB |
Output is correct |
16 |
Correct |
30 ms |
4460 KB |
Output is correct |
17 |
Correct |
30 ms |
4276 KB |
Output is correct |
18 |
Correct |
26 ms |
4280 KB |
Output is correct |
19 |
Correct |
32 ms |
4516 KB |
Output is correct |
20 |
Correct |
31 ms |
4452 KB |
Output is correct |
21 |
Correct |
46 ms |
3904 KB |
Output is correct |
22 |
Correct |
68 ms |
4068 KB |
Output is correct |
23 |
Correct |
66 ms |
4528 KB |
Output is correct |
24 |
Correct |
71 ms |
3908 KB |
Output is correct |
25 |
Correct |
67 ms |
4400 KB |
Output is correct |
26 |
Correct |
66 ms |
4272 KB |
Output is correct |
27 |
Correct |
65 ms |
3956 KB |
Output is correct |
28 |
Correct |
70 ms |
4588 KB |
Output is correct |
29 |
Correct |
98 ms |
4220 KB |
Output is correct |
30 |
Runtime error |
3 ms |
472 KB |
Execution killed with signal 6 |
31 |
Halted |
0 ms |
0 KB |
- |