Submission #1108455


Source Code Expand

/*  .  ∧_∧
    ( ´・ω・)
    //\ ̄ ̄旦\
   // ※ \___\
   \\  ※  ※  ※ ヽ
     \ヽ-___--___ヽ*/
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define vvsort(v) sort(v.begin(),v.end(),greater<int>());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
typedef priority_queue<int> pq;
typedef priority_queue<int,vector<int>,greater<int> > rpq;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
const double PI=acos(-1.0);
//----------------------------------------------------------------------------------------------------------------------------------//
int n,m;
int g[10][10];
int pp[8];
int main(){
        cin>>n>>m;
        while(m--) {
                int x,y;
                cin>>x>>y;
                x--; y--;
                g[x][y]=g[y][x]=1;
        }
        for(int i=0; i<n; i++) {
                pp[i]=i;
        }
        int ans=0;
        bool flag=true;
        do {
                if(pp[0]!=0) continue;
                for(int i=1; i<n; i++) {
                        if(g[pp[i-1]][pp[i]]!=1) {
                                flag=false;
                                break;
                        }
                }
                if(flag) ans++;
        } while(next_permutation(pp,pp+n));
        cout<<ans<<endl;
}

Submission Info

Submission Time
Task C - One-stroke Path
User aim_cpo
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1727 Byte
Status WA
Exec Time 3 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 1
WA × 1
AC × 5
WA × 8
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All 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 3 ms 256 KB
sample_02.txt WA 3 ms 256 KB
subtask_1_01.txt AC 3 ms 256 KB
subtask_1_02.txt WA 3 ms 256 KB
subtask_1_03.txt AC 3 ms 256 KB
subtask_1_04.txt AC 3 ms 256 KB
subtask_1_05.txt AC 2 ms 256 KB
subtask_1_06.txt AC 2 ms 256 KB
subtask_1_07.txt WA 3 ms 256 KB
subtask_1_08.txt WA 2 ms 256 KB
subtask_1_09.txt WA 3 ms 256 KB
subtask_1_10.txt WA 3 ms 256 KB
subtask_1_11.txt WA 3 ms 256 KB
subtask_1_12.txt WA 3 ms 256 KB
subtask_1_13.txt WA 3 ms 256 KB