結果
| 問題 |
No.2753 鳩の巣原理
|
| コンテスト | |
| ユーザー |
hiromi_ayase
|
| 提出日時 | 2024-05-10 21:54:15 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 864 bytes |
| コンパイル時間 | 5,084 ms |
| コンパイル使用メモリ | 309,396 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 7.73 |
| 最終ジャッジ日時 | 2024-12-20 05:16:31 |
| 合計ジャッジ時間 | 10,149 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 23 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
int ask(int i) {
cout << "? " << i << endl;
int ret;
cin >> ret;
return ret;
}
void answerYes(int i, int j) {
cout << "Yes " << i << " " << j << endl;
}
void answerNo() {
cout << "No" << endl;
}
int main() {
FAST_IO
// 1 2 3 4 5 6 7 8
// 1 1 2 3 4 5 6 7
int N;
cin >> N;
int l = 0;
int r = N;
while (r - l > 1) {
int m = (l + r) / 2;
int a = ask(m);
if (a == m) {
l = m;
} else {
r = m;
}
}
if (l == 0) {
answerNo();
} else {
answerYes(l, r);
}
}
hiromi_ayase