Submission #2554226


Source Code Expand

#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include<queue>

using namespace std;
int G[9][9];


int main() {
	int N, M;
	int ans = 0;
	cin >> N >> M;
	int A[8], B[8];

	

	for (int i = 0; i < M; i ++) {
		cin >> A[i] >> B[i];
		G[A[i]][B[i]] = 1;
		G[B[i]][A[i]] = 1;
	}

	vector<int> v(N);
	
	for (int i = 0; i < N; i++) {
		v[i] = i + 1;
	}

	do {
		if (v[0] == 1) {
			int flag = 1;
			for (int i = 0; i < N - 1; i++) {
				if (G[v[i]][v[i + 1]] == 0)flag = 0;
			}
			if (flag == 1)ans++;
		}


		
	} while (next_permutation(v.begin(), v.end()));


	cout << ans << endl;

	return 0;
}

Submission Info

Submission Time
Task C - One-stroke Path
User aoneko
Language C++14 (GCC 5.4.1)
Score 0
Code Size 726 Byte
Status RE
Exec Time 101 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 10
RE × 5
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 RE 98 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 RE 99 ms 256 KB
subtask_1_11.txt RE 101 ms 256 KB
subtask_1_12.txt RE 100 ms 256 KB
subtask_1_13.txt RE 100 ms 256 KB