# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
113751 |
2019-05-28T07:13:51 Z |
ckodser |
ICC (CEOI16_icc) |
C++14 |
|
163 ms |
632 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];
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){
if(a.empty() || b.empty()){
exit(1);
}
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));
vector<ll> ss,tt;ss.pb(s);tt.pb(t);if(soal(ss,tt)==0)exit(1);
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
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:50: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 |
Correct |
7 ms |
512 KB |
Ok! 108 queries used. |
2 |
Correct |
8 ms |
512 KB |
Ok! 112 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
512 KB |
Ok! 592 queries used. |
2 |
Correct |
50 ms |
512 KB |
Ok! 745 queries used. |
3 |
Correct |
49 ms |
568 KB |
Ok! 744 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
126 ms |
512 KB |
Ok! 1538 queries used. |
2 |
Correct |
145 ms |
632 KB |
Ok! 1803 queries used. |
3 |
Correct |
140 ms |
608 KB |
Ok! 1683 queries used. |
4 |
Correct |
133 ms |
580 KB |
Ok! 1655 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
141 ms |
576 KB |
Ok! 1652 queries used. |
2 |
Correct |
140 ms |
612 KB |
Ok! 1605 queries used. |
3 |
Correct |
156 ms |
632 KB |
Ok! 1713 queries used. |
4 |
Correct |
129 ms |
612 KB |
Ok! 1604 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
146 ms |
608 KB |
Ok! 1740 queries used. |
2 |
Correct |
151 ms |
612 KB |
Ok! 1713 queries used. |
3 |
Correct |
144 ms |
576 KB |
Ok! 1713 queries used. |
4 |
Correct |
145 ms |
612 KB |
Ok! 1729 queries used. |
5 |
Correct |
131 ms |
612 KB |
Ok! 1604 queries used. |
6 |
Correct |
163 ms |
612 KB |
Ok! 1661 queries used. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
144 ms |
576 KB |
Too many queries! 1713 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |