#include <bits/stdc++.h>
#include "icc.h"
#define maxN 101
using namespace std;
vector <int> x,a,b;
int N;
int Query(vector <int> a,vector <int> b) {
int tmp[2][maxN];
for (int i = 0; i < a.size(); ++i) tmp[0][i]=a[i];
for (int i = 0; i < b.size(); ++i) tmp[1][i]=b[i];
return query(a.size(),b.size(),tmp[0],tmp[1]);
}
void formiraj(int n,int d){
a.clear(); b.clear();
for(int i=0;i<n;i++){
int r=i/d;
if(r%2) b.push_back(x[i]);
else a.push_back(x[i]);
}
}
pair <int,int> resi(vector <int> &a,vector <int> &b){
pair <int,int> ans;
ans=make_pair(-1,-1);
int i;
vector <int> s;
int A,B;
A=a.size();
B=b.size();
int l=0,d=A-1,m;
while(d>l){
m=(l+d)/2;
for(i=l;i<=m;i++){
s.push_back(a[i]);
}
if(Query(b,s)) d=m;
else l=m+1;
s.clear();
}
ans.first=a[l];
l=0,d=B-1;
while(d>l){
m=(l+d)/2;
for(i=l;i<=m;i++){
s.push_back(b[i]);
}
if(Query(a,s)) d=m;
else l=m+1;
s.clear();
}
ans.second=b[l];
return ans;
}
int stepen(int n){
int x=1;
while(2*x<n){
x*=2;
}
return x;
}
void run(int n){
N=n;
int i,A=0,B=0,s;
while(n>1){
s=stepen(n);
x.clear();
for(i=1;i<=N;i++){
x.push_back(i);
}
int d=s;
while(d>0){
formiraj(x.size(),d);
if(Query(a,b)) break;
a.clear(); b.clear();
d=d/2;
}
pair <int,int> r;
r=resi(a,b);
a.clear(); b.clear();
setRoad(r.first,r.second);
n--;
}
}
Compilation message
icc.cpp: In function 'int Query(std::vector<int>, std::vector<int>)':
icc.cpp:11:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < a.size(); ++i) tmp[0][i]=a[i];
^
icc.cpp:12:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < b.size(); ++i) tmp[1][i]=b[i];
^
icc.cpp: In function 'void run(int)':
icc.cpp:65:11: warning: unused variable 'A' [-Wunused-variable]
int i,A=0,B=0,s;
^
icc.cpp:65:15: warning: unused variable 'B' [-Wunused-variable]
int i,A=0,B=0,s;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2084 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2080 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
2080 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
2080 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
2080 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
2076 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |