結果

問題 No.246 質問と回答
ユーザー JohnNakazawaJohnNakazawa
提出日時 2015-07-17 22:43:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 1,712 bytes
コンパイル時間 1,327 ms
コンパイル使用メモリ 143,800 KB
実行使用メモリ 24,312 KB
平均クエリ数 101.00
最終ジャッジ日時 2023-09-23 19:52:30
合計ジャッジ時間 3,870 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
23,484 KB
testcase_01 AC 42 ms
24,168 KB
testcase_02 AC 39 ms
24,264 KB
testcase_03 AC 39 ms
23,520 KB
testcase_04 AC 39 ms
23,244 KB
testcase_05 AC 39 ms
23,472 KB
testcase_06 AC 40 ms
23,808 KB
testcase_07 AC 39 ms
24,180 KB
testcase_08 AC 39 ms
24,192 KB
testcase_09 AC 39 ms
23,604 KB
testcase_10 AC 39 ms
24,312 KB
testcase_11 AC 40 ms
24,312 KB
testcase_12 AC 39 ms
23,328 KB
testcase_13 AC 39 ms
23,796 KB
testcase_14 AC 39 ms
24,168 KB
testcase_15 AC 38 ms
23,844 KB
testcase_16 AC 39 ms
23,280 KB
testcase_17 AC 39 ms
24,144 KB
testcase_18 AC 39 ms
23,604 KB
testcase_19 AC 39 ms
23,844 KB
testcase_20 AC 41 ms
23,340 KB
testcase_21 AC 40 ms
23,400 KB
testcase_22 AC 39 ms
23,244 KB
testcase_23 AC 40 ms
23,904 KB
testcase_24 AC 40 ms
24,180 KB
testcase_25 AC 39 ms
23,376 KB
testcase_26 AC 39 ms
24,264 KB
testcase_27 AC 38 ms
23,628 KB
testcase_28 AC 38 ms
24,084 KB
testcase_29 AC 39 ms
23,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef ostringstream OSS;
typedef istringstream ISS;

typedef long long LL;
typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<PII> VPII;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x) (x).begin(),(x).end()
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
#define REP(i, init, N) for (int i = (init); i < (int)(N); i++)

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); };

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const double EPS = 1e-12;
//const double PI = acos(-1.0);

const LL himitu = 5;

int hoge(LL y) {
    return himitu >= y ? 1 : 0;
}

int main(void) {
    LL h = 1;
    LL t = 1000 * 1000 * 1000;
    for (int i = 0; i < 100; i++) {
        LL m = (h + t) / 2LL;
        cout << "? " << m << endl;
        int res;
        cin >> res;
//        res = hoge(m);
        if (res) {
            h = m;
        } else {
            t = m;
        }
    }

    cout << "! " << h << endl;

	return 0;
}
0