답안 #969968

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
969968 2024-04-26T02:47:57 Z LCJLY Park (JOI17_park) C++14
0 / 100
1 ms 604 KB
#include "park.h"

//code
//Answer(a,b)
//Ask(a,b,Place)
#include <bits/stdc++.h>
using namespace std;

#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<long long,long long>pii;
typedef pair<int,pii>pi2;

int m=0;
vector<pii>edge;
int cnt=10;
void dnc(int l, int r){
	int lft=0;
	int rgt=m-1;
	int mid;
	int best=rgt+1;
	
	if(cnt-- == 0){
		exit(0);
	}
	
	while(lft<=rgt){
		mid=(lft+rgt)/2;
		int v[m];
		memset(v,0,sizeof(v));
		for(int x=0;x<=mid;x++){
			v[x]=1;
		}
		v[l]=1;
		v[r]=1;
		//show4(v,v);
		//show2(l,l,r,r);
		bool amos=Ask(min(l,r),max(l,r),v);
		if(amos){
			rgt=mid-1;
		}
		else{
			best=mid;
			lft=mid+1;
		}
	}
	
	if(best==m){
		edge.push_back({l,r});
	}
	else{
		//show(best,best+1);
		dnc(l,best+1);
		dnc(best+1,r);
	}
}

void Detect(int t, int n) {
	show2(t,t,n,n);
	m=n;
	dnc(0,n-1);
	
	for(auto &it:edge){
		if(it.first>it.second) swap(it.first,it.second);
		//show2(it.first,it.first,it.second,it.second);
		Answer(it.first,it.second);
	}
}
//code
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Program terminated incorrectly, or you printed something to stdout
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 604 KB Program terminated incorrectly, or you printed something to stdout
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Program terminated incorrectly, or you printed something to stdout
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Program terminated incorrectly, or you printed something to stdout
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 540 KB Program terminated incorrectly, or you printed something to stdout
2 Halted 0 ms 0 KB -