답안 #854228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
854228 2023-09-26T11:59:18 Z Trisanu_Das Colors (BOI20_colors) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
using int = long long;
 
bool query(int i) {
	cout << "? " << i << '\n';
	cin >> i;
	return i;
}
 
int main() {
	int N; cin >> N;
	int i = 0, l = 1, r = N, d = -1;
	for(; l < r; d = -d) {
		l = (l + r - 1) >> 1;
		i = max(i, 1ll - (c += d * l++));
	}
	query(i);
	l = 1, r = N, d = -1;
	for(; l < r; d = -d) {
		int m = (l + r - 1) >> 1;
		if(query(i += d * m)) r = m;
		else l = m + 1;
	}
	cout << "= " << l << '\n';
}

Compilation message

Colors.cpp:3:7: error: expected nested-name-specifier before 'int'
    3 | using int = long long;
      |       ^~~
Colors.cpp: In function 'int main()':
Colors.cpp:16:21: error: 'c' was not declared in this scope
   16 |   i = max(i, 1ll - (c += d * l++));
      |                     ^