# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
108783 | 2019-05-02T00:44:16 Z | thebes | Dango Maker (JOI18_dango_maker) | C++14 | 3 ms | 428 KB |
#include <bits/stdc++.h> using namespace std; const int MN = 3005; int a[MN][MN], n, m, i, j, ans; int main(){ for(scanf("%d%d",&n,&m),i=1;i<=n;i++){ for(getchar(),j=1;j<=m;j++){ char ch = getchar(); if(ch=='G') a[i][j]=1; else if(ch=='W') a[i][j]=2; } } for(i=1;i<=n;i++){ for(j=1;j<=m;j++){ if(j+2<=m){ if(a[i][j]==0&&a[i][j+1]==1&&a[i][j+2]==2){ ans++; a[i][j]=a[i][j+1]=a[i][j+2]=-1; } } if(i+2<=n){ if(a[i][j]==0&&a[i+1][j]==1&&a[i+2][j]==2){ ans++; a[i][j]=a[i+1][j]=a[i+2][j]=-1; } } } } int tmp = ans; ans = 0; for(j=1;j<=m;j++){ for(i=1;i<=n;i++){ if(i+2<=n){ if(a[i][j]==0&&a[i+1][j]==1&&a[i+2][j]==2){ ans++; a[i][j]=a[i+1][j]=a[i+2][j]=-1; } } if(j+2<=m){ if(a[i][j]==0&&a[i][j+1]==1&&a[i][j+2]==2){ ans++; a[i][j]=a[i][j+1]=a[i][j+2]=-1; } } } } printf("%d\n",max(ans,tmp)); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 256 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 256 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 384 KB | Output is correct |
20 | Correct | 2 ms | 428 KB | Output is correct |
21 | Correct | 3 ms | 384 KB | Output is correct |
22 | Incorrect | 2 ms | 384 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 2 ms | 384 KB | Output is correct |
12 | Correct | 2 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 256 KB | Output is correct |
16 | Correct | 2 ms | 384 KB | Output is correct |
17 | Correct | 2 ms | 384 KB | Output is correct |
18 | Correct | 2 ms | 384 KB | Output is correct |
19 | Correct | 2 ms | 384 KB | Output is correct |
20 | Correct | 2 ms | 428 KB | Output is correct |
21 | Correct | 3 ms | 384 KB | Output is correct |
22 | Incorrect | 2 ms | 384 KB | Output isn't correct |
23 | Halted | 0 ms | 0 KB | - |