답안 #1113762

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113762 2024-11-17T11:14:35 Z Dan4Life Dango Maker (JOI18_dango_maker) C++17
13 / 100
1 ms 368 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N = (int)3e3+2;
int n, m;
string s[N];

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	for(int i = 0; i < n; i++) cin >> s[i];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			if(s[i][j]!='R') continue;
			bool ok1 = 0, ok2 = 0;
			if(j+2<m and s[i][j+1]=='G' and s[i][j+2]=='W') ok1=1;
			if(i+2<n and s[i+1][j]=='G' and s[i+2][j]=='W') ok2=1;
			s[i][j] = ok2*2+ok1;
		}
	}
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++)
			if(s[i][j]=='G' or s[i][j]=='W') s[i][j]=0;
	int ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			if(!s[i][j]) continue;
			if(s[i][j]=='#') continue;
			int choice = 0;
			if(s[i][j]==1){
				if(s[i][j+1]!='#' and s[i][j+2]!='#') choice=1;
			}
			else if(s[i][j]==2){
				if(s[i+1][j]!='#' and s[i+2][j]!='#') choice=2;
			}
			else{
				if(s[i][j+1]!='#' and s[i][j+2]!='#') choice=1;
				else if(s[i+1][j]!='#' and s[i+2][j]!='#') choice=2;
				else{
					
				}
			}
			
			if(choice==1){
				s[i][j]=s[i][j+1]=s[i][j+2]='#';
				ans++;
			}
			else if(choice==2){
				s[i][j]=s[i+1][j]=s[i+2][j]='#';
				ans++;
			}
			else s[i][j]=0;
		}
	}
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 368 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 368 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Incorrect 1 ms 336 KB Output isn't correct
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 368 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Incorrect 1 ms 336 KB Output isn't correct
23 Halted 0 ms 0 KB -