Submission #967831

#TimeUsernameProblemLanguageResultExecution timeMemory
967831LittleOrangeDango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms460 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(0);cin.tie(0); ll n,m; cin >> n >> m; vector<string> a(n); for(auto &o : a) cin >> o; vector<vector<ll>> vis(n,vector<ll>(m,0)); ll ans = 0; for(ll x = n-1;x>=0;x--){ for(ll y = 0;y<m;y++){ ll i = x; ll j = y; if (vis[i][j]) continue; ll cnt = 0; while(i<n&&j<m){ cnt++; vis[i][j] = 1; if (a[i][j]=='R'){ if (j+2<m&&a[i][j+1]=='G'&&a[i][j+2]=='W'){ j+=2; continue; } }else if (a[i][j]=='W'){ if (i>=2&&a[i-1][j]=='G'&&a[i-2][j]=='R'){ i-=2; continue; } } break; } ans += cnt/2; } } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...