답안 #100603

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100603 2019-03-12T19:04:22 Z kraljlavova1 Konj (COCI19_konj) C++11
0 / 70
134 ms 10872 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
const int MAX = 3e2 + 10;
int n, idx;
int tx, ty;
int a, b, c, d;
int xmx, ymx, xmn = MAX, ymn = MAX;
int bio[MAX][MAX];
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
char P[MAX][MAX];
vector<int> duz[MAX][MAX];
void dfs(int x, int y){
	cout << x << " " << y << "\n";
	bio[x][y] = 1;
	for(int i = 0;i < 4; i++){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(nx < 0 || nx >= MAX) continue;
		if(ny < 0 || ny >= MAX) continue;
		if(bio[nx][ny]) continue;
		for(int p : duz[x][y]){
			for(int q : duz[nx][ny]){
				if(p == q){
					dfs(nx, ny);
					goto G;
				}
			}
		}
		G:;
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	cin >> n;
	while(n--){
		cin >> a >> b >> c >> d;
		if(a > c) swap(a, c);
		if(b > d) swap(b, d);
		for(int i = a;i <= c; i++){
			for(int j = b;j <= d; j++){
				duz[i][j].push_back(idx);
			}
		}idx++;
	}
	cin >> tx >> ty;
	dfs(tx, ty);
	for(int i = 0;i < MAX; i++){
		for(int j = 0;j < MAX; j++){
			if(!bio[i][j]) continue;
			xmx = max(xmx, i);
			xmn = min(xmn, i);
			ymx = max(ymx, j);
			ymn = min(ymn, j);
		}
	}
	for(int i = 0;i < MAX; i++){
		for(int j = 0;j < MAX; j++){
			if(bio[i][j]) P[i][j] = '#';
			else P[i][j] = '.';
		}
	}
	for(int j = ymx;j >= ymn; j--){
		for(int i = xmn;i <= xmx; i++){
			cout << P[i][j];
		}
		cout << "\n";
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 2816 KB Output isn't correct
2 Incorrect 5 ms 2816 KB Output isn't correct
3 Incorrect 134 ms 10872 KB Output isn't correct
4 Incorrect 4 ms 2816 KB Output isn't correct
5 Incorrect 4 ms 2816 KB Output isn't correct
6 Incorrect 4 ms 2688 KB Output isn't correct
7 Incorrect 4 ms 2688 KB Output isn't correct
8 Incorrect 4 ms 2816 KB Output isn't correct
9 Incorrect 4 ms 2688 KB Output isn't correct
10 Incorrect 5 ms 2816 KB Output isn't correct