Submission #82989

# Submission time Handle Problem Language Result Execution time Memory
82989 2018-11-03T13:37:55 Z l_zg Geppetto (COCI15_geppetto) C++14
72 / 80
1000 ms 532 KB
#include <iostream>
#include <cstdio>

using namespace std;

int a[405],b[405],x[20],sol;

int main(){
	int n,m;
	cin >> n >> m;
	
	for( int i = 0; i < m; i ++ ){
		int x,y;
		cin >> x >> y;
		a[i] = max(x,y);
		b[i] = min(x,y);
	}
	
	for ( int i = 0; i < ( 1 << n ); i ++ ){
		
		int t = 1;
		
		for ( int j = 0; j < n; j ++ ){
			if ( i & ( 1 << j ) ) x[j] = 1;
		}
		
		for ( int j = 0; j < m; j ++ ){
			if ( x[a[j] - 1 ] && x[b[j] - 1] ){
				t = 0;
			}
		}
		
		for ( int j = 0; j < n; j ++ ) {
//			cout << x[j] << " ";
			x[j] = 0;
		}
//		
//		cout << t << endl;
		
		sol += t;
	}
	
	cout << sol;
	
return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Execution timed out 1084 ms 488 KB Time limit exceeded
4 Correct 738 ms 516 KB Output is correct
5 Correct 523 ms 532 KB Output is correct
6 Correct 234 ms 532 KB Output is correct
7 Correct 218 ms 532 KB Output is correct
8 Correct 207 ms 532 KB Output is correct
9 Correct 130 ms 532 KB Output is correct
10 Correct 119 ms 532 KB Output is correct