結果

問題 No.253 ロウソクの長さ
ユーザー koba-e964koba-e964
提出日時 2015-07-24 23:18:27
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,110 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 85,532 KB
実行使用メモリ 24,360 KB
平均クエリ数 11.31
最終ジャッジ日時 2023-09-23 05:00:19
合計ジャッジ時間 6,476 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 27 ms
23,928 KB
testcase_02 AC 28 ms
23,544 KB
testcase_03 AC 27 ms
23,460 KB
testcase_04 AC 28 ms
24,192 KB
testcase_05 AC 27 ms
23,712 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 27 ms
23,448 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 27 ms
23,580 KB
testcase_15 AC 28 ms
23,952 KB
testcase_16 AC 27 ms
24,192 KB
testcase_17 AC 28 ms
23,304 KB
testcase_18 WA -
testcase_19 AC 27 ms
24,180 KB
testcase_20 WA -
testcase_21 AC 26 ms
23,892 KB
testcase_22 AC 27 ms
24,180 KB
testcase_23 WA -
testcase_24 AC 27 ms
23,400 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 26 ms
23,532 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS=1e-9;

ll query(ll lo, ll hi, int &nq) {
  while (hi - lo >= 2) {
    ll mid = (hi + lo) / 2;
    cout << "? " << mid - nq << endl;
    int res;
    cin >> res;
    nq++;
    if (res == 0) {
      return mid;
    }
    if (res > 0) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  return lo;
}

int main(void){
  cin.sync_with_stdio(false);
  int nq = 0;
  ll res = query(10, 1024, nq);
  if (res <= 1000) {
    cout << "! " << res << endl;
    return 0;
  }
  cout << "! " << query(100, 1e9 + 1, nq) << endl;
}
0