Submission #349004

#TimeUsernameProblemLanguageResultExecution timeMemory
349004Sho10Norela (info1cup18_norela)C++17
0 / 100
1046 ms364 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 #define ll long long #define double long double #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define aint(a) (a).begin(), (a).end() #define f first #define s second #define pb push_back #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000000007 #define PI 3.14159265359 #define MAXN 100005 #define INF 1000000005 #define LINF 1000000000000000005ll #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll n,m; vector<ll>spell[24]; vector<ll>ans; map<ll,ll>cnt; vector<ll> mn(vector<ll>x,vector<ll>y){ if(x.size()<y.size()){ return x; } if(y.size()<x.size()){ return y; } ll s1=0; for(ll i=0;i<x.size();i++) { if(x[i]<y[i]){ s1=1; break; }else if(y[i]<x[i]){ s1=2; break; } } if(s1==1){ return x; }else return y; } int32_t main(){ CODE_START; cin>>n>>m; for(ll i=0;i<m;i++) { ll sz; cin>>sz; for(ll j=0;j<sz;j++) { ll x; cin>>x; spell[i].pb(x); } } for(ll i=0;i<n;i++) { ans.pb(LINF); } for(ll i=0;i<(1<<m);i++) { cnt.clear(); vector<ll>x; for(ll j=0;j<m;j++) { if((1<<j)&i){ x.pb(j); for(auto it : spell[j]){ cnt[it]^=1; } } } ll check=0; for(ll i=1;i<=n;i++) if(cnt[i]==0){ check=1; } if(check==1){ continue; } ans=mn(ans,x); } cout<<ans.size()<<endl; for(auto it : ans){ cout<<it+1<<' '; } }

Compilation message (stderr)

norela.cpp: In function 'std::vector<long long int> mn(std::vector<long long int>, std::vector<long long int>)':
norela.cpp:33:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |  for(ll i=0;i<x.size();i++)
      |             ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...