This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |