Submission #1121225

#TimeUsernameProblemLanguageResultExecution timeMemory
1121225staszic_ojuzDango Maker (JOI18_dango_maker)C++17
13 / 100
2 ms504 KiB
#include <iostream> #include <unordered_map> #include <cmath> #include <string> #include <vector> #include <algorithm> #include <locale> #include <bitset> #include <climits> typedef long long ll; using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n, m; cin >> n >> m; vector<vector<bool>> vis(n, vector<bool>(m, false)); vector<vector<char>> board(n, vector<char>(m, 'A')); for(int x = 0; x < n; x++){ for(int y = 0; y < m; y++) { cin >> board[x][y]; } } ll il = 0; for(int x = n - 1; x >= 0; x--){ for(int y = m - 1; y >= 0; y--) { if(!vis[x][y]) { if(board[x][y] == 'G') { if(x > 0 && x < n - 1 && !vis[x - 1][y] && !vis[x + 1][y] && board[x - 1][y] == 'R' && board[x + 1][y] == 'W') { //if() { vis[x][y] = true; vis[x - 1][y] = true; vis[x + 1][y] = true; il++; //} } else if(y > 0 && y < m - 1 && !vis[x][y - 1] && !vis[x][y + 1] && board[x][y - 1] == 'R' && board[x][y + 1] == 'W') { vis[x][y] = true; vis[x][y - 1] = true; vis[x][y + 1] = true; il++; } } } } } ll mx = il; for(int x = n - 1; x >= 0; x--){ for(int y = m - 1; y >= 0; y--) { if(!vis[x][y]) { if(board[x][y] == 'G') { if(y > 0 && y < m - 1 && !vis[x][y - 1] && !vis[x][y + 1] && board[x][y - 1] == 'R' && board[x][y + 1] == 'W') { vis[x][y] = true; vis[x][y - 1] = true; vis[x][y + 1] = true; il++; } else if(x > 0 && x < n - 1 && !vis[x - 1][y] && !vis[x + 1][y] && board[x - 1][y] == 'R' && board[x + 1][y] == 'W') { //if() { vis[x][y] = true; vis[x - 1][y] = true; vis[x + 1][y] = true; il++; //} } } } } } cout << max(il, mx) << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...