제출 #459596

#제출 시각아이디문제언어결과실행 시간메모리
459596TeaTimeDango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms332 KiB
//#pragma GCC optimize("O3") //#pragma GCC target("avx2") #include <iostream> #include <vector> #include <string> #include <algorithm> #include <map> #include <set> #include <queue> #include <unordered_map> using namespace std; #define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); typedef long long ll; typedef long double ld; const ll SZ = 3050; char grid[SZ][SZ]; int main() { fastInp; ll n, m; cin >> n >> m; for (int i = 0; i < n; i++) { string s; cin >> s; for (int j = 0; j < m; j++) grid[i][j] = s[j]; } ll ans = 0; for (int x = 0; x < n + m + 2; x++) { for (int y = 0; y < n + m + 2; y++) { ll i = x - y; ll j = y; if (!(i >= 0 && j >= 0 && i < n && j < m)) continue; if (grid[i][j] == 'R') { if (grid[i][j + 1] == 'G' && grid[i][j + 2] == 'W') { grid[i][j] = '0'; grid[i][j + 1] = '0'; grid[i][j + 2] = '0'; ans++; continue; } if (grid[i + 1][j] == 'G' && grid[i + 2][j] == 'W') { grid[i][j] = '0'; grid[i + 1][j] = '0'; grid[i + 1][j] = '0'; ans++; continue; } } } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...