Submission #886849

#TimeUsernameProblemLanguageResultExecution timeMemory
886849NeroZeinDango Maker (JOI18_dango_maker)C++17
13 / 100
7 ms37720 KiB
#include "bits/stdc++.h" using namespace std; #ifdef Nero #include "Deb.h" #else #define deb(...) #endif const int N = 3003; char c[N][N]; int used[N][N]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cin >> c[i][j]; } } int tmp = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < m - 2; ++j) { if (c[i][j] == 'R' && c[i][j + 1] == 'G' && c[i][j + 2] == 'W') { tmp++; used[i][j] = used[i][j + 1] = used[i][j + 2] = true; } } } for (int i = 0; i < n - 2; ++i) { for (int j = 0; j < m; ++j) { if (c[i][j] == 'R' && c[i + 1][j] == 'G' && c[i + 2][j] == 'W') { if (!used[i][j] && !used[i + 1][j] && !used[i + 2][j]) { tmp++; used[i][j] = used[i + 1][j] = used[i + 2][j] = true; } } } } int ans = tmp; tmp = 0; memset(used, 0, sizeof used); for (int i = 0; i < n - 2; ++i) { for (int j = 0; j < m; ++j) { if (c[i][j] == 'R' && c[i + 1][j] == 'G' && c[i + 2][j] == 'W') { tmp++; used[i][j] = used[i + 1][j] = used[i + 2][j] = true; } } } for (int i = 0; i < n; ++i) { for (int j = 0; j < m - 2; ++j) { if (c[i][j] == 'R' && c[i][j + 1] == 'G' && c[i][j + 2] == 'W') { if (!used[i][j] && !used[i][j + 1] && !used[i][j + 2]) { tmp++; used[i][j] = used[i][j + 1] = used[i][j + 2] = true; } } } } ans = max(ans, tmp); cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...