結果
| 問題 |
No.2252 Find Zero
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2023-05-18 16:42:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 629 bytes |
| コンパイル時間 | 285 ms |
| コンパイル使用メモリ | 41,288 KB |
| 実行使用メモリ | 25,580 KB |
| 平均クエリ数 | 78.39 |
| 最終ジャッジ日時 | 2024-12-16 06:50:00 |
| 合計ジャッジ時間 | 3,316 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 4 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 2252.cc: No.2252 Find Zero - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
/* global variables */
/* subroutines */
int query(int i, int j) {
printf("? %d %d\n", i, j); fflush(stdout);
int x;
scanf("%d", &x);
return x;
}
/* main */
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i += 2) {
int j = i + 1;
int x = query(i, j);
if (i == x || j == x) {
printf("! %d\n", (x != i) ? i : j); fflush(stdout);
return 0;
}
}
printf("! %d\n", n - 1); fflush(stdout);
return 0;
}
tnakao0123