# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1022984 | gyg | The Collection Game (BOI21_swaps) | C++17 | 38 ms | 1408 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 "swaps.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int MAX_N = 5e2 + 5;
int n;
array<int, MAX_N> n_beats;
void solve(int _n, int _v) {
n = _n;
int x = 1, y = 1;
while (!(x == n - 1 && y == n)) {
if (y != n) y++;
else x++;
vector<pii> queries;
int i = 0;
while (true) {
int new_x = x + i, new_y = y - i;
if (new_y <= new_x) break;
// Checks for repeats needed
queries.push_back({new_x, new_y});
schedule(new_x, new_y);
i++;
}
vector<int> resp = visit();
for (int i = 0; i < queries.size(); i++) {
if (resp[i] == 1) n_beats[queries[i].first]++;
else n_beats[queries[i].second]++;
}
}
// for (int i = 1; i <= n; i++) {
// cerr << i << ": " << n_beats[i] << endl;
// }
vector<int> ans(n);
for (int i = 1; i <= n; i++)
ans[n - n_beats[i] - 1] = i;
answer(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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |