Submission #135166

# Submission time Handle Problem Language Result Execution time Memory
135166 2019-07-23T17:43:18 Z duality Dango Maker (JOI18_dango_maker) C++11
100 / 100
719 ms 18168 KB
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef long long int LLI;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

char grid[3000][3000];
int main() {
    int i,j;
    int N,M;
    scanf("%d %d",&N,&M);
    for (i = 0; i < N; i++) {
        for (j = 0; j < M; j++) scanf(" %c",&grid[i][j]);
    }

    int ans = 0;
    for (i = 0; i < N+M-1; i++) {
        vi h,v;
        for (j = 0; j < N; j++) {
            int x = i-j,y = j;
            if ((x >= 0) && (x+2 < M) && (grid[y][x] == 'R') && (grid[y][x+1] == 'G') && (grid[y][x+2] == 'W')) h.pb(j);
            if ((x >= 0) && (x < M) && (y+2 < N) && (grid[y][x] == 'R') && (grid[y+1][x] == 'G') && (grid[y+2][x] == 'W')) v.pb(j);
        }
        ans += h.size()+v.size();
        int k = 0;
        for (j = 0; j < h.size(); j++) {
            while ((k < v.size()) && (v[k] < h[j]-2)) k++;
            if ((k < v.size()) && (v[k] <= h[j])) k++,ans--;
        }
    }
    printf("%d\n",ans);

    return 0;
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:29:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (j = 0; j < h.size(); j++) {
                     ~~^~~~~~~~~~
dango_maker.cpp:30:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             while ((k < v.size()) && (v[k] < h[j]-2)) k++;
                     ~~^~~~~~~~~~
dango_maker.cpp:31:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if ((k < v.size()) && (v[k] <= h[j])) k++,ans--;
                  ~~^~~~~~~~~~
dango_maker.cpp:14: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:16:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         for (j = 0; j < M; j++) scanf(" %c",&grid[i][j]);
                                 ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 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 2 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 376 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
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 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 2 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 376 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 364 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 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 504 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 248 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 2 ms 376 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 504 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 2 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 2 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
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 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 2 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 376 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 364 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 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 504 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 248 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 376 KB Output is correct
37 Correct 2 ms 376 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 504 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 2 ms 376 KB Output is correct
49 Correct 2 ms 376 KB Output is correct
50 Correct 2 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 3 ms 376 KB Output is correct
55 Correct 33 ms 9212 KB Output is correct
56 Correct 4 ms 376 KB Output is correct
57 Correct 19 ms 6264 KB Output is correct
58 Correct 81 ms 4344 KB Output is correct
59 Correct 719 ms 18044 KB Output is correct
60 Correct 705 ms 18100 KB Output is correct
61 Correct 702 ms 18104 KB Output is correct
62 Correct 2 ms 376 KB Output is correct
63 Correct 685 ms 17908 KB Output is correct
64 Correct 639 ms 18084 KB Output is correct
65 Correct 645 ms 18124 KB Output is correct
66 Correct 636 ms 18040 KB Output is correct
67 Correct 634 ms 18168 KB Output is correct
68 Correct 637 ms 17984 KB Output is correct
69 Correct 648 ms 18032 KB Output is correct
70 Correct 74 ms 4216 KB Output is correct
71 Correct 77 ms 4216 KB Output is correct
72 Correct 73 ms 4188 KB Output is correct
73 Correct 87 ms 4216 KB Output is correct
74 Correct 73 ms 4216 KB Output is correct
75 Correct 77 ms 4228 KB Output is correct
76 Correct 76 ms 4248 KB Output is correct
77 Correct 78 ms 4216 KB Output is correct
78 Correct 73 ms 4216 KB Output is correct
79 Correct 73 ms 4164 KB Output is correct
80 Correct 74 ms 4316 KB Output is correct
81 Correct 74 ms 4216 KB Output is correct
82 Correct 73 ms 4172 KB Output is correct
83 Correct 73 ms 4472 KB Output is correct
84 Correct 73 ms 4344 KB Output is correct
85 Correct 74 ms 4216 KB Output is correct
86 Correct 77 ms 4216 KB Output is correct
87 Correct 76 ms 4216 KB Output is correct
88 Correct 78 ms 4216 KB Output is correct
89 Correct 73 ms 4216 KB Output is correct
90 Correct 75 ms 4316 KB Output is correct