Submission #75116

# Submission time Handle Problem Language Result Execution time Memory
75116 2018-09-08T12:01:03 Z bogdan10bos Dango Maker (JOI18_dango_maker) C++14
13 / 100
3 ms 776 KB
#include <bits/stdc++.h>

using namespace std;

//#define FILE_IO

int N, M, ans, sol;
char a[3005][3005];
int f[3005][3005];

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d%d\n", &N, &M);
    for(int i = 1; i <= N; i++)
        scanf("%s", a[i] + 1);

    for(int i = 1; i <= N; i++)
        for(int j = 1; j + 2 <= M; j++)
            if(a[i][j] == 'R' && a[i][j + 1] == 'G' && a[i][j + 2] == 'W')
            {
                ans++;
                f[i][j] = f[i][j + 1] = f[i][j + 2] = 1;
            }

    for(int j = 1; j <= M; j++)
        for(int i = 1; i + 2 <= N; i++)
            if(a[i][j] == 'R' && a[i + 1][j] == 'G' && a[i + 2][j] == 'W' && f[i][j] != 1 && f[i + 1][j] != 1 && f[i + 2][j] != 1)
            {
                ans++;
                f[i][j] = f[i + 1][j] = f[i + 2][j] = 1;
            }

    for(int j = 1; j <= M; j++)
        for(int i = 1; i + 2 <= N; i++)
            if(a[i][j] == 'R' && a[i + 1][j] == 'G' && a[i + 2][j] == 'W')
            {
                sol++;
                f[i][j] = f[i + 1][j] = f[i + 2][j] = 2;
            }

    for(int i = 1; i <= N; i++)
        for(int j = 1; j + 2 <= M; j++)
            if(a[i][j] == 'R' && a[i][j + 1] == 'G' && a[i][j + 2] == 'W' && f[i][j] != 2 && f[i][j + 1] != 2 && f[i][j + 2] != 2)
            {
                sol++;
                f[i][j] = f[i][j + 1] = f[i][j + 2] = 2;
            }

    printf("%d\n", max(ans, sol));

    return 0;
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d\n", &N, &M);
     ~~~~~^~~~~~~~~~~~~~~~~~
dango_maker.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s", a[i] + 1);
         ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 708 KB Output is correct
6 Correct 2 ms 708 KB Output is correct
7 Correct 2 ms 708 KB Output is correct
8 Correct 3 ms 752 KB Output is correct
9 Correct 2 ms 752 KB Output is correct
10 Correct 2 ms 776 KB Output is correct
11 Correct 2 ms 776 KB Output is correct
12 Correct 2 ms 776 KB Output is correct
13 Correct 2 ms 776 KB Output is correct
14 Correct 2 ms 776 KB Output is correct
15 Correct 2 ms 776 KB Output is correct
16 Correct 2 ms 776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 708 KB Output is correct
6 Correct 2 ms 708 KB Output is correct
7 Correct 2 ms 708 KB Output is correct
8 Correct 3 ms 752 KB Output is correct
9 Correct 2 ms 752 KB Output is correct
10 Correct 2 ms 776 KB Output is correct
11 Correct 2 ms 776 KB Output is correct
12 Correct 2 ms 776 KB Output is correct
13 Correct 2 ms 776 KB Output is correct
14 Correct 2 ms 776 KB Output is correct
15 Correct 2 ms 776 KB Output is correct
16 Correct 2 ms 776 KB Output is correct
17 Correct 2 ms 776 KB Output is correct
18 Correct 2 ms 776 KB Output is correct
19 Correct 2 ms 776 KB Output is correct
20 Incorrect 2 ms 776 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 708 KB Output is correct
6 Correct 2 ms 708 KB Output is correct
7 Correct 2 ms 708 KB Output is correct
8 Correct 3 ms 752 KB Output is correct
9 Correct 2 ms 752 KB Output is correct
10 Correct 2 ms 776 KB Output is correct
11 Correct 2 ms 776 KB Output is correct
12 Correct 2 ms 776 KB Output is correct
13 Correct 2 ms 776 KB Output is correct
14 Correct 2 ms 776 KB Output is correct
15 Correct 2 ms 776 KB Output is correct
16 Correct 2 ms 776 KB Output is correct
17 Correct 2 ms 776 KB Output is correct
18 Correct 2 ms 776 KB Output is correct
19 Correct 2 ms 776 KB Output is correct
20 Incorrect 2 ms 776 KB Output isn't correct
21 Halted 0 ms 0 KB -