Submission #224233

# Submission time Handle Problem Language Result Execution time Memory
224233 2020-04-17T14:45:21 Z Ruxandra985 Dango Maker (JOI18_dango_maker) C++14
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>

using namespace std;
char a[3010][3010];
int f[3010][3010] , vert , oriz , n , m , sol;

int main()
{
    FILE *fin = stdin;
    FILE *fout = stdout;
    int i , j;
    fscanf (fin,"%d%d\n",&n,&m);
    for (i = 1 ; i <= n ; i++)
        fgets(a[i] + 1 , m + 10 , fin);


    for (i = 1 ; i <= n ; i++){
        for (j = 1 ; j <= m ; j++){
            if (a[i][j] == 'W'){

                if (i >= 3 && a[i - 1][j] == 'G' && a[i - 2][j] == 'R')
                    f[i][j] = max(f[i][j] , 1 + f[i - 3][j] + f[i][j - 1] - f[i - 3][j - 1]);

                if (j >= 3 && a[i][j - 1] == 'G' && a[i][j - 2] == 'R')
                    f[i][j] = max(f[i][j] , 1 + f[i][j - 3] + f[i - 1][j] - f[i - 1][j - 3]);


                f[i][j] = max(f[i][j] , f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1]);

            }
            else f[i][j] = f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1];
        }
    }
    fprintf (fout,"%d",f[n][m]);
    return 0;
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:12:12: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     fscanf (fin,"%d%d\n",&n,&m);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~
dango_maker.cpp:14:14: warning: ignoring return value of 'char* fgets(char*, int, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         fgets(a[i] + 1 , m + 10 , fin);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Incorrect 5 ms 384 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Incorrect 5 ms 384 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Incorrect 5 ms 384 KB Output isn't correct
9 Halted 0 ms 0 KB -