Submission #653629

#TimeUsernameProblemLanguageResultExecution timeMemory
653629ayallaDango Maker (JOI18_dango_maker)C++14
13 / 100
1 ms324 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define int long long int #define endl '\n' #define pb push_back #define pi pair<int, int> #define pii pair<int, pi> #define fir first #define sec second #define MAXN 3005 #define mod 998244353 int n, m; int solve2(vector<string> &v) { int ans = 0; for (int j = 0; j < m; j++) { for (int i = 0; i + 2 < n; i++) { if (v[i][j] == 'R' && v[i + 1][j] == 'G' && v[i + 2][j] == 'W') { ans++; v[i][j] = '#'; v[i + 1][j] = '#'; v[i + 2][j] = '#'; } } } return ans; } int solve(vector<string> &v) { int ans = 0; for (int i = 0; i < n; i++) { for (int j = 0; j + 2 < m; j++) { if (v[i][j] == 'R' && v[i][j + 1] == 'G' && v[i][j + 2] == 'W') { ans++; v[i][j] = '#'; v[i][j + 1] = '#'; v[i][j + 2] = '#'; } } } return ans; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; vector<string> v(n); for (int i = 0; i < n; i++) cin >> v[i]; vector<string> v2 = v; int ans = 0, ans2 = 0; ans += solve(v); ans += solve2(v); ans2 += solve2(v2); ans2 += solve(v2); cout << max(ans, ans2) << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...