Submission #586303

# Submission time Handle Problem Language Result Execution time Memory
586303 2022-06-30T06:29:16 Z jamezzz Mars (APIO22_mars) C++17
14 / 100
1522 ms 278528 KB
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;

int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

string process(vector<vector<string>> a,int i,int j,int k,int n){
	++k;
	vector<vector<char>> grid;
	grid.resize(2*k+1);
	for(int i=0;i<2*k+1;++i){
		grid[i].resize(2*k+1);
	}
	for(int i=0;i<3;++i){
		for(int j=0;j<3;++j){
			for(int l=0;l<(2*k-1)*(2*k-1);++l){
				int r=l/(2*k-1),c=l%(2*k-1);
				grid[r+i][c+j]=a[i][j][l];
			}
		}
	}
	
	/*
	for(int i=0;i<2*k+1;++i){
		for(int j=0;j<2*k+1;++j){
			printf("%c",grid[i][j]);
		}
		printf("\n");
	}
	*/
	
	if(n==k){
		vector<vector<int>> vis;
		vis.resize(2*k+1);
		for(int i=0;i<2*k+1;++i){
			vis[i].resize(2*k+1,0);
		}
		int ans=0;
		queue<pair<int,int>> q;
		for(int i=0;i<2*k+1;++i){
			for(int j=0;j<2*k+1;++j){
				if(grid[i][j]=='1'&&!vis[i][j]){
					++ans;
					q.push({i,j});
					while(!q.empty()){
						auto[x,y]=q.front();
						q.pop();
						for(int i=0;i<4;++i){
							int nx=x+dx[i],ny=y+dy[i];
							if(nx<0||ny<0||nx>=2*k+1||ny>=2*k+1)continue;
							if(grid[nx][ny]!='1')continue;
							if(vis[nx][ny])continue;
							vis[nx][ny]=true;
							q.push({nx,ny});
						}
					}
				}
			}
		}
		string ret="";
		for(int i=0;i<100;++i){
			if(i<=30&&((1<<i)&ans)!=0){
				ret+='1';
			}
			else ret+='0';
		}
		return ret;
	}
	else{
		string ret="";
		for(int i=0;i<2*k+1;++i){
			for(int j=0;j<2*k+1;++j){
				ret+=grid[i][j];
			}
		}
		while(ret.length()!=100)ret+='0';
		return ret;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1892 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 2004 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 2032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1892 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 2004 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 2032 KB Output is correct
7 Correct 14 ms 2036 KB Output is correct
8 Correct 16 ms 2116 KB Output is correct
9 Correct 16 ms 2120 KB Output is correct
10 Correct 17 ms 2036 KB Output is correct
11 Correct 16 ms 1976 KB Output is correct
12 Correct 16 ms 2096 KB Output is correct
13 Correct 16 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1892 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 2004 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 2032 KB Output is correct
7 Correct 14 ms 2036 KB Output is correct
8 Correct 16 ms 2116 KB Output is correct
9 Correct 16 ms 2120 KB Output is correct
10 Correct 17 ms 2036 KB Output is correct
11 Correct 16 ms 1976 KB Output is correct
12 Correct 16 ms 2096 KB Output is correct
13 Correct 16 ms 1876 KB Output is correct
14 Memory limit exceeded 1522 ms 278528 KB Execution killed with signal 9
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1892 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 2004 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 2032 KB Output is correct
7 Correct 14 ms 2036 KB Output is correct
8 Correct 16 ms 2116 KB Output is correct
9 Correct 16 ms 2120 KB Output is correct
10 Correct 17 ms 2036 KB Output is correct
11 Correct 16 ms 1976 KB Output is correct
12 Correct 16 ms 2096 KB Output is correct
13 Correct 16 ms 1876 KB Output is correct
14 Memory limit exceeded 1522 ms 278528 KB Execution killed with signal 9
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1892 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 2004 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 2032 KB Output is correct
7 Correct 14 ms 2036 KB Output is correct
8 Correct 16 ms 2116 KB Output is correct
9 Correct 16 ms 2120 KB Output is correct
10 Correct 17 ms 2036 KB Output is correct
11 Correct 16 ms 1976 KB Output is correct
12 Correct 16 ms 2096 KB Output is correct
13 Correct 16 ms 1876 KB Output is correct
14 Memory limit exceeded 1522 ms 278528 KB Execution killed with signal 9
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1892 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 2004 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 2032 KB Output is correct
7 Correct 14 ms 2036 KB Output is correct
8 Correct 16 ms 2116 KB Output is correct
9 Correct 16 ms 2120 KB Output is correct
10 Correct 17 ms 2036 KB Output is correct
11 Correct 16 ms 1976 KB Output is correct
12 Correct 16 ms 2096 KB Output is correct
13 Correct 16 ms 1876 KB Output is correct
14 Memory limit exceeded 1522 ms 278528 KB Execution killed with signal 9
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1892 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 2004 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 2032 KB Output is correct
7 Correct 14 ms 2036 KB Output is correct
8 Correct 16 ms 2116 KB Output is correct
9 Correct 16 ms 2120 KB Output is correct
10 Correct 17 ms 2036 KB Output is correct
11 Correct 16 ms 1976 KB Output is correct
12 Correct 16 ms 2096 KB Output is correct
13 Correct 16 ms 1876 KB Output is correct
14 Memory limit exceeded 1522 ms 278528 KB Execution killed with signal 9
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1892 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 2004 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 2032 KB Output is correct
7 Correct 14 ms 2036 KB Output is correct
8 Correct 16 ms 2116 KB Output is correct
9 Correct 16 ms 2120 KB Output is correct
10 Correct 17 ms 2036 KB Output is correct
11 Correct 16 ms 1976 KB Output is correct
12 Correct 16 ms 2096 KB Output is correct
13 Correct 16 ms 1876 KB Output is correct
14 Memory limit exceeded 1522 ms 278528 KB Execution killed with signal 9
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1892 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 2004 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 2032 KB Output is correct
7 Correct 14 ms 2036 KB Output is correct
8 Correct 16 ms 2116 KB Output is correct
9 Correct 16 ms 2120 KB Output is correct
10 Correct 17 ms 2036 KB Output is correct
11 Correct 16 ms 1976 KB Output is correct
12 Correct 16 ms 2096 KB Output is correct
13 Correct 16 ms 1876 KB Output is correct
14 Memory limit exceeded 1522 ms 278528 KB Execution killed with signal 9
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1892 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 2004 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 2032 KB Output is correct
7 Correct 14 ms 2036 KB Output is correct
8 Correct 16 ms 2116 KB Output is correct
9 Correct 16 ms 2120 KB Output is correct
10 Correct 17 ms 2036 KB Output is correct
11 Correct 16 ms 1976 KB Output is correct
12 Correct 16 ms 2096 KB Output is correct
13 Correct 16 ms 1876 KB Output is correct
14 Memory limit exceeded 1522 ms 278528 KB Execution killed with signal 9
15 Halted 0 ms 0 KB -