답안 #57260

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
57260 2018-07-14T12:20:19 Z fredbr 무지개나라 (APIO17_rainbow) C++17
11 / 100
22 ms 5308 KB
#include <bits/stdc++.h>
#include "rainbow.h"

using namespace std;

const int maxn = 110;

int r, c;
char riv[maxn][maxn];
char vis[maxn][maxn];

void init(int rr, int cc, int sr, int sc, int m, char* s)
{
	r = rr, c = cc;

	int x = sr, y = sc;
	riv[x][y] = 1;
	for (int i = 0; i < m; i++) {

		if (s[i] == 'N') x--;
		else if (s[i] == 'E') y++;
		else if (s[i] == 'S') x++;
		else y--;
		riv[x][y] = 1;
	}

	// for (int i = 1; i <= rr; i++) {
	// 	for (int j = 1; j <= cc; j++)
	// 		cout << int(riv[i][j]);
	// 	cout << "\n";
	// }
}

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

void dfs(int x, int y, int x1, int y1, int x2, int y2)
{
	vis[x][y] = 1;
	for (int i = 0; i < 4; i++) {

		int xx = x+dx[i];
		int yy = y+dy[i];
		if (xx < x1 or xx > x2 or yy < y1 or yy > y2) continue;
		if (riv[xx][yy] or vis[xx][yy]) continue;
		dfs(xx, yy, x1, y1, x2, y2);
	}
}

int colour(int x1, int y1, int x2, int y2)
{
	int ans = 0;
	memset(vis, 0, sizeof(vis));
	for (int i = x1; i <= x2; i++)
		for (int j = y1; j <= y2; j++)
			if (!riv[i][j] and !vis[i][j])
				dfs(i, j, x1, y1, x2, y2), ans++;

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 248 KB Output is correct
2 Correct 8 ms 360 KB Output is correct
3 Correct 22 ms 752 KB Output is correct
4 Correct 19 ms 752 KB Output is correct
5 Correct 8 ms 752 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 3 ms 760 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 2 ms 760 KB Output is correct
11 Correct 19 ms 940 KB Output is correct
12 Correct 18 ms 940 KB Output is correct
13 Correct 12 ms 940 KB Output is correct
14 Correct 7 ms 940 KB Output is correct
15 Correct 3 ms 940 KB Output is correct
16 Correct 2 ms 940 KB Output is correct
17 Correct 2 ms 940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 940 KB Output is correct
2 Correct 2 ms 940 KB Output is correct
3 Runtime error 11 ms 5308 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 940 KB Output is correct
2 Runtime error 3 ms 5308 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 248 KB Output is correct
2 Correct 8 ms 360 KB Output is correct
3 Correct 22 ms 752 KB Output is correct
4 Correct 19 ms 752 KB Output is correct
5 Correct 8 ms 752 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 3 ms 760 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 2 ms 760 KB Output is correct
11 Correct 19 ms 940 KB Output is correct
12 Correct 18 ms 940 KB Output is correct
13 Correct 12 ms 940 KB Output is correct
14 Correct 7 ms 940 KB Output is correct
15 Correct 3 ms 940 KB Output is correct
16 Correct 2 ms 940 KB Output is correct
17 Correct 2 ms 940 KB Output is correct
18 Runtime error 4 ms 5308 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 248 KB Output is correct
2 Correct 8 ms 360 KB Output is correct
3 Correct 22 ms 752 KB Output is correct
4 Correct 19 ms 752 KB Output is correct
5 Correct 8 ms 752 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 3 ms 760 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 2 ms 760 KB Output is correct
11 Correct 19 ms 940 KB Output is correct
12 Correct 18 ms 940 KB Output is correct
13 Correct 12 ms 940 KB Output is correct
14 Correct 7 ms 940 KB Output is correct
15 Correct 3 ms 940 KB Output is correct
16 Correct 2 ms 940 KB Output is correct
17 Correct 2 ms 940 KB Output is correct
18 Runtime error 4 ms 5308 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Halted 0 ms 0 KB -