# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
39299 | 14kg | 열대 식물원 (Tropical Garden) (IOI11_garden) | C++11 | 1796 ms | 7588 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "garden.h"
#include "gardenlib.h"
#include <algorithm>
#include <vector>
#define N 150001
#define MP 23
using namespace std;
int n, m, start, cycle1_len, cycle2_len;
int Sx, Sy, d[N][2], d1[N][2], d2[N][2];
pair<int, int> r[N];
void Push_r(int x, int y) {
if (!r[x].first) r[x].first = y;
else if (!r[x].second) r[x].second = y;
}
int dfs(int x, int y, int len) {
d[x][y] = len;
int nx = y ? r[x].second : r[x].first;
int ny = r[nx].second && r[nx].first == x ? 1 : 0;
if (d[nx][ny]) {
if (d[nx][ny] == 1) return len;
else return -1;
}
return dfs(nx, ny, len + 1);
}
int dfs_find1(int x, int y) {
if (x == start && y == 0) return 0;
if (d1[x][y] != 0) return d1[x][y];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |