제출 #898440

#제출 시각아이디문제언어결과실행 시간메모리
898440penguin133Dango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms2396 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

char A[3005][3005];
int used[3005][3005], n, m;

void solve(){
	cin >> n >> m;
	for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)cin >> A[i][j];
	int ans = 0;
	for(int i=1;i<=n;i++){
		for(int j=m;j>=1;j--){
			if(A[i][j] == 'G' || used[i][j])continue;
			if(A[i][j] == 'R'){
				if(i + 2 > n)continue;
				if(A[i+1][j] == 'G' && A[i+2][j] == 'W')used[i+1][j] = used[i][j] = used[i+2][j] = 1, ans++;
			}
			else{
				if(j <= 2)continue;
				if(A[i][j-1] == 'G' && A[i][j-2] == 'R')used[i][j-2] = used[i][j-1] = used[i][j] = 1, ans++;
			}
		}
	}
	cout << ans;
}

main(){
	ios::sync_with_stdio(0);cin.tie(0);
	int tc = 1;
	//cin >> tc;
	for(int tc1=1;tc1<=tc;tc1++){
		// cout << "Case #" << tc1 << ": ";
		solve();
	}
}

컴파일 시 표준 에러 (stderr) 메시지

dango_maker.cpp:37:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   37 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...