Submission #72089

# Submission time Handle Problem Language Result Execution time Memory
72089 2018-08-26T05:12:18 Z IDxTree(#2155, TAMREF, imeimi2000, Diuven) Key of Impassable Doors (FXCUP3_key) C++17
0 / 100
4 ms 1636 KB
#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 time Memory Grader output
1 Correct 3 ms 1272 KB Output is correct
2 Runtime error 4 ms 1636 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1272 KB Output is correct
2 Runtime error 4 ms 1636 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1272 KB Output is correct
2 Runtime error 4 ms 1636 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -