#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define L(i,j,k) for(int i=(j);i<=(k);++i)
#define R(i,j,k) for(int i=(j);i>=(k);--i)
#define rep(i, n) L(i, 1, n)
#define all(x) x.begin(),x.end()
#define me(x,a) memset(x,a,sizeof(x))
#include<random>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include "swaps.h"
const int nax = 505;
int a[nax];
void N2(int N, int V) {
L(i, 1, N) a[i] = i;
L(i, 1, N) L(j, i + 1, N) {
schedule(a[i], a[j]);
vector<int> res = visit();
if (res[0] == 0) swap(a[i], a[j]);
}
vector<int> ans;
L(i, 1, N) ans.push_back(a[i]);
answer(ans);
return;
}
void merge(int l, int r) {
if (l == r) return;
int mid = (l + r) >> 1;
merge(l, mid); merge(mid + 1, r);
int LP = l, RP = mid + 1;
vector<int> T;
while (1) {
if (LP <= mid && RP <= r) {
schedule(a[LP], a[RP]);
vector<int> res = visit();
if (res[0] == 1) {
T.push_back(a[LP]);
LP++;
}
else {
T.push_back(a[RP]);
RP++;
}
}
else if (LP == mid + 1 && RP <= r) {
T.push_back(a[RP]);
RP++;
}
else if (LP <= mid && RP == r + 1) {
T.push_back(a[LP]);
LP++;
}
if (LP == mid + 1 && RP == r + 1) break;
}
L(i, l, r) a[i] = T[i - l];
}
void merge_sol(int N, int V) {
L(i, 1, N) a[i] = i;
merge(1, N);
vector<int> ans;
L(i, 1, N) ans.push_back(a[i]);
answer(ans);
return;
}
void solve(int N, int V) {
int costN_2 = 0;
L(i, 1, N) L(j, i + 1, N) costN_2++;
if (costN_2 <= V) N2();
if (N <= 500 && N * 9 <= V) merge_sol(N, V);
return;
}
Compilation message
swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:74:23: error: too few arguments to function 'void N2(int, int)'
74 | if (costN_2 <= V) N2();
| ^
swaps.cpp:19:6: note: declared here
19 | void N2(int N, int V) {
| ^~