# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
113740 |
2019-05-28T06:51:28 Z |
ckodser |
ICC (CEOI16_icc) |
C++14 |
|
11 ms |
540 KB |
#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];
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);
}
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]);
}
}
if(v0.size()!=imp.size() && v1.size()!=imp.size()){
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);
for(auto e:vec[s]){
vec[t].pb(e);
}
vec[s].clear();
}
}
Compilation message
icc.cpp: In function 'int soal(std::vector<int>, std::vector<int>)':
icc.cpp:26: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:46:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(ll i=(ll)a.size()/2;i<a.size();i++){
~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
512 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
512 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
512 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
512 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
512 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
540 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |