Submission #1115605

# Submission time Handle Problem Language Result Execution time Memory
1115605 2024-11-20T16:51:25 Z staszic_ojuz Dango Maker (JOI18_dango_maker) C++17
13 / 100
1 ms 508 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 && 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 508 KB Output is correct
3 Correct 1 ms 336 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 336 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 508 KB Output is correct
11 Correct 1 ms 336 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 336 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 508 KB Output is correct
3 Correct 1 ms 336 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 336 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 508 KB Output is correct
11 Correct 1 ms 336 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 336 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 Incorrect 1 ms 336 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 508 KB Output is correct
3 Correct 1 ms 336 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 336 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 508 KB Output is correct
11 Correct 1 ms 336 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 336 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 Incorrect 1 ms 336 KB Output isn't correct
20 Halted 0 ms 0 KB -