답안 #165616

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
165616 2019-11-27T19:19:53 Z beso123 Geppetto (COCI15_geppetto) C++14
80 / 80
824 ms 544 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int ans=0;
int n,m;
map<int,int> mp[100];
main(){
cin>>n>>m;
for(int k=1;k<=m;k++){
    int a,b;
    cin>>a>>b;
    mp[a][b]=1;
    mp[b][a]=1;
}
int N=1<<(n);
for(int k=0;k<=N;k++){
   bitset<22> b=k;
   int ind=1;
   for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
        if(b[i]==b[j] && b[i]==1){
            if(mp[i+1][j+1]==1){
                ind=0;
                break;
            }
        }
    }
   }
   if(ind)
    ans++;
}
cout<<ans-1;
return 0;
}

Compilation message

geppetto.cpp:7:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 391 ms 504 KB Output is correct
4 Correct 405 ms 372 KB Output is correct
5 Correct 439 ms 544 KB Output is correct
6 Correct 537 ms 416 KB Output is correct
7 Correct 543 ms 504 KB Output is correct
8 Correct 599 ms 476 KB Output is correct
9 Correct 729 ms 380 KB Output is correct
10 Correct 824 ms 476 KB Output is correct