# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
989637 | canadavid1 | Ancient Machine 2 (JOI23_ancient2) | C++17 | 149 ms | 1556 KiB |
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 "ancient2.h"
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
namespace {
int variable_example = 1;
} // namespace
std::string Solve(int N) {
// query one bit:
// a[i], b[i] = i+1
// a[b] = 1000
// b[b] = 1001
// a,b[1001] = 1001
// a,b[1000] = 1000
std::vector<int> a(N+2);
std::iota(a.begin(),a.begin()+N,1);
a[N] = N;
a[N+1] = N+1;
auto b = a;
std::string s;
for(int i = 0; i < N; i++)
{
a[i] = N;
b[i] = N+1;
s.push_back((Query(N+2,a,b)>N) ? '1' : '0');
a[i] = i+1;
b[i] = i+1;
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |