답안 #970370

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
970370 2024-04-26T12:34:58 Z emptypringlescan Park (JOI17_park) C++17
47 / 100
117 ms 848 KB
#include <bits/stdc++.h>
using namespace std;
#include "park.h"
int n;
unordered_set<long long> done,ok;
int cur;
void dnc(int a, int b, int h){
	ok.insert(a); ok.insert(b);
	if(a>b) swap(a,b);
	if(done.find(a*2000+b)!=done.end()) return;
	done.insert(a*2000+b);
	if(b<cur) return;
	assert(a!=b);
	assert(a>=0&&b>=0);
	int lo=0,hi=h,mid;
	while(lo<hi){
		mid=(lo+hi)/2;
		int place[n];
		for(int i=0; i<mid; i++) place[i]=1;
		for(int i=mid; i<n; i++) place[i]=0;
		place[a]=1; place[b]=1;
		int x=Ask(a,b,place);
		if(x) hi=mid;
		else lo=mid+1;
	}
	if(lo==0) Answer(a,b);
	else{
		dnc(a,lo-1,lo);
		dnc(lo-1,b,lo);
	}
}
void Detect(int t, int N){
	n=N;
	if(t==1){
		int place[n];
		for(int i=0; i<n; i++) place[i]=0;
		for(int i=0; i<n; i++){
			for(int j=i+1; j<n; j++){
				place[i]=1;
				place[j]=1;
				int x=Ask(i,j,place);
				if(x) Answer(i,j);
				place[i]=0;
				place[j]=0;
			}
		}
	}
	else if(t==2){
		dnc(0,n-1,n);
	}
	else{
		for(int i=1; i<n; i++){
			if(ok.find(i)!=ok.end()) continue;
			cur=i,dnc(0,i,n);
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 412 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 604 KB Output is correct
2 Correct 64 ms 848 KB Output is correct
3 Correct 46 ms 604 KB Output is correct
4 Correct 19 ms 612 KB Output is correct
5 Correct 19 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 700 KB Output is correct
2 Correct 78 ms 700 KB Output is correct
3 Correct 86 ms 848 KB Output is correct
4 Correct 72 ms 644 KB Output is correct
5 Correct 92 ms 600 KB Output is correct
6 Correct 71 ms 600 KB Output is correct
7 Correct 73 ms 744 KB Output is correct
8 Correct 78 ms 740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 600 KB Output is correct
2 Incorrect 62 ms 756 KB Wrong Answer[5]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 117 ms 604 KB Wrong Answer[6]
2 Halted 0 ms 0 KB -