結果
| 問題 |
No.2252 Find Zero
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2023-03-24 21:24:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 2,000 ms |
| コード長 | 364 bytes |
| コンパイル時間 | 1,426 ms |
| コンパイル使用メモリ | 166,272 KB |
| 実行使用メモリ | 25,472 KB |
| 平均クエリ数 | 195.33 |
| 最終ジャッジ日時 | 2024-09-18 16:40:19 |
| 合計ジャッジ時間 | 3,807 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
int ans = -1;
for (int i = 0; i < N - 1; i += 2){
cout << "? " << i << ' ' << i + 1 << endl;
int z;
cin >> z;
if (z == i){
ans = i + 1;
}
if (z == i + 1){
ans = i;
}
}
if (ans == -1){
ans = N - 1;
}
cout << "! " << ans << endl;
}
SSRS