# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
821532 |
2023-08-11T11:16:08 Z |
radaiosm7 |
Mars (APIO22_mars) |
C++17 |
|
1 ms |
200 KB |
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
int id(int i, int j, int n) {
return i*n+j;
}
bool valid(int i, int j, int n) {
if (i < 0) return false;
if (i >= n) return false;
if (j < 0) return false;
if (j >= n) return false;
return true;
}
string process(vector<vector<string> > a, int i, int j, int k, int n) {
string ans(100, '0');
int tn = n;
n = 2*n+1;
if (k == 0) {
for (int dx=0; dx < 3; ++dx) for (int dy=0; dy < 3; ++dy) if (a[dx][dy][0] == '1') ans[id(i+dx, j+dy, n)] = '1';
}
else {
for (int dx=0; dx < 3; ++dx) for (int dy=0; dy < 3; ++dy) for (int jk=0; jk < 100; ++jk) if (a[dx][dy][jk] == '1') ans[jk] = '1';
}
if (k == tn-1) {
char mat[n][n];
bool vis[n][n];
for (int dx=0; dx < n; ++dx) for (int dy=0; dy < n; ++dy) vis[dx][dy] = false;
for (int dx=0; dx < n; ++dx) for (int dy=0; dy < n; ++dy) mat[dx][dy] = ans[id(dx, dy, n)];
int cc = 0;
for (int dx=0; dx < n; ++dx) {
for (int dy=0; dy < n; ++dy) {
if (mat[dx][dy] == '1') {
if (valid(dx, dy+1, n) && vis[dx][dy+1]) vis[dx][dy] = true;
if (!vis[dx][dy]) ++cc;
vis[dx][dy] = true;
if (valid(dx+1, dy, n) && mat[dx+1][dy] == '1') vis[dx+1][dy] = true;
if (valid(dx, dy+1, n) && mat[dx][dy+1] == '1') vis[dx][dy+1] = true;
}
}
}
string conn(100, '0');
for (i=0; i < 9; ++i) if (cc & (1 << i)) conn[i] = '1';
return conn;
}
else return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |