답안 #1115356

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1115356 2024-11-20T11:20:01 Z staszic_ojuz Dango Maker (JOI18_dango_maker) C++17
13 / 100
2 ms 6676 KB
#include <iostream>

using namespace std;

const int MAXN = 3001;

int n, m;

char tablica[MAXN][MAXN];

bool moze_poziomo[MAXN][MAXN];
bool moze_pionowo_w_dol[MAXN][MAXN];

bool uzyte[MAXN][MAXN];

int wynik = 0;

void sprawdz(int y, int x) {
	if (((x+2) < m) && tablica[y][x] == 'R' && tablica[y][x + 1] == 'G' && tablica[y][x + 2] == 'W') {
		moze_poziomo[y][x] = true;
	}
	if (((y + 2) < n) && tablica[y][x] == 'R' && tablica[y + 1][x] == 'G' && tablica[y + 2][x] == 'W') {
		moze_pionowo_w_dol[y][x] = true;
	}
}

void zrob(int y, int x) {
	if (moze_poziomo[y][x] &&  (!uzyte[y][x + 1]) && (!uzyte[y][x + 2])) {
		wynik++;
		uzyte[y][x] = uzyte[y][x + 2] = uzyte[y][x + 1] = true;
		return;
	}
	if (moze_pionowo_w_dol[y][x]) {
		wynik++;
		uzyte[y][x] = uzyte[y + 1][x] = uzyte[y + 2][x] = true;
		return;
	}
	if ((moze_poziomo[y][x] && (uzyte[y][x + 1]) && (!uzyte[y][x + 2])) || (moze_poziomo[y][x] && uzyte[y][x + 1] && uzyte[y][x + 2] && moze_poziomo[y - 1][x + 1] && (!uzyte[y -1][x + 3]))) {
		uzyte[y + 1][x + 1] = false;
		uzyte[y][x] = uzyte[y][x + 1] = uzyte[y][x + 2] = true;
		return;
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	
	for (int i = 0; n > i; i++) {
		for (int j = 0; m > j; j++) {
			cin >> tablica[i][j];
		}
	}
	
	for (int i = 0; n > i; i++) {
		for (int j = 0; m > j; j++) {
			sprawdz(i, j);
		}
	}
	
	for (int i = 0; n > i; i++) {
		for (int j = 0; m > j; j++) {
			zrob(i, j);
		}
	}
	cout << wynik;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 2 ms 6648 KB Output is correct
7 Correct 1 ms 6480 KB Output is correct
8 Correct 1 ms 6480 KB Output is correct
9 Correct 2 ms 6652 KB Output is correct
10 Correct 1 ms 4432 KB Output is correct
11 Correct 1 ms 6480 KB Output is correct
12 Correct 1 ms 6480 KB Output is correct
13 Correct 1 ms 6480 KB Output is correct
14 Correct 1 ms 4432 KB Output is correct
15 Correct 1 ms 4432 KB Output is correct
16 Correct 1 ms 4432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 2 ms 6648 KB Output is correct
7 Correct 1 ms 6480 KB Output is correct
8 Correct 1 ms 6480 KB Output is correct
9 Correct 2 ms 6652 KB Output is correct
10 Correct 1 ms 4432 KB Output is correct
11 Correct 1 ms 6480 KB Output is correct
12 Correct 1 ms 6480 KB Output is correct
13 Correct 1 ms 6480 KB Output is correct
14 Correct 1 ms 4432 KB Output is correct
15 Correct 1 ms 4432 KB Output is correct
16 Correct 1 ms 4432 KB Output is correct
17 Correct 2 ms 6480 KB Output is correct
18 Correct 1 ms 6480 KB Output is correct
19 Correct 2 ms 6480 KB Output is correct
20 Correct 2 ms 6648 KB Output is correct
21 Correct 2 ms 6480 KB Output is correct
22 Correct 1 ms 6480 KB Output is correct
23 Correct 2 ms 6676 KB Output is correct
24 Correct 1 ms 4432 KB Output is correct
25 Correct 1 ms 2384 KB Output is correct
26 Correct 1 ms 2384 KB Output is correct
27 Correct 1 ms 6648 KB Output is correct
28 Correct 2 ms 6480 KB Output is correct
29 Correct 2 ms 6480 KB Output is correct
30 Correct 1 ms 4600 KB Output is correct
31 Correct 1 ms 4432 KB Output is correct
32 Correct 1 ms 4432 KB Output is correct
33 Correct 2 ms 6480 KB Output is correct
34 Incorrect 2 ms 6480 KB Output isn't correct
35 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 2 ms 6648 KB Output is correct
7 Correct 1 ms 6480 KB Output is correct
8 Correct 1 ms 6480 KB Output is correct
9 Correct 2 ms 6652 KB Output is correct
10 Correct 1 ms 4432 KB Output is correct
11 Correct 1 ms 6480 KB Output is correct
12 Correct 1 ms 6480 KB Output is correct
13 Correct 1 ms 6480 KB Output is correct
14 Correct 1 ms 4432 KB Output is correct
15 Correct 1 ms 4432 KB Output is correct
16 Correct 1 ms 4432 KB Output is correct
17 Correct 2 ms 6480 KB Output is correct
18 Correct 1 ms 6480 KB Output is correct
19 Correct 2 ms 6480 KB Output is correct
20 Correct 2 ms 6648 KB Output is correct
21 Correct 2 ms 6480 KB Output is correct
22 Correct 1 ms 6480 KB Output is correct
23 Correct 2 ms 6676 KB Output is correct
24 Correct 1 ms 4432 KB Output is correct
25 Correct 1 ms 2384 KB Output is correct
26 Correct 1 ms 2384 KB Output is correct
27 Correct 1 ms 6648 KB Output is correct
28 Correct 2 ms 6480 KB Output is correct
29 Correct 2 ms 6480 KB Output is correct
30 Correct 1 ms 4600 KB Output is correct
31 Correct 1 ms 4432 KB Output is correct
32 Correct 1 ms 4432 KB Output is correct
33 Correct 2 ms 6480 KB Output is correct
34 Incorrect 2 ms 6480 KB Output isn't correct
35 Halted 0 ms 0 KB -