Submission #388881

# Submission time Handle Problem Language Result Execution time Memory
388881 2021-04-13T08:47:35 Z mariowong ICC (CEOI16_icc) C++14
0 / 100
11 ms 492 KB
#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];
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]]=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]]=i;
					pt[3]++;
				}
				c[0]=ans1;
				if (query(1,pt[3],c,d) == 0)
				nowl=nowmid+1;
				else
				nowr=nowmid;				
			}
			ans2=a[nowl];
		}
	}
}

void run(int N){
	for (int i=1;i<N;i++){
		ans1=0; ans2=0;
		solve(1,N);
		setRoad(ans1,ans2);
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 492 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 380 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 460 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 492 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -