답안 #972906

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
972906 2024-05-01T10:11:01 Z vjudge1 화성 (APIO22_mars) C++17
14 / 100
10 ms 4324 KB
#include "mars.h"
#include <bits/stdc++.h>

using namespace std;

#define scd(t) scanf("%d", &t)
#define sclld(t) scanf("%lld", &t)
#define forr(i, j, k) for (int i = j; i < k; i++)
#define frange(i, j) forr(i, 0, j)
#define all(cont) cont.begin(), cont.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long long int lli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<lli> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long double ld;

int pos(int i, int j, int n) {
	int x = 2*n+1;
	return i*x+j;
}

std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n)
{
	string out;
	frange(i, 100) out += '0';
	if(k == 0) {
		vvi val(3, vi(3));
		forr(r, 0, 3) {
			forr(c, 0, 3) {
				if(int(a[r][c][0] - '0')) {
					out[pos(i+r, j+c, n)] = '1';
				}
			}
		}
		// return out;
	}
	else {
		frange(r, 3) {
			frange(c, 3) {
				frange(l, 100) {
					if(out[l] == '1' || a[r][c][l] == '1') {
						out[l] = '1';
					}
				}
			}
		}
	}
	if(k == n-1) {
		int x = 2*n+1;
		vvi grid(2*n+1, vi(2*n+1));
		frange(l, 100) {
			if(out[l] == '1') {
				grid[l/x][l%x] = 1;
			}
		}

		// frange(i, x) {
		// 	frange(j, x) {
		// 		printf("%d ", grid[i][j]);
		// 	}
		// 	printf("\n");
		// }
		
		vector<vb> vis(x, vb(x));
		int c = 0;
		frange(i, x) {
			frange(j, x) {
				if(!vis[i][j] && grid[i][j]) {
					c++;
					stack<pii> stk;
					stk.push(mp(i, j));
					while(stk.size()) {
						auto p = stk.top();
						stk.pop();
						if(p.f < 0 || p.f >= x || p.s < 0 || p.s >= x || !grid[p.f][p.s] || vis[p.f][p.s]) continue;
						vis[p.f][p.s] = true;
						stk.push(mp(p.f+1, p.s));
						stk.push(mp(p.f-1, p.s));
						stk.push(mp(p.f, p.s+1));
						stk.push(mp(p.f, p.s-1));
					}
				}

			}
		}
		out = "";
		frange(i, 100) out += '0';
		frange(i, 20) {
			if(c&(1<<i)) out[i] = '1';
		}
	}



	return out;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3884 KB Output is correct
2 Correct 6 ms 4116 KB Output is correct
3 Correct 7 ms 3868 KB Output is correct
4 Correct 4 ms 3804 KB Output is correct
5 Correct 6 ms 3608 KB Output is correct
6 Correct 2 ms 3736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3884 KB Output is correct
2 Correct 6 ms 4116 KB Output is correct
3 Correct 7 ms 3868 KB Output is correct
4 Correct 4 ms 3804 KB Output is correct
5 Correct 6 ms 3608 KB Output is correct
6 Correct 2 ms 3736 KB Output is correct
7 Correct 8 ms 3600 KB Output is correct
8 Correct 9 ms 3944 KB Output is correct
9 Correct 9 ms 4324 KB Output is correct
10 Correct 8 ms 3952 KB Output is correct
11 Correct 10 ms 3796 KB Output is correct
12 Correct 10 ms 4132 KB Output is correct
13 Correct 8 ms 3772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3884 KB Output is correct
2 Correct 6 ms 4116 KB Output is correct
3 Correct 7 ms 3868 KB Output is correct
4 Correct 4 ms 3804 KB Output is correct
5 Correct 6 ms 3608 KB Output is correct
6 Correct 2 ms 3736 KB Output is correct
7 Correct 8 ms 3600 KB Output is correct
8 Correct 9 ms 3944 KB Output is correct
9 Correct 9 ms 4324 KB Output is correct
10 Correct 8 ms 3952 KB Output is correct
11 Correct 10 ms 3796 KB Output is correct
12 Correct 10 ms 4132 KB Output is correct
13 Correct 8 ms 3772 KB Output is correct
14 Runtime error 1 ms 440 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3884 KB Output is correct
2 Correct 6 ms 4116 KB Output is correct
3 Correct 7 ms 3868 KB Output is correct
4 Correct 4 ms 3804 KB Output is correct
5 Correct 6 ms 3608 KB Output is correct
6 Correct 2 ms 3736 KB Output is correct
7 Correct 8 ms 3600 KB Output is correct
8 Correct 9 ms 3944 KB Output is correct
9 Correct 9 ms 4324 KB Output is correct
10 Correct 8 ms 3952 KB Output is correct
11 Correct 10 ms 3796 KB Output is correct
12 Correct 10 ms 4132 KB Output is correct
13 Correct 8 ms 3772 KB Output is correct
14 Runtime error 1 ms 440 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3884 KB Output is correct
2 Correct 6 ms 4116 KB Output is correct
3 Correct 7 ms 3868 KB Output is correct
4 Correct 4 ms 3804 KB Output is correct
5 Correct 6 ms 3608 KB Output is correct
6 Correct 2 ms 3736 KB Output is correct
7 Correct 8 ms 3600 KB Output is correct
8 Correct 9 ms 3944 KB Output is correct
9 Correct 9 ms 4324 KB Output is correct
10 Correct 8 ms 3952 KB Output is correct
11 Correct 10 ms 3796 KB Output is correct
12 Correct 10 ms 4132 KB Output is correct
13 Correct 8 ms 3772 KB Output is correct
14 Runtime error 1 ms 440 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3884 KB Output is correct
2 Correct 6 ms 4116 KB Output is correct
3 Correct 7 ms 3868 KB Output is correct
4 Correct 4 ms 3804 KB Output is correct
5 Correct 6 ms 3608 KB Output is correct
6 Correct 2 ms 3736 KB Output is correct
7 Correct 8 ms 3600 KB Output is correct
8 Correct 9 ms 3944 KB Output is correct
9 Correct 9 ms 4324 KB Output is correct
10 Correct 8 ms 3952 KB Output is correct
11 Correct 10 ms 3796 KB Output is correct
12 Correct 10 ms 4132 KB Output is correct
13 Correct 8 ms 3772 KB Output is correct
14 Runtime error 1 ms 440 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3884 KB Output is correct
2 Correct 6 ms 4116 KB Output is correct
3 Correct 7 ms 3868 KB Output is correct
4 Correct 4 ms 3804 KB Output is correct
5 Correct 6 ms 3608 KB Output is correct
6 Correct 2 ms 3736 KB Output is correct
7 Correct 8 ms 3600 KB Output is correct
8 Correct 9 ms 3944 KB Output is correct
9 Correct 9 ms 4324 KB Output is correct
10 Correct 8 ms 3952 KB Output is correct
11 Correct 10 ms 3796 KB Output is correct
12 Correct 10 ms 4132 KB Output is correct
13 Correct 8 ms 3772 KB Output is correct
14 Runtime error 1 ms 440 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3884 KB Output is correct
2 Correct 6 ms 4116 KB Output is correct
3 Correct 7 ms 3868 KB Output is correct
4 Correct 4 ms 3804 KB Output is correct
5 Correct 6 ms 3608 KB Output is correct
6 Correct 2 ms 3736 KB Output is correct
7 Correct 8 ms 3600 KB Output is correct
8 Correct 9 ms 3944 KB Output is correct
9 Correct 9 ms 4324 KB Output is correct
10 Correct 8 ms 3952 KB Output is correct
11 Correct 10 ms 3796 KB Output is correct
12 Correct 10 ms 4132 KB Output is correct
13 Correct 8 ms 3772 KB Output is correct
14 Runtime error 1 ms 440 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3884 KB Output is correct
2 Correct 6 ms 4116 KB Output is correct
3 Correct 7 ms 3868 KB Output is correct
4 Correct 4 ms 3804 KB Output is correct
5 Correct 6 ms 3608 KB Output is correct
6 Correct 2 ms 3736 KB Output is correct
7 Correct 8 ms 3600 KB Output is correct
8 Correct 9 ms 3944 KB Output is correct
9 Correct 9 ms 4324 KB Output is correct
10 Correct 8 ms 3952 KB Output is correct
11 Correct 10 ms 3796 KB Output is correct
12 Correct 10 ms 4132 KB Output is correct
13 Correct 8 ms 3772 KB Output is correct
14 Runtime error 1 ms 440 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3884 KB Output is correct
2 Correct 6 ms 4116 KB Output is correct
3 Correct 7 ms 3868 KB Output is correct
4 Correct 4 ms 3804 KB Output is correct
5 Correct 6 ms 3608 KB Output is correct
6 Correct 2 ms 3736 KB Output is correct
7 Correct 8 ms 3600 KB Output is correct
8 Correct 9 ms 3944 KB Output is correct
9 Correct 9 ms 4324 KB Output is correct
10 Correct 8 ms 3952 KB Output is correct
11 Correct 10 ms 3796 KB Output is correct
12 Correct 10 ms 4132 KB Output is correct
13 Correct 8 ms 3772 KB Output is correct
14 Runtime error 1 ms 440 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -