Submission #210377

#TimeUsernameProblemLanguageResultExecution timeMemory
210377tatyamCave (IOI13_cave)C++17
0 / 100
44 ms512 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; using uint = unsigned; #define rep(n) for(int i = 0; i < n; i++) #define each(i,a) for(auto&& i : a) #define all(a) begin(a), end(a) int n; int s[5000], d[5000]; int flag, x; vector<int> candidate; bool query(){ uint a = tryCombination(s); return a > x; } auto find(vector<int>::iterator begin, vector<int>::iterator end){ if(end - begin == 1) return begin; auto cen = begin + (end - begin) / 2; for(auto p = begin; p < cen; p++) *p = flag; for(auto p = cen; p < end; p++) *p = !flag; if(query()) return find(begin, cen); else return find(cen, end); } void find(int _x){ x = _x; each(i, candidate) s[i] = 1; flag = query(); auto p = find(all(candidate)); d[*p] = x; s[*p] = flag; candidate.erase(p); } void exploreCave(int N){ n = N; candidate.resize(n); iota(all(candidate), 0); rep(n) find(i); answer(s, d); }

Compilation message (stderr)

cave.cpp: In function 'bool query()':
cave.cpp:15:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     return a > x;
            ~~^~~
#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...