이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
typedef long double ld;
typedef pair<int, pair<int, int>> ft;
const ld PI = acos(-1);
const int maxn = 3e3+5;
const ll inf = 1e18;
const int mod = 998244353;
int n, m;
ll ans = 0, mx = -inf;
char board[maxn][maxn];
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++)cin >> board[i][j];
}
int ans = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(j+2 < m && board[i][j] == 'R' && board[i][j+1] == 'G' && board[i][j+2] == 'W'){
ans++;
board[i][j] = '.';
board[i][j+1] = '.';
board[i][j+2] = '.';
}
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(i+2 < n && board[i][j] == 'R' && board[i+1][j] == 'G' && board[i+2][j] == 'W'){
ans++;
board[i][j] = '.';
board[i+1][j] = '.';
board[i+2][j] = '.';
}
}
}
cout << ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |