| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 403811 | saleh | Potemkin cycle (CEOI15_indcyc) | C++17 | 1 ms | 204 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10 + 1;
int n, m;
vector<int> g[MAXN];
bitset<MAXN> mark, mirk;
int dfs(int v) {
int res = 1, deg = 0;
mirk[v] = true;
for (auto i : g[v]) if (mark[i]) deg++;
if (deg != 2) res = -1;
for (auto i : g[v]) if (mark[i] && !mirk[i]) {
int tmp = dfs(i);
if (~tmp && ~res) res += tmp;
}
return res;
}
void ofs(int v) {
cout << v + 1 << ' ';
mirk[v] = true;
for (auto i : g[v]) if (mark[i] && !mirk[i]) ofs(i);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
cin >> n >> m;
if (n > MAXN) return 0;
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
g[--a].push_back(--b), g[b].push_back(a);
}
for (int i = 0; i < (1 << n); i++) {
mirk.reset();
mark.reset();
vector<int> vec;
for (int j = 0; j < n; j++) if (i & (1 << j)) {
vec.push_back(j);
mark[j] = true;
}
if (vec.size() > 3) if (dfs(vec.back()) == vec.size()) {
mirk.reset();
ofs(vec.back());
return 0;
}
}
cout << "no";
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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
