제출 #1337586

#제출 시각아이디문제언어결과실행 시간메모리
1337586NikoBaoticMostovi (COI14_mostovi)C++20
컴파일 에러
0 ms0 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;
}

컴파일 시 표준 에러 (stderr) 메시지

mostovi.cpp: In function 'int main()':
mostovi.cpp:50:17: error: expected ',' or ';' before 'while'
   50 |                 while (x < y) {
      |                 ^~~~~