This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Why am I so dumb? :c
// chrono::system_clock::now().time_since_epoch().count()
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include "library.h"
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int MAXN = (int)1e3 + 5;
bool used[MAXN];
void Solve(int n) {
vector<int> vl, vr;
int l = 0, r = 0;
used[0] = 1;
vl.pb(0);
while (vl.size() + vr.size() < n) {
for (int i = 0; i < n; ++i) {
if (!used[i]) {
vector<int> V(n, 0);
V[l] = V[i] = 1;
if (Query(V) == 1) {
vl.pb(i);
l = i;
used[i] = 1;
break;
}
}
}
for (int i = 0; i < n; ++i) {
if (!used[i]) {
vector<int> V(n, 0);
V[r] = V[i] = 1;
if (Query(V) == 1) {
vr.pb(i);
r = i;
used[i] = 1;
break;
}
}
}
}
reverse(all(vl));
vector<int> ret;
for (int x : vl) {
ret.pb(x + 1);
}
for (int x : vr) {
ret.pb(x + 1);
}
Answer(ret);
}
Compilation message (stderr)
library.cpp: In function 'void Solve(int)':
library.cpp:36:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while (vl.size() + vr.size() < n) {
~~~~~~~~~~~~~~~~~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |