| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1337586 | NikoBaotic | Mostovi (COI14_mostovi) | C++20 | 0 ms | 0 KiB |
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
#define F first
#define S second
#define FIO ios_base::sync_with_stdio(false); cin.tie(0)
#define sz(x) ((int)((x).size()))
#define all(x) x.begin(), x.end()
#define pb push_back
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1e6 + 10;
int na, nb;
bool cmp(int a, int b) {
if (b == na + nb + 1) return 0;
if (a == na + nb + 1) return 1;
if (a == b) return 0;
cout << "cmp " << a << " " << b << endl;
int x;
cin >> x;
return x == 1;
}
void rev(int a, int b) {
if (a == b) return;
cout << "reverse " << a << " " << b << endl;
}
int main() {
FIO;
cin >> na >> nb;
int tar = na;
for (int l = 1; l <= tar; l++) {
if (tar + 1 == na + nb + 1) break;
int x = tar;
int y = na + nb + 1
while (x < y) {
int mid = (x + y + 1) / 2;
if (cmp(l, mid)) {
r = mid - 1;
} else {
l = mid;
}
}
if (tar + 1 <= x) {
int cnt = x - tar;
rev(l, x);
rev(l, l + cnt);
rev(l + cnt + 1, x);
l += cnt;
tar += cnt;
}
}
cout << "end" << endl;
return 0;
}
