# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
34386 | 2017-11-10T20:06:24 Z | mohammad_kilani | Potemkin cycle (CEOI15_indcyc) | C++14 | 1000 ms | 2016 KB |
#include <bits/stdc++.h> using namespace std; #define mod 1000007 #define oo 2000000000 const int N = 101; bitset< N > con[N]; int n , m; int vis[N] , vi = 0 , num = 0 ; void DFS(int node,vector<int> &v){ vis[node] = vi; num++; for(int i=0;i<v.size();i++){ if(vis[v[i]] != vi && con[node][v[i]]){ DFS(v[i],v); } } } void solve(vector<int> &v,int i){ if(i == n+1){ if(v.size() < 4) return; bool can = true; num = 0 ; vi++; DFS(v[0],v); if(num != v.size()) return; for(int j=0;j<v.size();j++){ int cur = 0; for(int k=0;k<v.size();k++){ if(j == k) continue; if(con[v[j]][v[k]]) cur++; } if(cur != 2) can = false; } if(can){ for(int i=0;i<v.size();i++) printf((i == 0 ? "%d" : " %d"),v[i]); puts(""); exit(0); } return ; } solve(v,i+1); v.push_back(i); solve(v,i+1); v.pop_back(); } int main() { //freopen("in.txt","r",stdin); scanf("%d%d",&n,&m); for(int i=0;i<m;i++){ int u ,v ; scanf("%d%d",&u,&v); con[u][v] = con[v][u] = true; } vector<int> ans; solve(ans,1); puts("no"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2016 KB | Output is correct |
2 | Correct | 0 ms | 2016 KB | Output is correct |
3 | Correct | 0 ms | 2016 KB | Output is correct |
4 | Correct | 0 ms | 2016 KB | Output is correct |
5 | Correct | 0 ms | 2016 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2016 KB | Wrong adjacency |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2016 KB | Wrong adjacency |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 2016 KB | Execution timed out |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 2016 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 2016 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 2016 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 | 2016 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 | 2016 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 2016 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |