답안 #264978

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
264978 2020-08-14T11:59:36 Z dsjong 철인 이종 경기 (APIO18_duathlon) C++14
0 / 100
1000 ms 73064 KB
#include <bits/stdc++.h>
using namespace std;
vector<int>cur;
bool g[12][12], vis[12];
int n, m;
set<pair<pair<int, int>, int>>ans;
void go(){
	for(int i=0;i<cur.size();i++){
		for(int j=i+1;j<cur.size()-1;j++){
			ans.insert({{cur[i], cur[j]}, cur.back()});
		}
	}
	if(cur.size()==n) return;
	for(int i=1;i<=n;i++){
		if(vis[i]) continue;
		if(!cur.empty() && !g[cur.back()][i]) continue;
		cur.push_back(i);
		vis[i]=true;
		go();
		cur.pop_back();
		vis[i]=false;
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int x, y;
		cin>>x>>y;
		g[x][y]=g[y][x]=true;
	}
	go();
	cout<<ans.size();
}

Compilation message

count_triplets.cpp: In function 'void go()':
count_triplets.cpp:8:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |  for(int i=0;i<cur.size();i++){
      |              ~^~~~~~~~~~~
count_triplets.cpp:9:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |   for(int j=i+1;j<cur.size()-1;j++){
      |                 ~^~~~~~~~~~~~~
count_triplets.cpp:13:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   13 |  if(cur.size()==n) return;
      |     ~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 288 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 11 ms 512 KB Output is correct
9 Correct 568 ms 504 KB Output is correct
10 Execution timed out 1084 ms 384 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 288 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 11 ms 512 KB Output is correct
9 Correct 568 ms 504 KB Output is correct
10 Execution timed out 1084 ms 384 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 254 ms 73064 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 288 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 11 ms 512 KB Output is correct
9 Correct 568 ms 504 KB Output is correct
10 Execution timed out 1084 ms 384 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 288 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 11 ms 512 KB Output is correct
9 Correct 568 ms 504 KB Output is correct
10 Execution timed out 1084 ms 384 KB Time limit exceeded
11 Halted 0 ms 0 KB -