結果

問題 No.253 ロウソクの長さ
ユーザー BantakoBantako
提出日時 2018-06-01 00:18:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 731 bytes
コンパイル時間 1,492 ms
コンパイル使用メモリ 163,468 KB
実行使用メモリ 24,444 KB
平均クエリ数 20.69
最終ジャッジ日時 2023-09-24 01:46:54
合計ジャッジ時間 4,475 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
24,048 KB
testcase_01 AC 22 ms
24,348 KB
testcase_02 AC 23 ms
23,364 KB
testcase_03 AC 22 ms
23,340 KB
testcase_04 AC 24 ms
23,832 KB
testcase_05 AC 23 ms
23,520 KB
testcase_06 AC 23 ms
24,036 KB
testcase_07 AC 24 ms
23,532 KB
testcase_08 AC 24 ms
24,360 KB
testcase_09 AC 22 ms
24,336 KB
testcase_10 AC 24 ms
24,312 KB
testcase_11 AC 23 ms
24,060 KB
testcase_12 AC 23 ms
23,808 KB
testcase_13 AC 23 ms
23,652 KB
testcase_14 AC 22 ms
24,036 KB
testcase_15 AC 22 ms
23,436 KB
testcase_16 AC 22 ms
23,508 KB
testcase_17 AC 22 ms
23,520 KB
testcase_18 AC 24 ms
23,688 KB
testcase_19 AC 21 ms
24,156 KB
testcase_20 AC 23 ms
23,520 KB
testcase_21 AC 22 ms
24,048 KB
testcase_22 AC 23 ms
24,420 KB
testcase_23 AC 22 ms
23,352 KB
testcase_24 AC 21 ms
23,556 KB
testcase_25 AC 24 ms
23,664 KB
testcase_26 AC 24 ms
23,952 KB
testcase_27 AC 23 ms
24,444 KB
testcase_28 AC 24 ms
23,352 KB
testcase_29 AC 24 ms
23,340 KB
testcase_30 AC 23 ms
23,448 KB
testcase_31 AC 23 ms
23,652 KB
testcase_32 AC 24 ms
23,448 KB
testcase_33 AC 23 ms
24,072 KB
testcase_34 AC 23 ms
23,364 KB
testcase_35 AC 23 ms
24,048 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    7 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int cnt = 1,num;
    cout << "? 100" << endl;
    fflush(0);
    cin >> num;
    int ok,ng;
    if(num == 0){
        cout << "! 100" << endl;
        return 0;
    }else if(num == -1){
       ok = 100,ng = 0;
    }else{
        ok = INF,ng = 10;
    }
    while(num){
        int mid = (ok + ng) / 2;
        cout << "? " << mid << endl;
        fflush(0);
        cin >> num;
        if(num == 1)ng = mid;
        else if(num == -1)ok = mid;
        else cout << "! " << mid+cnt << endl;
        ok--;
        ng--;
        cnt++;
    }
    fflush(0);

}
0