# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1063951 |
2024-08-18T06:42:09 Z |
sleepntsheep |
Mars (APIO22_mars) |
C++17 |
|
1 ms |
332 KB |
#include "mars.h"
#include <iostream>
#include <queue>
using namespace std;
void sor(string &a, string &b) {
for (int j = 1; j < 100; ++j) if (b[j] == '1') a[j] = '1';
}
int map(int i, int j, int n) {
return 1 + i * n + j;
}
string process(vector <vector<string>> a, int i, int j, int k, int n)
{
string tl = a[i][j];
for (int ii = i; ii < i + 3; ++ii) {
for (int jj = j; jj < j + 3; ++jj) {
sor(tl, a[ii][jj]);
if (a[ii][jj][0]=='1') tl[map(ii, jj, (2*n)+1)] = '1';
}
}
if (k == n - 1) {
n=2*n+1;
int vis[100] {},cmp{};
tl.erase(tl.begin());
queue<int> q;
for (int i=0;i<n*n;++i){
if(not vis[i] and tl[i]=='1'){
++cmp;
q.push(i),vis[i]=1;
while(q.size()){
int u=q.front();q.pop();
auto nq=[&](int v){if(v>=0 and v<n*n and not vis[v] and tl[v]=='1')vis[v]=1,q.push(v);};
if(u%n)nq(u-1);
if((u+1)%n)nq(u+1);
nq(u-n),nq(u+n);
}
}
}
string out(100,'0');
for(int j=0;j<20;++j)if((cmp&(1<<j)))out[j]='1';
return out;
}
return tl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |