# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
570338 |
2022-05-29T08:54:39 Z |
Spade1 |
Library (JOI18_library) |
C++14 |
|
1 ms |
208 KB |
#include<bits/stdc++.h>
#include "library.h"
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ll long long
#define ld long double
#define st first
#define nd second
#define pb push_back
#define INF INT_MAX
using namespace std;
bool mark[1010];
void Solve(int N) {
int l = 2, r = N;
vector<int> ans;
while (l < r) {
vector<int> tst(N, 0);
int mid = (l+r+1)/2;
for (int i = 2; i <= mid; ++i) {
tst[i-1] = 1;
}
int tmp = Query(tst);
tst[0] = 1;
if (Query(tst) > tmp) r = mid-1;
else l = mid;
}
ans.pb(1);
ans.pb(l);
vector<int> rmn;
for (int i = 1; i <= N; ++i) {
if (i==1 || i==l) continue;
rmn.pb(i);
}
while (true) {
int l = 0, r = rmn.size();
while (l < r) {
vector<int> tst(N, 0);
int mid = (l+r+1)/2;
for (int i = 1; i <= mid; ++i) {
tst[rmn[i-1]-1] = 1;
}
int tmp = Query(tst);
tst[rmn.back()] = 1;
if (Query(tst) > tmp) r = mid-1;
else l = mid;
}
if (l == rmn.size()) break;
else {
ans.pb(rmn[l]);
rmn.erase(rmn.begin()+l);
}
}
reverse(ans.begin(), ans.end());
while (true) {
int l = 0, r = rmn.size();
while (l < r) {
vector<int> tst(N, 0);
int mid = (l+r+1)/2;
for (int i = 1; i <= mid; ++i) {
tst[rmn[i-1]-1] = 1;
}
int tmp = Query(tst);
tst[rmn.back()] = 1;
if (Query(tst) > tmp) r = mid-1;
else l = mid;
}
if (l == rmn.size()) break;
else {
ans.pb(rmn[l]);
rmn.erase(rmn.begin()+l);
}
}
Answer(ans);
}
Compilation message
library.cpp: In function 'void Solve(int)':
library.cpp:52:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
52 | if (l == rmn.size()) break;
| ~~^~~~~~~~~~~~~
library.cpp:74:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
74 | if (l == rmn.size()) break;
| ~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |