Submission #948755

#TimeUsernameProblemLanguageResultExecution timeMemory
948755phoenix0423Dango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms2648 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; #define fastio ios::sync_with_stdio(false), cin.tie(0) #define pb push_back #define eb emplace_back #define f first #define s second #define int long long #define lowbit(x) x&-x const int maxn = 3000 + 5; map<char, int> mp = {{'R', 0}, {'G', 1}, {'W', 2}}; int a[maxn][maxn], taken[maxn][maxn]; int n, m; signed main(void){ fastio; cin>>n>>m; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ char c; cin>>c; a[i][j] = mp[c]; } } int ans = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ if(j < m - 2){ if(a[i][j] == 0 && a[i][j + 1] == 1 && a[i][j + 2] == 2){ if(taken[i][j + 1] + taken[i][j + 2] < 2){ ans += 1 - taken[i][j + 1] - taken[i][j + 2]; if(taken[i][j + 1]) taken[i][j + 1] = taken[i + 1][j + 1] = 0; if(taken[i][j + 2]) taken[i][j + 2] = 0; taken[i][j] = 1; } } } if(!taken[i][j] && i < n - 2){ if(a[i][j] == 0 && a[i + 1][j] == 1 && a[i + 2][j] == 2){ taken[i][j] = taken[i + 1][j] = taken[i + 2][j] = 1; ans++; } } } } cout<<ans<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...