Submission #1115618

# Submission time Handle Problem Language Result Execution time Memory
1115618 2024-11-20T17:08:27 Z staszic_ojuz Dango Maker (JOI18_dango_maker) C++17
100 / 100
130 ms 16200 KB
#include<bits/stdc++.h>
using namespace std;
using i64 = int64_t;

vector<string> table;

struct Rgw
{
    i64 x;
    i64 y;
    bool dol;
    i64 krz;
};

bool RGW(i64 x, i64 y, bool b)
{
    if (b == false && table[x][y] == 'R' && table[x][y + 1] == 'G' && table[x][y + 2] == 'W')
    {
        return true;
    }
    if (b == 1 && table[x][y] == 'R' && table[x + 1][y] == 'G' && table[x + 2][y] == 'W')
    {
        return true;
    }
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    i64 N, M;
    cin >> N >> M;

    table.resize(N);
    for (i64 i = 0; i < N; i++)
    {
        cin >> table[i];
    }

    i64 wynik = 0;
    for (i64 i = 0; i < N; i++)
    {
        for (i64 k = 0; k < M; k++)
        {
            if (k < M - 2 && RGW(i, k, 0))
            {
                if (i > 0 && i < N - 1 && RGW(i - 1, k + 1, 1))
                {
                    table[i - 1][k + 1] = '#';
                    table[i][k + 1] = '#';
                    table[i][k + 2] = '#';
                    wynik++;
                }
                else
                {
                    wynik++;
                    table[i][k] = '#';
                    table[i][k + 1] = '#';
                    table[i][k + 2] = '#';
                }
            }
            if (table[i][k] == 'G' && i > 0 && i < N - 1 && RGW(i - 1, k, 1))
            {
                wynik++;
                table[i - 1][k] = '#';
                table[i][k] = '#';
                table[i + 1][k] = '#';
            }
         }
    }

   /* for (i64 i = 0; i < N - 2; i++)
    {
        for (i64 k = 0; k < M; k++)
        {
            //cout << table[i][k];
            if (RGW(i, k, 1))
            {
                wynik++;
            }
        }
        //cout << "\n";
    }*/

    cout << wynik << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 504 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 504 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 504 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 504 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 504 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 504 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 504 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 1 ms 336 KB Output is correct
37 Correct 1 ms 504 KB Output is correct
38 Correct 1 ms 336 KB Output is correct
39 Correct 1 ms 336 KB Output is correct
40 Correct 1 ms 336 KB Output is correct
41 Correct 1 ms 336 KB Output is correct
42 Correct 1 ms 336 KB Output is correct
43 Correct 1 ms 336 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 1 ms 336 KB Output is correct
46 Correct 1 ms 336 KB Output is correct
47 Correct 1 ms 336 KB Output is correct
48 Correct 1 ms 336 KB Output is correct
49 Correct 1 ms 336 KB Output is correct
50 Correct 1 ms 336 KB Output is correct
51 Correct 1 ms 336 KB Output is correct
52 Correct 1 ms 336 KB Output is correct
53 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 504 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 504 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 504 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 504 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 1 ms 336 KB Output is correct
37 Correct 1 ms 504 KB Output is correct
38 Correct 1 ms 336 KB Output is correct
39 Correct 1 ms 336 KB Output is correct
40 Correct 1 ms 336 KB Output is correct
41 Correct 1 ms 336 KB Output is correct
42 Correct 1 ms 336 KB Output is correct
43 Correct 1 ms 336 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 1 ms 336 KB Output is correct
46 Correct 1 ms 336 KB Output is correct
47 Correct 1 ms 336 KB Output is correct
48 Correct 1 ms 336 KB Output is correct
49 Correct 1 ms 336 KB Output is correct
50 Correct 1 ms 336 KB Output is correct
51 Correct 1 ms 336 KB Output is correct
52 Correct 1 ms 336 KB Output is correct
53 Correct 1 ms 336 KB Output is correct
54 Correct 1 ms 504 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 2 ms 336 KB Output is correct
58 Correct 15 ms 2136 KB Output is correct
59 Correct 127 ms 10064 KB Output is correct
60 Correct 127 ms 15020 KB Output is correct
61 Correct 130 ms 16200 KB Output is correct
62 Correct 1 ms 500 KB Output is correct
63 Correct 127 ms 14328 KB Output is correct
64 Correct 57 ms 10064 KB Output is correct
65 Correct 66 ms 10160 KB Output is correct
66 Correct 71 ms 10064 KB Output is correct
67 Correct 66 ms 14920 KB Output is correct
68 Correct 59 ms 14664 KB Output is correct
69 Correct 67 ms 15244 KB Output is correct
70 Correct 9 ms 2128 KB Output is correct
71 Correct 9 ms 2128 KB Output is correct
72 Correct 7 ms 1528 KB Output is correct
73 Correct 9 ms 1616 KB Output is correct
74 Correct 8 ms 1360 KB Output is correct
75 Correct 9 ms 1616 KB Output is correct
76 Correct 8 ms 1624 KB Output is correct
77 Correct 8 ms 2128 KB Output is correct
78 Correct 9 ms 2296 KB Output is correct
79 Correct 8 ms 1360 KB Output is correct
80 Correct 9 ms 2128 KB Output is correct
81 Correct 9 ms 1788 KB Output is correct
82 Correct 9 ms 1360 KB Output is correct
83 Correct 7 ms 1360 KB Output is correct
84 Correct 8 ms 1616 KB Output is correct
85 Correct 7 ms 1360 KB Output is correct
86 Correct 8 ms 1536 KB Output is correct
87 Correct 9 ms 1752 KB Output is correct
88 Correct 9 ms 2128 KB Output is correct
89 Correct 7 ms 1360 KB Output is correct
90 Correct 9 ms 1776 KB Output is correct