Submission #127000

#TimeUsernameProblemLanguageResultExecution timeMemory
127000Bench0310Cave (IOI13_cave)C++17
46 / 100
733 ms920 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int n) { mt19937 rng(14); set<int> s; for(int i=0;i<n;i++) s.insert(i); vector<bool> vis(n,0); int b[n],d[n]; for(int i=0;i<n;i++) b[i]=0; int now=tryCombination(b); while(now!=-1) { set<int> t=s; vector<bool> v=vis; while(1) { int r=uniform_int_distribution<int>(0,n-1)(rng); if(v[r]) { if(t.lower_bound(r)!=s.end()) r=*t.lower_bound(r); else r=*t.begin(); } v[r]=1; t.erase(r); b[r]=1-b[r]; int guess=tryCombination(b); if(guess>now||guess==-1) { now=guess; s.erase(r); vis[r]=1; break; } if(guess<now) { s.erase(r); vis[r]=1; } b[r]=1-b[r]; } } for(int i=0;i<n;i++) { b[i]=1-b[i]; int t=tryCombination(b); d[i]=t; b[i]=1-b[i]; } answer(b,d); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...