# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
153989 |
2019-09-17T16:22:00 Z |
karma |
Library (JOI18_library) |
C++14 |
|
0 ms |
0 KB |
#include<bits/stdc++.h>
//#include "library.h"
#define pb emplace_back
#define ll long long
using namespace std;
const int N = int(2e3) + 7;
vector<int> m, ans, s;
int low, high, mid, cur;
void Solve(int n) {
if(n == 1) {Answer({1}); return;}
m.resize(n, 1); s.resize(n);
for(int i = 0; i < n; ++i) {
m[i] = 0;
if(Query(m) == 1) {cur = i; break;}
m[i] = 1;
}
iota(s.begin(), s.end(), 0);
ans.pb(cur + 1);
s.erase(find(s.begin(), s.end(), cur));
while(s.size()) {
low = 0, high = s.size() - 1;
while(low <= high) {
mid = (low + high) >> 1;
fill(m.begin(), m.end(), 0);
for(int i = 0; i <= mid; ++i) m[s[i]] = 0;
int res = Query(m);
m[cur] = 1;
if(res == Query(m)) high = mid - 1;
else low = mid + 1;
}
cur = s[low];
ans.pb(cur + 1);
s.erase(find(s.begin(), s.end(), cur));
}
Answer(ans);
}
Compilation message
library.cpp: In function 'void Solve(int)':
library.cpp:14:17: error: 'Answer' was not declared in this scope
if(n == 1) {Answer({1}); return;}
^~~~~~
library.cpp:18:11: error: 'Query' was not declared in this scope
if(Query(m) == 1) {cur = i; break;}
^~~~~
library.cpp:30:22: error: 'Query' was not declared in this scope
int res = Query(m);
^~~~~
library.cpp:39:5: error: 'Answer' was not declared in this scope
Answer(ans);
^~~~~~