Submission #1115605

#TimeUsernameProblemLanguageResultExecution timeMemory
1115605staszic_ojuzDango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms508 KiB
#include<bits/stdc++.h> using namespace std; using i64 = int64_t; vector<string> table; struct Rgw { i64 x; i64 y; bool dol; i64 krz; }; bool RGW(i64 x, i64 y, bool b) { if (b == false && table[x][y] == 'R' && table[x][y + 1] == 'G' && table[x][y + 2] == 'W') { return true; } if (b && table[x][y] == 'R' && table[x + 1][y] == 'G' && table[x + 2][y] == 'W') { return true; } return false; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); i64 N, M; cin >> N >> M; table.resize(N); for (i64 i = 0; i < N; i++) { cin >> table[i]; } i64 wynik = 0; for (i64 i = 0; i < N; i++) { for (i64 k = 0; k < M; k++) { if (k < M - 2 && RGW(i, k, 0)) { if (i > 0 && i < N - 1 && RGW(i - 1, k + 1, 1)) { table[i - 1][k + 1] = '#'; table[i][k + 1] = '#'; table[i][k + 2] = '#'; wynik++; } else { wynik++; table[i][k] = '#'; table[i][k + 1] = '#'; table[i][k + 2] = '#'; } } if (table[i][k] == 'G' && i < 0 && i < N - 1 && RGW(i - 1, k, 1)) { wynik++; table[i - 1][k] = '#'; table[i][k] = '#'; table[i + 1][k] = '#'; } } } for (i64 i = 0; i < N - 2; i++) { for (i64 k = 0; k < M; k++) { //cout << table[i][k]; if (RGW(i, k, 1)) { wynik++; } } //cout << "\n"; } cout << wynik << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...