Submission #975976

# Submission time Handle Problem Language Result Execution time Memory
975976 2024-05-06T04:13:46 Z phoenix0423 Mars (APIO22_mars) C++17
14 / 100
18 ms 4144 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#include "mars.h"
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};

string solve(string s, int n){
	auto inbound = [&](int x, int y) -> bool {
		return x >= 0 && y >= 0 && x < 2 * n + 1 && y < 2 * n + 1;
	};
	int ans = 0;
	vector<vector<int>> vis(10, vector<int>(10));
	auto dfs = [&](auto dfs, int x, int y) -> void {
		for(int d = 0; d < 4; d++){
			int xx = x + dx[d], yy = y + dy[d];
			if(!inbound(xx, yy) || s[xx * 10 + yy] == '0' || vis[xx][yy]) continue;
			vis[xx][yy] = 1;
			dfs(dfs, xx, yy);
		}
	};
	for(int i = 0; i < 10; i++){
		for(int j = 0; j < 10; j++){
			if(s[i * 10 + j] == '0' || vis[i][j]) continue;
			ans++;
			vis[i][j] = 1;
			dfs(dfs, i, j);
		}
	}
	string ret = "";
	for(int i = 0; i < 30; i++){
		if(ans & (1 << i)) ret += '1';
		else ret += '0';
	}
	for(int i = 0; i < 70; i++) ret += '0';
	return ret;
}

std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n){
	if(n <= 4){
		vector<vector<int>> st(10, vector<int>(10));
		for(int dx = 0; dx < 3; dx++){
			for(int dy = 0; dy < 3; dy++){
				for(int c = 0; c < 10; c++){
					for(int d = 0; d < 10; d++){
						if(i + dx + c > 2 * n || j + dy + d > 2 * n) break;
						if(a[dx][dy][c * 10 + d] == '1') st[dx + c][dy + d] = 1;
					}
				}
			}
		}
		a[0][0] = "";
		for(int c = 0; c < 10; c++){
			for(int d = 0; d < 10; d++){
				if(st[c][d]) a[0][0] += '1';
				else a[0][0] += '0';
			}
		}
		if(i == 0 && j == 0 && k == n - 1){
			return solve(a[0][0], n);
		}	
		return a[0][0];
	}
	return string(100, '0');
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3532 KB Output is correct
2 Correct 6 ms 3772 KB Output is correct
3 Correct 8 ms 3444 KB Output is correct
4 Correct 8 ms 4108 KB Output is correct
5 Correct 8 ms 3960 KB Output is correct
6 Correct 8 ms 3804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3532 KB Output is correct
2 Correct 6 ms 3772 KB Output is correct
3 Correct 8 ms 3444 KB Output is correct
4 Correct 8 ms 4108 KB Output is correct
5 Correct 8 ms 3960 KB Output is correct
6 Correct 8 ms 3804 KB Output is correct
7 Correct 12 ms 4044 KB Output is correct
8 Correct 18 ms 4136 KB Output is correct
9 Correct 9 ms 3896 KB Output is correct
10 Correct 9 ms 4144 KB Output is correct
11 Correct 12 ms 3480 KB Output is correct
12 Correct 11 ms 3780 KB Output is correct
13 Correct 14 ms 3760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3532 KB Output is correct
2 Correct 6 ms 3772 KB Output is correct
3 Correct 8 ms 3444 KB Output is correct
4 Correct 8 ms 4108 KB Output is correct
5 Correct 8 ms 3960 KB Output is correct
6 Correct 8 ms 3804 KB Output is correct
7 Correct 12 ms 4044 KB Output is correct
8 Correct 18 ms 4136 KB Output is correct
9 Correct 9 ms 3896 KB Output is correct
10 Correct 9 ms 4144 KB Output is correct
11 Correct 12 ms 3480 KB Output is correct
12 Correct 11 ms 3780 KB Output is correct
13 Correct 14 ms 3760 KB Output is correct
14 Incorrect 2 ms 600 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3532 KB Output is correct
2 Correct 6 ms 3772 KB Output is correct
3 Correct 8 ms 3444 KB Output is correct
4 Correct 8 ms 4108 KB Output is correct
5 Correct 8 ms 3960 KB Output is correct
6 Correct 8 ms 3804 KB Output is correct
7 Correct 12 ms 4044 KB Output is correct
8 Correct 18 ms 4136 KB Output is correct
9 Correct 9 ms 3896 KB Output is correct
10 Correct 9 ms 4144 KB Output is correct
11 Correct 12 ms 3480 KB Output is correct
12 Correct 11 ms 3780 KB Output is correct
13 Correct 14 ms 3760 KB Output is correct
14 Incorrect 2 ms 600 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3532 KB Output is correct
2 Correct 6 ms 3772 KB Output is correct
3 Correct 8 ms 3444 KB Output is correct
4 Correct 8 ms 4108 KB Output is correct
5 Correct 8 ms 3960 KB Output is correct
6 Correct 8 ms 3804 KB Output is correct
7 Correct 12 ms 4044 KB Output is correct
8 Correct 18 ms 4136 KB Output is correct
9 Correct 9 ms 3896 KB Output is correct
10 Correct 9 ms 4144 KB Output is correct
11 Correct 12 ms 3480 KB Output is correct
12 Correct 11 ms 3780 KB Output is correct
13 Correct 14 ms 3760 KB Output is correct
14 Incorrect 2 ms 600 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3532 KB Output is correct
2 Correct 6 ms 3772 KB Output is correct
3 Correct 8 ms 3444 KB Output is correct
4 Correct 8 ms 4108 KB Output is correct
5 Correct 8 ms 3960 KB Output is correct
6 Correct 8 ms 3804 KB Output is correct
7 Correct 12 ms 4044 KB Output is correct
8 Correct 18 ms 4136 KB Output is correct
9 Correct 9 ms 3896 KB Output is correct
10 Correct 9 ms 4144 KB Output is correct
11 Correct 12 ms 3480 KB Output is correct
12 Correct 11 ms 3780 KB Output is correct
13 Correct 14 ms 3760 KB Output is correct
14 Incorrect 2 ms 600 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3532 KB Output is correct
2 Correct 6 ms 3772 KB Output is correct
3 Correct 8 ms 3444 KB Output is correct
4 Correct 8 ms 4108 KB Output is correct
5 Correct 8 ms 3960 KB Output is correct
6 Correct 8 ms 3804 KB Output is correct
7 Correct 12 ms 4044 KB Output is correct
8 Correct 18 ms 4136 KB Output is correct
9 Correct 9 ms 3896 KB Output is correct
10 Correct 9 ms 4144 KB Output is correct
11 Correct 12 ms 3480 KB Output is correct
12 Correct 11 ms 3780 KB Output is correct
13 Correct 14 ms 3760 KB Output is correct
14 Incorrect 2 ms 600 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3532 KB Output is correct
2 Correct 6 ms 3772 KB Output is correct
3 Correct 8 ms 3444 KB Output is correct
4 Correct 8 ms 4108 KB Output is correct
5 Correct 8 ms 3960 KB Output is correct
6 Correct 8 ms 3804 KB Output is correct
7 Correct 12 ms 4044 KB Output is correct
8 Correct 18 ms 4136 KB Output is correct
9 Correct 9 ms 3896 KB Output is correct
10 Correct 9 ms 4144 KB Output is correct
11 Correct 12 ms 3480 KB Output is correct
12 Correct 11 ms 3780 KB Output is correct
13 Correct 14 ms 3760 KB Output is correct
14 Incorrect 2 ms 600 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3532 KB Output is correct
2 Correct 6 ms 3772 KB Output is correct
3 Correct 8 ms 3444 KB Output is correct
4 Correct 8 ms 4108 KB Output is correct
5 Correct 8 ms 3960 KB Output is correct
6 Correct 8 ms 3804 KB Output is correct
7 Correct 12 ms 4044 KB Output is correct
8 Correct 18 ms 4136 KB Output is correct
9 Correct 9 ms 3896 KB Output is correct
10 Correct 9 ms 4144 KB Output is correct
11 Correct 12 ms 3480 KB Output is correct
12 Correct 11 ms 3780 KB Output is correct
13 Correct 14 ms 3760 KB Output is correct
14 Incorrect 2 ms 600 KB Incorrect
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 3532 KB Output is correct
2 Correct 6 ms 3772 KB Output is correct
3 Correct 8 ms 3444 KB Output is correct
4 Correct 8 ms 4108 KB Output is correct
5 Correct 8 ms 3960 KB Output is correct
6 Correct 8 ms 3804 KB Output is correct
7 Correct 12 ms 4044 KB Output is correct
8 Correct 18 ms 4136 KB Output is correct
9 Correct 9 ms 3896 KB Output is correct
10 Correct 9 ms 4144 KB Output is correct
11 Correct 12 ms 3480 KB Output is correct
12 Correct 11 ms 3780 KB Output is correct
13 Correct 14 ms 3760 KB Output is correct
14 Incorrect 2 ms 600 KB Incorrect
15 Halted 0 ms 0 KB -