#include <bits/stdc++.h>
#include "icc.h"
using namespace std;
int a[105],b[105],pt[10],ans1,ans2,nowl,nowr,nowmid,c[105],d[105],x;
/*int query (int sz1,int sz2,int e[],int g[]){
for (int i=0;i<sz1;i++){
cout << e[i] << " ";
}
cout << "\n";
for (int i=0;i<sz2;i++){
cout << g[i] << " ";
}
cout << "\n";
cin >> x;
return x;
}
void setRoad(int a1,int a2){
cout << "Road set: " << a1 << " " << a2 << "\n";
}*/
void solve(int l,int r){
int mid=(l+r)/2;
if (l == r);
else
{
pt[0]=0; pt[1]=0;
for (int i=l;i<=mid;i++){
a[pt[0]]=i;
pt[0]++;
}
for (int i=mid+1;i<=r;i++){
b[pt[1]]=i;
pt[1]++;
}
if (query(pt[0],pt[1],a,b) == 0){
if (ans1 == 0 && ans2 == 0)
solve(l,mid);
if (ans1 == 0 && ans2 == 0)
solve(mid+1,r);
}
else
{
nowl=0; nowr=pt[0]-1;
while (nowl < nowr){
nowmid=(nowl+nowr)/2; pt[2]=0;
for (int i=nowl;i<=nowmid;i++){
c[pt[2]]=a[i];
pt[2]++;
}
if (query(pt[2],pt[1],c,b) == 0)
nowl=nowmid+1;
else
nowr=nowmid;
}
ans1=a[nowl];
nowl=0; nowr=pt[1]-1;
while (nowl < nowr){
nowmid=(nowl+nowr)/2; pt[3]=0;
for (int i=nowl;i<=nowmid;i++){
d[pt[3]]=b[i];
pt[3]++;
}
c[0]=ans1;
if (query(1,pt[3],c,d) == 0)
nowl=nowmid+1;
else
nowr=nowmid;
}
ans2=b[nowl];
}
}
}
void run(int N){
for (int i=1;i<N;i++){
ans1=0; ans2=0;
solve(1,N);
setRoad(ans1,ans2);
}
}
/*&int main(){
run(5);
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
460 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
460 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
17 ms |
492 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
34 ms |
460 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
42 ms |
460 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
17 ms |
496 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |