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 "art.h"
#include <bits/stdc++.h>
using namespace std;
int sum = 0;
vector<int> v;
map<pair<int, int>, int> vis, mp;
int done(int &a, int &b) {
if (!vis[{a, b}]) {
vis[{a, b}] = 1;
vis[{b, a}] = 1;
swap(a, b);
int now = publish(v);
swap(a, b);
mp[{a, b}] = (sum-now) < 0;
mp[{b, a}] = !mp[{a, b}];
} return mp[{a, b}];
}
void solve(int n) {
v.resize(n);
for (int i = 0; i < n; i++) v[i] = i+1;
sum = publish(v);
while (sum) {
for (int i = 0; i < n-1; i++) {
if (!done(v[i], v[i+1])) {
swap(v[i], v[i+1]);
sum--;
}
}
} answer(v);
}
Compilation message (stderr)
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
20 | if(v.size() != N) {
| ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
36 | if(v.size() != N) {
| ~~~~~~~~~^~~~
# | 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... |