| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 807482 | gtm7 | Tracks in the Snow (BOI13_tracks) | C++17 | 2095 ms | 454236 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
char a[4000][4000];
bool visited[4000][4000]{false};
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int h, w;
cin >> h >> w;
char ch;
for (int i = 0; i < h; i++)
{
for (int j = 0; j < w; j++)
{
cin >> a[i][j];
}
}
int ans = 1;
set<vector<int>> q;
vector<int> s;
int ii, jj;
q.insert({1, 0, 0});
visited[0][0] = true;
while (!q.empty())
{
s = *q.begin();
q.erase(q.begin());
for (int i = 0; i < 4; i++)
{
ii = s[1] + dx[i];
jj = s[2] + dy[i];
if (ii >= 0 && ii < h && jj >= 0 && jj < w && !visited[ii][jj] && a[ii][jj] != 3)
{
visited[ii][jj] = true;
if (a[ii][jj] == a[s[1]][s[2]])
{
q.insert({s[0], ii, jj});
}
else
{
ans = max(ans, s[0] + 1);
q.insert({s[0] + 1, ii, jj});
}
}
}
}
cout << ans << "\n";
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
