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 "library.h"
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
bool SEND = 1;
//int Query(const std::vector<int>& M);
//void Answer(const std::vector<int>& res);
int n, a[2222];
int ask (const std::vector < int > &m) {
if (SEND) {
return Query(m);
}
int l = -1, r = -1;
for (int i = 1; i <= n; i ++) {
if (m[a[i]-1]) {
if (r == -1) l = i;
r = i;
}
}
if (r == -1) assert(0);
return r - l;
}
void print (const std:: vector <int> &res) {
if (SEND) {
Answer(res);
} else {
for (auto x : res)
cout << x << ' ';
cout << '\n';
exit(0);
}
}
void Solve(int n) {
vector <int> m(n, 0);
m[0] = 1;
int mx = 0, p = 0;
for(int i = 1; i < n; i ++) {
m[i] = 1;
int x;
x = ask(m);
if (x > mx) {
mx = x;
p = i;
}
m[i] = 0;
}
vector < pair < int, int > > res;
m[0] = 0;
for (int i = 0; i < n; i ++) {
m[p] = 1;
m[i] = 1;
res.pb({ask(m), i+1});
m[p] = 0;
m[i] = 0;
}
sort(res.begin(), res.end());
vector < int > ans;
for (int i = 0; i < n; i ++)
ans.pb(res[i].second);
print(ans);
}
// B...a
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |