Submission #88689

# Submission time Handle Problem Language Result Execution time Memory
88689 2018-12-07T13:19:52 Z shafinalam Geppetto (COCI15_geppetto) C++14
8 / 80
332 ms 692 KB
#include <bits/stdc++.h>

using namespace std;

const int mx = 1e5+5;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int,int>pii;
typedef pair<int,pii>piii;

#define  sf scanf
#define  pf printf

#define  input freopen("input.txt","r",stdin)
#define  output freopen("output.txt","w",stdout)

#define  inf 1e16
#define  ff first
#define  ss second
#define  MP make_pair
#define  pb push_back
#define  all(v) v.begin(), v.end()
#define  printcase(cases) printf("Case %d:", cases);
#define  Unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define  FAST  ios_base::sync_with_stdio(0);cout.tie(0)
#define  endl printf("\n")
#define  __lcm(a, b) ((a*b)/__gcd(a, b))

int  Set(int N,int pos){return N=N | (1<<pos);}
int  reset(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}

vector<int>v[30];

int main()
{
    int n, m;
    sf("%d%d", &n, &m);

    for(int i = 0; i < m; i++)
    {
        int a, b;
        sf("%d%d", &a, &b);
        v[a].push_back(b);
        v[b].push_back(a);
    }
    int ans = 1<<n;
    for(int b = 0; b < (1<<n); b++)
    {
        vector<int>subset;
        for(int i = 0; i < n; i++)
            if(b&(1<<i)) subset.push_back(i+1);
        for(int i = 0; i < subset.size(); i++)
        {
            int flag = 0;
            for(int r = 0; r < subset.size(); r++)
            {
                if(i==r) continue;
                if(find(v[subset[i]].begin(), v[subset[i]].begin(), subset[r])!=v[subset[i]].end())
                {
                    ans--;
                    flag = 1;
                    break;
                }
            }
            if(flag) break;
        }
    }
    pf("%d\n", ans);
    return 0;
}

Compilation message

geppetto.cpp: In function 'int main()':
geppetto.cpp:54:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 0; i < subset.size(); i++)
                        ~~^~~~~~~~~~~~~~~
geppetto.cpp:57:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int r = 0; r < subset.size(); r++)
                            ~~^~~~~~~~~~~~~~~
geppetto.cpp:39:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     sf("%d%d", &n, &m);
       ^
geppetto.cpp:44:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         sf("%d%d", &a, &b);
           ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 504 KB Output isn't correct
3 Incorrect 284 ms 504 KB Output isn't correct
4 Incorrect 280 ms 620 KB Output isn't correct
5 Incorrect 285 ms 620 KB Output isn't correct
6 Incorrect 287 ms 620 KB Output isn't correct
7 Incorrect 289 ms 620 KB Output isn't correct
8 Incorrect 289 ms 620 KB Output isn't correct
9 Incorrect 302 ms 692 KB Output isn't correct
10 Incorrect 332 ms 692 KB Output isn't correct