제출 #72089

#제출 시각아이디문제언어결과실행 시간메모리
72089IDxTree (#118)통행이 제한된 저택 (FXCUP3_key)C++17
0 / 100
4 ms1636 KiB
#include "key.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;

int ask(int a, int b){
	static map<pii, int> mem;
	if(a>b) swap(a,b);
	if(mem.find(pii(a,b))!=mem.end()) return mem[pii(a,b)];
	TakeKey(a); if(a!=b) TakeKey(b);
	return mem[pii(a,b)]=Explore();
}

void EnsureKeyInfo(int n){
	bool cango[1010][1010]={};
	for(int i=1; i<=n; i++) cango[i][i]=true;
	for(int i=1; i<=n; i++) for(int j=1; j<=n; j++){
//		cout<<ask(i,i)<<' '<<ask(i,j)<<'\n';

		bool &go=cango[j][i];
		if(!go)
			for(int k=1; k<=n; k++) if(cango[i][k]&&cango[k][j]) go=true;
		if(!go) go=ask(i,i)==ask(i,j);
		if(go) Report(i,j);
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...