# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
54894 | 2018-07-05T09:08:29 Z | 강태규(#1507) | Potemkin cycle (CEOI15_indcyc) | C++11 | 201 ms | 1084 KB |
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <deque> #include <set> #include <map> #include <unordered_map> #include <functional> #include <cstring> #include <cmath> #include <ctime> #include <cstdlib> using namespace std; typedef long long llong; typedef long double ld; typedef pair<int, int> pii; typedef pair<llong, llong> pll; int n, m; vector<int> edge[301]; int con[301][301]; int a[20001], b[20001]; int dist[301]; int pr[301]; int del[301]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < m; ++i) { scanf("%d%d", a + i, b + i); edge[a[i]].push_back(b[i]); edge[b[i]].push_back(a[i]); con[a[i]][b[i]] = con[b[i]][a[i]] = 1; } while (m--) { int a = ::a[m]; int b = ::b[m]; edge[a].pop_back(); edge[b].pop_back(); for (int i = 1; i <= n; ++i) { del[i] = (con[a][i] & con[b][i]); dist[i] = n; } priority_queue<pii, vector<pii>, greater<pii>> pq; dist[a] = 0; pq.emplace(0, a); while (!pq.empty()) { int x, d; tie(d, x) = pq.top(); pq.pop(); if (x == b) { while (x != a) { printf("%d ", x); x = pr[x]; } printf("%d\n", a); return 0; } d = -d; if (d != dist[x]) continue; for (int i : edge[x]) { if (del[i]) continue; int nd = d + 1; if (nd < dist[i]) { dist[i] = nd; pr[i] = x; pq.emplace(-nd, i); } } } } printf("no\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 392 KB | Output is correct |
4 | Correct | 2 ms | 644 KB | Output is correct |
5 | Correct | 2 ms | 644 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 644 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 644 KB | Output is correct |
2 | Correct | 2 ms | 644 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 676 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 676 KB | Output is correct |
2 | Correct | 12 ms | 700 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 201 ms | 1008 KB | Output is correct |
2 | Correct | 14 ms | 1008 KB | Output is correct |
3 | Correct | 5 ms | 1084 KB | Output is correct |
4 | Correct | 25 ms | 1084 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 1084 KB | Output is correct |
2 | Correct | 127 ms | 1084 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 1084 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 1084 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 1084 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |