| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1341707 | Nipphitch | Dango Maker (JOI18_dango_maker) | C++20 | 2092 ms | 460 KiB |
#include <bits/stdc++.h>
using namespace std;
const int N=3005;
int n,m,ans;
bool b[N][N];
char c[N][N];
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> c[i][j];
for(int o=0;o<(1<<(n*m));o++){
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if((o>>(i*m+j))&1){
b[i][j]=true;
}
else b[i][j]=false;
}
}
int cnt=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(i>=2){
if(b[i][j] && b[i-1][j] && b[i-2][j]){
if(c[i][j]=='W' && c[i-1][j]=='G' && c[i-2][j]=='R'){
cnt++;
b[i][j]=b[i-1][j]=b[i-2][j]=false;
}
}
}
if(j>=2){
if(b[i][j] && b[i][j-1] && b[i][j-2]){
if(c[i][j]=='W' && c[i][j-1]=='G' && c[i][j-2]=='R'){
cnt++;
b[i][j]=b[i][j-1]=b[i][j-2]=false;
}
}
}
}
}
ans=max(ans,cnt);
}
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... | ||||
