# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831210 | GordonRemzi007 | Game (eJOI20_game) | C++17 | 1 ms | 324 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m, cnt;
pair<int,int> temp;
queue<pair<int,int>> q;
cin >> n >> m;
vector<int> c;
vector<string> h(n+1), v(n);
vector<vector<bool>> visited(n, vector<bool>(m, false));
for(int i = 0; i <= n; i++) cin >> h[i];
for(int i = 0; i < n; i++) cin >> v[i];
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
if(!visited[i][j] && (h[i][j] == '0' || h[i+1][j] == '0' || v[i][j] == '0' || v[i][j-1] == '0')) {
cnt = 0;
q.push({i, j});
visited[i][j] = true;
while(q.size()) {
cnt++;
temp = q.front();
q.pop();
if(temp.first != 0 && h[temp.first][temp.second] == '0' && !visited[temp.first-1][temp.second]) {
visited[temp.first-1][temp.second] = true;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |