Submission #75116

#TimeUsernameProblemLanguageResultExecution timeMemory
75116bogdan10bosDango Maker (JOI18_dango_maker)C++14
13 / 100
3 ms776 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...