結果
| 問題 |
No.2753 鳩の巣原理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-11 15:14:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 69 ms / 2,000 ms |
| コード長 | 413 bytes |
| コンパイル時間 | 1,800 ms |
| コンパイル使用メモリ | 192,588 KB |
| 最終ジャッジ日時 | 2025-02-21 13:38:10 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int L = 1, R = N + 1;
//[L, R)
for (int i = 0; i < 10; i++) {
int mid = (L + R) / 2;
cout << "? " << mid << endl;
int res;
cin >> res;
if (res < mid) {
R = mid;
} else {
L = mid;
}
}
if (L == N) {
cout << "No" << endl;
} else {
cout << "Yes " << L << ' ' << R << endl;
}
}