# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
831210 | GordonRemzi007 | Game (eJOI20_game) | C++17 | 1 ms | 324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |