# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1015023 | hmm789 | Mouse (info1cup19_mouse) | C++14 | 1 ms | 344 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 "grader.h"
#include <bits/stdc++.h>
using namespace std;
void solve(int n) {
vector<int> v, ans;
for(int i = 0; i < n; i++) {
v.push_back(2);
ans.push_back(-1);
}
for(int i = 0; i < n; i++) {
v[i] = 1;
if(query(v) == 2) ans[i] = 1;
v[i] = 2;
}
for(int i = 2; i < n; i++) {
vector<int> pos;
for(int j = 0; j < n; j++) {
if(ans[j] == -1) pos.push_back(j);
v[j] = ans[j];
}
int l = 0, r = pos.size()-1, m;
while(l < r) {
m = (l+r)/2;
for(int j = 0; j <= m; j++) v[pos[j]] = i;
for(int j = m+1; j < pos.size(); j++) v[pos[j]] = 1;
if(query(v) == i) r = m;
else l = m+1;
}
ans[pos[l]] = i;
}
for(int i = 0; i < n; i++) if(ans[i] == -1) ans[i] = n;
query(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |