# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
36527 | cheater2k | Tracks in the Snow (BOI13_tracks) | C++14 | 1303 ms | 448676 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 4005;
const int dx[] = {0, 0, -1, +1};
const int dy[] = {-1, +1, 0, 0};
int r, c;
string a[N];
bool vis[N][N];
int ans;
void bfs(queue< pair<int,int> > &q1, queue< pair<int,int> > &q2) {
if (q1.empty()) return;
++ans;
while(!q1.empty()) {
int x = q1.front().first, y = q1.front().second; q1.pop();
for (int dir = 0; dir < 4; ++dir) {
int nx = x + dx[dir];
int ny = y + dy[dir];
if (nx < 0 || nx >= r || ny < 0 || ny >= c || a[nx][ny] == '.' || vis[nx][ny]) continue;
vis[nx][ny] = true;
if (a[nx][ny] != a[x][y]) q2.push(make_pair(nx, ny));
else q1.push(make_pair(nx, ny));
}
}
bfs(q2, q1);
}
int main() {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |