Submission #587073

#TimeUsernameProblemLanguageResultExecution timeMemory
587073FatihSolakCave (IOI13_cave)C++17
100 / 100
366 ms636 KiB
#include "cave.h" #include <bits/stdc++.h> #define N 5000 using namespace std; int get(int s[]){ int ret = tryCombination(s); if(ret == -1)ret = 1e9; return ret; } void exploreCave(int n) { int s[n],d[n]; vector<int> rem; for(int i = 0;i<n;i++){ s[i] = 0; d[i] = -1; rem.push_back(i); } for(int i = 0;i<n;i++){ bool val = get(s) > i; vector<int> tmp = rem; while(tmp.size() > 1){ vector<int> a; while(a.size() < tmp.size()){ a.push_back(tmp.back()); tmp.pop_back(); } for(auto u:a){ s[u] = 1; } if( (get(s) > i) != val){ tmp = a; } for(auto u:a){ s[u] = 0; } } vector<int> nw; for(auto u:rem){ if(u != tmp[0]) nw.push_back(u); } rem = nw; d[tmp[0]] = i; s[tmp[0]] = !val; } answer(s,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...