답안 #969697

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
969697 2024-04-25T13:19:39 Z penguin133 Park (JOI17_park) C++17
20 / 100
386 ms 1368 KB
#include <bits/stdc++.h>
using namespace std;
#include "park.h"
//#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
static int Place[1400], p2[1400];
 
void dnc(vector <int> shit){
	if(shit.size() <= 1)return;
	vector <int> nxtstuff, die[7];
	int bru = shit[rng()%shit.size()];
	for(int i = 0; i < (int)shit.size(); i++){
		if(shit[i] == bru)continue;
		Place[bru] = Place[shit[i]] = 1;
		int a = bru, b = shit[i];
		if(a > b)swap(a, b);
		if(Ask(a, b, Place)){
			nxtstuff.push_back(shit[i]);
			Answer(a, b);
		}
		Place[bru] = Place[shit[i]] = 0;
	}
	for(int i = 0; i < 1400; i++)p2[i] = 0;
	for(auto i : shit)p2[i] = 1;
	for(auto i : shit){
		if(i == bru)continue;
		bool f = 0;
		for(auto j : nxtstuff)if(i == j)f = 1;
		if(f)continue;
		for(int j = 0; j < (int)nxtstuff.size(); j++){
			for(int k = 0; k < (int)nxtstuff.size(); k++)if(k != j)p2[nxtstuff[k]] = 0;
			int a = bru, b = i;
			if(a > b)swap(a, b);
			int res = Ask(a, b, p2);
			for(auto k : nxtstuff)p2[k] = 1;
			if(res){
				die[j].push_back(i);
				f = 1;
				break;
			}
		}
	}
	for(int i = 0; i < (int)nxtstuff.size(); i++){
		die[i].push_back(nxtstuff[i]);
		dnc(die[i]);
	}
}
 
void Detect(int T, int N) {
	if(T == 1){
		for(int i = 0; i < N; i++){
			for(int j = i + 1; j < N; j++){
				Place[i] = Place[j] = 1;
				if(Ask(i, j, Place))Answer(i, j);
				Place[i] = Place[j] = 0;
			}
		}
		return;
	}
	vector <int> lol;
	for(int i = 0; i < N; i++)lol.push_back(i);
	dnc(lol);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 6 ms 348 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 1368 KB Output is correct
2 Correct 65 ms 600 KB Output is correct
3 Correct 81 ms 600 KB Output is correct
4 Correct 84 ms 600 KB Output is correct
5 Correct 78 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 172 ms 588 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 148 ms 520 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 386 ms 852 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -