Submission #1589678
Source Code Expand
#include<iostream> #include<algorithm> #include<functional> #include<string> #include<vector> #include<map> #include<set> #include<tuple> #include<stack> #include<queue> #include<deque> #include<sstream> #include<stdio.h> #include<math.h> #include<stdlib.h> #include<bitset> #include<time.h> #include<cstdlib> #include<cassert> #define ll long long #define fi first #define se second using namespace std; int n,m; bool a[9][9]; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout<<fixed; #ifdef LOCAL_DEFINE freopen("in", "r", stdin); freopen("out","w",stdout); #endif cin>>n>>m; for(int i=0;i<m;i++){ int to,from; cin>>to>>from; to--;from--; a[to][from]=1; a[from][to]=1; } vector<int> v; for(int i=0;i<n;i++){ v.push_back(i); } ll ans=0; do{ if(v[0]!=0)break; bool flag=1; for(int i=0;i<(int)v.size()-1;i++){ if(!a[v[i]][v[i+1]])flag=0; } if(flag)ans++; }while(next_permutation(v.begin(),v.end())); cout<<ans<<"\n"; #ifdef LOCAL_DEFINE cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - One-stroke Path |
User | aim_cpo |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1229 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt |
All | sample_01.txt, sample_02.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
subtask_1_01.txt | AC | 1 ms | 256 KB |
subtask_1_02.txt | AC | 1 ms | 256 KB |
subtask_1_03.txt | AC | 1 ms | 256 KB |
subtask_1_04.txt | AC | 1 ms | 256 KB |
subtask_1_05.txt | AC | 1 ms | 256 KB |
subtask_1_06.txt | AC | 1 ms | 256 KB |
subtask_1_07.txt | AC | 1 ms | 256 KB |
subtask_1_08.txt | AC | 1 ms | 256 KB |
subtask_1_09.txt | AC | 1 ms | 256 KB |
subtask_1_10.txt | AC | 1 ms | 256 KB |
subtask_1_11.txt | AC | 1 ms | 256 KB |
subtask_1_12.txt | AC | 1 ms | 256 KB |
subtask_1_13.txt | AC | 1 ms | 256 KB |