답안 #951760

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
951760 2024-03-22T13:58:43 Z Lobo Security Guard (JOI23_guard) C++17
컴파일 오류
0 ms 0 KB
#include "Anna.h"
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back

void Anna(int X, int Y, int N, std::string S) {
	int a[8][8];
	memset(a,-1,sizeof(a));
	set<pair<int,int>> used;
	for(int i = 0; i <= 4; i++) {
		int j = i;
		if(i != X && j != Y) {
			a[i][j] = (((1<<0)&X) != 0); used.insert(mp(i,j));
		}
		j++;
		if(i != X && j != Y) {
			a[i][j] = (((1<<1)&X) != 0); used.insert(mp(i,j));
		}
		j++;
		if(i != X && j != Y) {
			a[i][j] = (((1<<2)&X) != 0); used.insert(mp(i,j));
		}
		j++;
	}

	if(X > 2) {
		a[0][5] = a[0][6] = a[0][7] = (((1<<0)&Y) != 0); 
		used.insert(mp(0,5)); used.insert(mp(0,6)); used.insert(mp(0,7));
		a[1][5] = a[1][6] = a[1][7] = (((1<<1)&Y) != 0); 
		used.insert(mp(1,5)); used.insert(mp(1,6)); used.insert(mp(1,7));
		a[2][5] = a[2][6] = a[2][7] = (((1<<2)&Y) != 0); 
		used.insert(mp(2,5)); used.insert(mp(2,6)); used.insert(mp(2,7));
	}
	else {

		a[5][0] = a[5][1] = a[5][2] = (((1<<0)&Y) != 0); 
		used.insert(mp(5,0)); used.insert(mp(5,1)); used.insert(mp(5,2));
		a[6][0] = a[6][1] = a[6][2] = (((1<<1)&Y) != 0); 
		used.insert(mp(6,0)); used.insert(mp(6,1)); used.insert(mp(6,2));
		a[7][0] = a[7][1] = a[7][2] = (((1<<2)&Y) != 0); 
		used.insert(mp(7,0)); used.insert(mp(7,1)); used.insert(mp(7,2));
	}

	int id = 0;
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			if (i != X && j != Y && a[i][j] == -1 && id < N) {
				a[i][j] = S[id]-'A';
				id++;
			}
		}
	}
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			if (i != X && j != Y) {
				if(a[i][j] == -1) a[i][j] = 0;
				// cout << a[i][j];
				Paint(i, j, a[i][j]);
			}
			else {
				// cout << "-";
			}
		}
		// cout << endl;
	}
}

std::string Bruno(int N, std::vector<std::vector<int>> a) {
	int q0 = 0;
	int q1 = 0;
	int q2 = 0;
	set<pair<int,int>> used;
	for(int i = 0; i <= 4; i++) {
		int j = i;
		q0+= a[i][j]; used.insert(mp(i,j));
		j++;
		q1+= a[i][j]; used.insert(mp(i,j));
		j++;
		q2+= a[i][j]; used.insert(mp(i,j));
		j++;
	}

	int X = 0;
	if(q0 >= 3) X+= (1<<0);
	if(q1 >= 3) X+= (1<<1);
	if(q2 >= 3) X+= (1<<2);

	int Y = 0;
	q0 = q1 = q2 = 0;
	if(X > 2) {
		if(a[0][5] + a[0][6] + a[0][7] >= 2) Y+=((1<<0));
		used.insert(mp(0,5)); used.insert(mp(0,6)); used.insert(mp(0,7));
		if(a[1][5] + a[1][6] + a[1][7] >= 2) Y+=((1<<1));
		used.insert(mp(1,5)); used.insert(mp(1,6)); used.insert(mp(1,7));
		if(a[2][5] + a[2][6] + a[2][7] >= 2) Y+=((1<<2));
		used.insert(mp(2,5)); used.insert(mp(2,6)); used.insert(mp(2,7));
	}
	else {
		if(a[5][0] + a[5][1] + a[5][2] >= 2) Y+=((1<<0));
		used.insert(mp(5,0)); used.insert(mp(5,1)); used.insert(mp(5,2));
		if(a[6][0] + a[6][1] + a[6][2] >= 2) Y+=((1<<1));
		used.insert(mp(6,0)); used.insert(mp(6,1)); used.insert(mp(6,2));
		if(a[7][0] + a[7][1] + a[7][2] >= 2) Y+=((1<<2));
		used.insert(mp(7,0)); used.insert(mp(7,1)); used.insert(mp(7,2));
	}

	string S;

	// cout << X << " " << Y << endl;

	int id = 0;
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			if (i != X && j != Y && id < N && used.count(mp(i,j)) == 0) {
				S.pb((char) ('A'+a[i][j]));
				id++;
			}
		}
	}

	return S;

	if (a[2][5] == 0) return "A";
	return "B";
}

Compilation message

guard.cpp:1:10: fatal error: Anna.h: No such file or directory
    1 | #include "Anna.h"
      |          ^~~~~~~~
compilation terminated.