提出 #74938947
ソースコード 拡げる
#include <iostream>
#include <vector>
using namespace std;
int main(){
int N; cin>>N;
int zero = 1, one = N;
while (one-zero>1){
int mid = (one+zero)/2;
cout<<"? "<<mid<<endl;
int S; cin>>S;
if (S==0){
zero = mid;
} else {
one = mid;
}
}
cout<<"! "<<zero<<endl;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | G - Find by Query |
| ユーザ | circled_9 |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 400 |
| コード長 | 305 Byte |
| 結果 | AC |
| 実行時間 | 5 ms |
| メモリ | 4068 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example0.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, example0.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 000.txt | AC | 3 ms | 3676 KiB |
| 001.txt | AC | 5 ms | 3924 KiB |
| 002.txt | AC | 5 ms | 3836 KiB |
| 003.txt | AC | 5 ms | 3860 KiB |
| 004.txt | AC | 5 ms | 4068 KiB |
| 005.txt | AC | 5 ms | 4044 KiB |
| 006.txt | AC | 5 ms | 3984 KiB |
| 007.txt | AC | 5 ms | 3932 KiB |
| 008.txt | AC | 5 ms | 3884 KiB |
| 009.txt | AC | 5 ms | 4064 KiB |
| 010.txt | AC | 5 ms | 3928 KiB |
| 011.txt | AC | 5 ms | 4000 KiB |
| 012.txt | AC | 4 ms | 3884 KiB |
| 013.txt | AC | 3 ms | 3840 KiB |
| 014.txt | AC | 3 ms | 3800 KiB |
| 015.txt | AC | 5 ms | 3908 KiB |
| 016.txt | AC | 5 ms | 3880 KiB |
| 017.txt | AC | 5 ms | 3928 KiB |
| example0.txt | AC | 2 ms | 3732 KiB |