Submission #290233

#TimeUsernameProblemLanguageResultExecution timeMemory
290233shivensinha4Dango Maker (JOI18_dango_maker)C++17
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define for_(i, s, e) for (int i = s; i < (int) e; i++) #define for__(i, s, e) for (ll i = s; i < e; i++) typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; #define endl '\n' int main() { #ifndef ONLINE_JUDGE //freopen("test.in", "r", stdin); #endif ios_base::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<vi> mat(n, vi(m)), ct(n, vi(m)); for_(i, 0, n) for_(j, 0, m) { char c; cin >> c; int v = 0; if (c == 'G') v = 1; else if (c == 'W') v = 2; mat[i][j] = v; } int ans = 0; for_(i, 0, n) for_(j, 0, m-2) { if (mat[i][j] == 0 and mat[i][j+1] == 1 and mat[i][j+2] == 2) { ct[i][j] += 1; ct[i][j+1] += 1; ct[i][j+2] += 1; ans += 1; j += 2; } } for_(j, 0, m) for_(i, 0, n-2) { if (mat[i][j] == 0 and mat[i+1][j] == 1 and mat[i+2][j] == 2) { ct[i][j] += 1; ct[i+1][j] += 1; ct[i+2][j] += 1; ans += 1; i += 2; } } for_(i, 0, n) for_(j, 0, m) if (ct[i][j] > 1) ans -= 1; cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...