# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
982679 |
2024-05-14T15:56:09 Z |
vjudge1 |
Mars (APIO22_mars) |
C++17 |
|
8 ms |
4064 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 (k == 0 && n == 5) {
if (i != 2 && j != 2) return a[0][0];
string ans(100, '0');
for (ll ii = 0; ii < 3; ii++) {
for (ll jj = 0; jj < 3; jj++) {
ans[3*ii+jj] = a[ii][jj][0];
}
}
return ans;
}
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];
}
}
if (n == 5) {
for (ll th = 0; th < 9; th++) {
ll ii = th/3;
ll jj = th%3;
mat[ii][jj+2] = a[0][2][th];
}
for (ll th = 0; th < 9; th++) {
ll ii = th/3;
ll jj = th%3;
mat[ii+2][jj] = a[2][0][th];
}
for (ll th = 0; th < 9; th++) {
ll ii = th/3;
ll jj = th%3;
mat[ii+2][jj+2] = a[2][2][th];
}
}
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 |
4064 KB |
Output is correct |
2 |
Correct |
5 ms |
3892 KB |
Output is correct |
3 |
Correct |
4 ms |
3628 KB |
Output is correct |
4 |
Correct |
8 ms |
4036 KB |
Output is correct |
5 |
Correct |
4 ms |
3872 KB |
Output is correct |
6 |
Correct |
7 ms |
3608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4064 KB |
Output is correct |
2 |
Correct |
5 ms |
3892 KB |
Output is correct |
3 |
Correct |
4 ms |
3628 KB |
Output is correct |
4 |
Correct |
8 ms |
4036 KB |
Output is correct |
5 |
Correct |
4 ms |
3872 KB |
Output is correct |
6 |
Correct |
7 ms |
3608 KB |
Output is correct |
7 |
Incorrect |
1 ms |
332 KB |
Incorrect |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4064 KB |
Output is correct |
2 |
Correct |
5 ms |
3892 KB |
Output is correct |
3 |
Correct |
4 ms |
3628 KB |
Output is correct |
4 |
Correct |
8 ms |
4036 KB |
Output is correct |
5 |
Correct |
4 ms |
3872 KB |
Output is correct |
6 |
Correct |
7 ms |
3608 KB |
Output is correct |
7 |
Incorrect |
1 ms |
332 KB |
Incorrect |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4064 KB |
Output is correct |
2 |
Correct |
5 ms |
3892 KB |
Output is correct |
3 |
Correct |
4 ms |
3628 KB |
Output is correct |
4 |
Correct |
8 ms |
4036 KB |
Output is correct |
5 |
Correct |
4 ms |
3872 KB |
Output is correct |
6 |
Correct |
7 ms |
3608 KB |
Output is correct |
7 |
Incorrect |
1 ms |
332 KB |
Incorrect |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4064 KB |
Output is correct |
2 |
Correct |
5 ms |
3892 KB |
Output is correct |
3 |
Correct |
4 ms |
3628 KB |
Output is correct |
4 |
Correct |
8 ms |
4036 KB |
Output is correct |
5 |
Correct |
4 ms |
3872 KB |
Output is correct |
6 |
Correct |
7 ms |
3608 KB |
Output is correct |
7 |
Incorrect |
1 ms |
332 KB |
Incorrect |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4064 KB |
Output is correct |
2 |
Correct |
5 ms |
3892 KB |
Output is correct |
3 |
Correct |
4 ms |
3628 KB |
Output is correct |
4 |
Correct |
8 ms |
4036 KB |
Output is correct |
5 |
Correct |
4 ms |
3872 KB |
Output is correct |
6 |
Correct |
7 ms |
3608 KB |
Output is correct |
7 |
Incorrect |
1 ms |
332 KB |
Incorrect |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4064 KB |
Output is correct |
2 |
Correct |
5 ms |
3892 KB |
Output is correct |
3 |
Correct |
4 ms |
3628 KB |
Output is correct |
4 |
Correct |
8 ms |
4036 KB |
Output is correct |
5 |
Correct |
4 ms |
3872 KB |
Output is correct |
6 |
Correct |
7 ms |
3608 KB |
Output is correct |
7 |
Incorrect |
1 ms |
332 KB |
Incorrect |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4064 KB |
Output is correct |
2 |
Correct |
5 ms |
3892 KB |
Output is correct |
3 |
Correct |
4 ms |
3628 KB |
Output is correct |
4 |
Correct |
8 ms |
4036 KB |
Output is correct |
5 |
Correct |
4 ms |
3872 KB |
Output is correct |
6 |
Correct |
7 ms |
3608 KB |
Output is correct |
7 |
Incorrect |
1 ms |
332 KB |
Incorrect |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4064 KB |
Output is correct |
2 |
Correct |
5 ms |
3892 KB |
Output is correct |
3 |
Correct |
4 ms |
3628 KB |
Output is correct |
4 |
Correct |
8 ms |
4036 KB |
Output is correct |
5 |
Correct |
4 ms |
3872 KB |
Output is correct |
6 |
Correct |
7 ms |
3608 KB |
Output is correct |
7 |
Incorrect |
1 ms |
332 KB |
Incorrect |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4064 KB |
Output is correct |
2 |
Correct |
5 ms |
3892 KB |
Output is correct |
3 |
Correct |
4 ms |
3628 KB |
Output is correct |
4 |
Correct |
8 ms |
4036 KB |
Output is correct |
5 |
Correct |
4 ms |
3872 KB |
Output is correct |
6 |
Correct |
7 ms |
3608 KB |
Output is correct |
7 |
Incorrect |
1 ms |
332 KB |
Incorrect |
8 |
Halted |
0 ms |
0 KB |
- |