Submission #113753

#TimeUsernameProblemLanguageResultExecution timeMemory
113753ckodserICC (CEOI16_icc)C++14
90 / 100
132 ms640 KiB
#include<bits/stdc++.h> #include<icc.h> #define ll int #define pb push_back #define mp make_pair #define ld long double #define F first #define S second #define pii pair<ll,ll> using namespace :: std; const ll mod=1e9+7; const ll maxn=500; const ll inf=1e9+900; vector<ll> vec[maxn]; ll par[maxn]; int soal(vector<ll> a,vector<ll> b){ ll A[maxn]; ll B[maxn]; for(ll i=0;i<(ll)a.size();i++){ A[i]=a[i]; } for(ll i=0;i<b.size();i++){ B[i]=b[i]; } return query(a.size(),b.size(),A,B); } vector<ll> kamel(vector<ll> v){ vector<ll> ans; for(auto e:v){ for(auto r:vec[e]){ ans.pb(r); } } return ans; } ll find_sar(vector<ll> a,vector<ll> b){ while(a.size()>1){ vector<ll> aa,aaa; for(ll i=0;i<(ll)a.size()/2;i++){ aa.pb(a[i]); } for(ll i=(ll)a.size()/2;i<a.size();i++){ aaa.pb(a[i]); } bool bo=soal(aa,b); if(bo){ a=aa; }else{ a=aaa; } } return a[0]; } void run(ll n){ for(ll i=1;i<=n;i++){ vec[i].pb(i); par[i]=i; } for(ll w=1;w<=n-1;w++){ vector<ll> imp; for(ll i=1;i<=n;i++){ if(vec[i].size()){ imp.pb(i); } } ll m=imp.size(); vector<ll> v1,v0; for(ll i=0;(1<<i)<m;i++){ v0.clear(); v1.clear(); for(ll j=0;j<m;j++){ if((j>>i)&1){ v1.pb(imp[j]); }else{ v0.pb(imp[j]); } } int b=soal(kamel(v0),kamel(v1)); if(b){ break; } } ll s=find_sar(kamel(v0),kamel(v1)); ll t=find_sar(kamel(v1),kamel(v0)); setRoad(s,t); s=par[s]; t=par[t]; for(auto e:vec[s]){ vec[t].pb(e); par[e]=t; } vec[s].clear(); } }

Compilation message (stderr)

icc.cpp: In function 'int soal(std::vector<int>, std::vector<int>)':
icc.cpp:27:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(ll i=0;i<b.size();i++){
                ~^~~~~~~~~
icc.cpp: In function 'int find_sar(std::vector<int>, std::vector<int>)':
icc.cpp:47:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ll i=(ll)a.size()/2;i<a.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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...