답안 #153802

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153802 2019-09-16T13:44:39 Z mhy908 Dango Maker (JOI18_dango_maker) C++14
100 / 100
213 ms 9464 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define llinf 8987654321987654321
#define inf 1987654321
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
int n, m;
char str[3010][3010];
int dp[6010], arr[6010], ans;
int main()
{
    scanf("%d %d", &n, &m);
    for(int i=1; i<=n; i++)scanf("%s", str[i]+1);
    for(int i=2; i<=n+m; i++){
        memset(dp, 0, sizeof(dp));
        memset(arr, 0, sizeof(arr));
        for(int j=1; j<i; j++){
            dp[j]=dp[j-1];
            int x=i-j, y=j;
            if(x>n||y>m)continue;
            if(str[x][y]=='G'&&str[x-1][y]=='R'&&str[x+1][y]=='W')arr[j]+=1;
            if(str[x][y]=='G'&&str[x][y-1]=='R'&&str[x][y+1]=='W')arr[j]+=2;
            if(!arr[j-1]&&arr[j])dp[j]++;
            else if(arr[j]==3)dp[j]++;
            else if(arr[j]==1&&(arr[j-1]&1))dp[j]++;
            else if(arr[j]==2&&(arr[j-1]&2))dp[j]++;
            if(arr[j]==3&&arr[j-1]==1)arr[j]=1;
            if(arr[j]==3&&arr[j-1]==2)arr[j]=2;
            if(dp[j]==dp[j-1])arr[j]=0;
        }
        ans+=dp[i-1];
    }
    printf("%d", ans);
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
dango_maker.cpp:18:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1; i<=n; i++)scanf("%s", str[i]+1);
                            ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 380 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 400 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 2 ms 348 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 3 ms 376 KB Output is correct
35 Correct 3 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 3 ms 504 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 2 ms 376 KB Output is correct
40 Correct 2 ms 376 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 2 ms 376 KB Output is correct
43 Correct 2 ms 376 KB Output is correct
44 Correct 2 ms 376 KB Output is correct
45 Correct 2 ms 376 KB Output is correct
46 Correct 2 ms 376 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 3 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 10 ms 376 KB Output is correct
51 Correct 3 ms 376 KB Output is correct
52 Correct 2 ms 376 KB Output is correct
53 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 380 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 400 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 2 ms 348 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 3 ms 376 KB Output is correct
35 Correct 3 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 3 ms 504 KB Output is correct
38 Correct 2 ms 376 KB Output is correct
39 Correct 2 ms 376 KB Output is correct
40 Correct 2 ms 376 KB Output is correct
41 Correct 2 ms 376 KB Output is correct
42 Correct 2 ms 376 KB Output is correct
43 Correct 2 ms 376 KB Output is correct
44 Correct 2 ms 376 KB Output is correct
45 Correct 2 ms 376 KB Output is correct
46 Correct 2 ms 376 KB Output is correct
47 Correct 2 ms 376 KB Output is correct
48 Correct 3 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 10 ms 376 KB Output is correct
51 Correct 3 ms 376 KB Output is correct
52 Correct 2 ms 376 KB Output is correct
53 Correct 2 ms 376 KB Output is correct
54 Correct 18 ms 376 KB Output is correct
55 Correct 31 ms 9180 KB Output is correct
56 Correct 33 ms 504 KB Output is correct
57 Correct 18 ms 6264 KB Output is correct
58 Correct 28 ms 4216 KB Output is correct
59 Correct 201 ms 9456 KB Output is correct
60 Correct 200 ms 9464 KB Output is correct
61 Correct 213 ms 9416 KB Output is correct
62 Correct 16 ms 376 KB Output is correct
63 Correct 196 ms 9440 KB Output is correct
64 Correct 131 ms 9340 KB Output is correct
65 Correct 129 ms 9428 KB Output is correct
66 Correct 128 ms 9336 KB Output is correct
67 Correct 124 ms 9336 KB Output is correct
68 Correct 125 ms 9464 KB Output is correct
69 Correct 138 ms 9416 KB Output is correct
70 Correct 19 ms 4256 KB Output is correct
71 Correct 19 ms 4216 KB Output is correct
72 Correct 42 ms 4216 KB Output is correct
73 Correct 19 ms 4216 KB Output is correct
74 Correct 19 ms 4216 KB Output is correct
75 Correct 19 ms 4216 KB Output is correct
76 Correct 19 ms 4216 KB Output is correct
77 Correct 23 ms 4216 KB Output is correct
78 Correct 21 ms 4248 KB Output is correct
79 Correct 25 ms 4216 KB Output is correct
80 Correct 19 ms 4216 KB Output is correct
81 Correct 19 ms 4216 KB Output is correct
82 Correct 19 ms 4216 KB Output is correct
83 Correct 19 ms 4188 KB Output is correct
84 Correct 19 ms 4300 KB Output is correct
85 Correct 19 ms 4216 KB Output is correct
86 Correct 19 ms 4216 KB Output is correct
87 Correct 19 ms 4216 KB Output is correct
88 Correct 19 ms 4176 KB Output is correct
89 Correct 19 ms 4148 KB Output is correct
90 Correct 19 ms 4216 KB Output is correct