Submission #995270

# Submission time Handle Problem Language Result Execution time Memory
995270 2024-06-08T17:53:18 Z gmroh06 Dango Maker (JOI18_dango_maker) C++14
100 / 100
105 ms 19056 KB
#include <bits/stdc++.h>

using ll = long long;

inline void fastio() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
}

ll n, m, ans;
std::string s[3030];
std::vector<ll> ver, hor;

int main() {
    fastio();

    std::cin >> n >> m;

    for (ll i = 0; i < n; i++) {
        std::cin >> s[i];
    }

    for (ll i = 0; i < n + m; i++) {
        ver = std::vector<ll>();
        hor = std::vector<ll>();

        for (ll j = 0; j < n; j++) {
            ll k = i - j;
            
            if (k < 0 or k >= m) continue;

            if (s[j][k] == 'R') {
                if (j < n - 2 and s[j + 1][k] == 'G' and s[j + 2][k] == 'W') {
                    ver.emplace_back(j);
                    ans++;
                }

                if (k < m - 2 and s[j][k + 1] == 'G' and s[j][k + 2] == 'W') {
                    hor.emplace_back(j);
                    ans++;
                }
            }
        }

        for (auto x = ver.begin(), y = hor.begin(); x < ver.end() and y < hor.end();) {
            if (*y - *x < 0) {
                y++;
            } else if (*y - *x > 2) {
                x++;
            } else {
                ans--;
                x++, y++;
            }
        }
    }

    std::cout << ans;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 556 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 552 KB Output is correct
20 Correct 1 ms 600 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 424 KB Output is correct
41 Correct 0 ms 408 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 0 ms 552 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 0 ms 344 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 0 ms 344 KB Output is correct
53 Correct 0 ms 548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 556 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 552 KB Output is correct
20 Correct 1 ms 600 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 424 KB Output is correct
41 Correct 0 ms 408 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 0 ms 552 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 0 ms 344 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 0 ms 344 KB Output is correct
53 Correct 0 ms 548 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 6 ms 348 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 2 ms 348 KB Output is correct
58 Correct 11 ms 2600 KB Output is correct
59 Correct 103 ms 19032 KB Output is correct
60 Correct 102 ms 19024 KB Output is correct
61 Correct 105 ms 19028 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 95 ms 18260 KB Output is correct
64 Correct 80 ms 19024 KB Output is correct
65 Correct 63 ms 19024 KB Output is correct
66 Correct 64 ms 19056 KB Output is correct
67 Correct 47 ms 19024 KB Output is correct
68 Correct 47 ms 18912 KB Output is correct
69 Correct 50 ms 18836 KB Output is correct
70 Correct 6 ms 2396 KB Output is correct
71 Correct 6 ms 2372 KB Output is correct
72 Correct 7 ms 2392 KB Output is correct
73 Correct 7 ms 2392 KB Output is correct
74 Correct 8 ms 2396 KB Output is correct
75 Correct 7 ms 2396 KB Output is correct
76 Correct 6 ms 2396 KB Output is correct
77 Correct 6 ms 2396 KB Output is correct
78 Correct 7 ms 2392 KB Output is correct
79 Correct 6 ms 2368 KB Output is correct
80 Correct 6 ms 2648 KB Output is correct
81 Correct 7 ms 2616 KB Output is correct
82 Correct 6 ms 2392 KB Output is correct
83 Correct 6 ms 2784 KB Output is correct
84 Correct 7 ms 2628 KB Output is correct
85 Correct 6 ms 2396 KB Output is correct
86 Correct 6 ms 2396 KB Output is correct
87 Correct 7 ms 2396 KB Output is correct
88 Correct 6 ms 2376 KB Output is correct
89 Correct 7 ms 2648 KB Output is correct
90 Correct 8 ms 2612 KB Output is correct