# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
227313 | Bruteforceman | 어르신 집배원 (BOI14_postmen) | C++11 | 517 ms | 74236 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define prev dfsdf
forward_list <int> g[500010];
int l[500010], r[500010];
bool del[500010];
int tour[1000010];
bool occ[500010];
int cur;
void dfs(int x) {
while (!g[x].empty()){
int i = g[x].front();
g[x].pop_front();
if(del[i]) continue;
del[i] = true;
int y = l[i] ^ r[i] ^ x;
dfs(y);
}
if(occ[x] == false) {
occ[x] = true;
tour[++cur] = x;
} else {
while(tour[cur] != x) {
int y = tour[cur--];
occ[y] = false;
printf("%d ", y);
}
printf("%d\n", x);
}
}
int main (int argc, char const* argv[])
{
int n, m;
scanf("%d %d", &n, &m);
for(int i = 0; i < m; i++) {
int p, q;
scanf("%d %d", &p, &q);
l[i] = p;
r[i] = q;
g[p].push_front(i);
g[q].push_front(i);
}
dfs(1);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |