Submission #898048

#TimeUsernameProblemLanguageResultExecution timeMemory
898048andrei_iorgulescuDango Maker (JOI18_dango_maker)C++14
13 / 100
1 ms2648 KiB
#include <bits/stdc++.h> using namespace std; int n,m; char a[3005][3005]; bool viz[3005][3005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) cin >> a[i][j]; int ans = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m - 2; j++) { if (a[i][j] == 'R' and a[i][j + 1] == 'G' and a[i][j + 2] == 'W' and !viz[i][j] and !viz[i][j + 1] and !viz[i][j + 2]) { ans++; viz[i][j] = true; viz[i][j + 1] = true; viz[i][j + 2] = true; } } } for (int j = 1; j <= m; j++) { for (int i = 1; i <= n - 2; i++) { if (a[i][j] == 'R' and a[i + 1][j] == 'G' and a[i + 2][j] == 'W' and !viz[i][j] and !viz[i + 1][j] and !viz[i + 2][j]) { ans++; viz[i][j] = true; viz[i + 1][j] = true; viz[i + 2][j] = true; } } } for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) viz[i][j] = false; int ans2 = 0; for (int j = 1; j <= m; j++) { for (int i = 1; i <= n - 2; i++) { if (a[i][j] == 'R' and a[i + 1][j] == 'G' and a[i + 2][j] == 'W' and !viz[i][j] and !viz[i + 1][j] and !viz[i + 2][j]) { ans2++; viz[i][j] = true; viz[i + 1][j] = true; viz[i + 2][j] = true; } } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m - 2; j++) { if (a[i][j] == 'R' and a[i][j + 1] == 'G' and a[i][j + 2] == 'W' and !viz[i][j] and !viz[i][j + 1] and !viz[i][j + 2]) { ans2++; viz[i][j] = true; viz[i][j + 1] = true; viz[i][j + 2] = true; } } } cout << max(ans,ans2); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...