# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1032929 |
2024-07-24T10:57:55 Z |
irmuun |
Mars (APIO22_mars) |
C++17 |
|
1 ms |
332 KB |
#include<bits/stdc++.h>
#include "mars.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
const int N=50;
char g[N][N];
bool used[N][N];
int ans=0,sz;
vector<int>dx={-1,1,0,0};
vector<int>dy={0,0,-1,1};
void dfs(int i,int j){
used[i][j]=true;
for(int k=0;k<4;k++){
int ni=i+dx[k],nj=j+dy[k];
if(ni<0||nj<0||ni>=sz||nj>=sz||g[ni][nj]=='0'||used[ni][nj]) continue;
dfs(ni,nj);
}
}
string process(vector<vector<string>>a,int i,int j,int k,int n){
sz=n*2+1;
if(n==1){
for(int i=0;i<=2;i++){
for(int j=0;j<=2;j++){
g[i][j]=a[i][j][0];
}
}
for(int i=0;i<=2;i++){
for(int j=0;j<=2;j++){
if(!used[i][j]&&g[i][j]=='1'){
ans++;
dfs(i,j);
}
}
}
string s(100,'0');
int cur=0;
while(ans){
if(ans&1){
s[cur]='1';
}
cur++;
ans>>=1;
}
return s;
}
else{
if(k==0){
string s(100,'0');
int cur=0;
for(int i=0;i<=2;i++){
for(int j=0;j<=2;j++){
s[cur++]=a[i][j][0];
}
}
return s;
}
else{
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
int cur=0;
for(int l=i;l<=i+2;l++){
for(int r=j;r<=j+2;r++){
g[l][r]=a[i][j][cur++];
}
}
}
}
ans=0;
for(int i=0;i<=2;i++){
for(int j=0;j<=2;j++){
if(!used[i][j]&&g[i][j]=='1'){
ans++;
dfs(i,j);
}
}
}
string s(100,'0');
int cur=0;
while(ans){
if(ans&1){
s[cur]='1';
}
cur++;
ans>>=1;
}
return s;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |