結果

問題 No.246 質問と回答
ユーザー neckrawarmerneckrawarmer
提出日時 2021-11-22 22:08:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 2,759 bytes
コンパイル時間 9,107 ms
コンパイル使用メモリ 346,984 KB
実行使用メモリ 24,420 KB
平均クエリ数 30.87
最終ジャッジ日時 2023-09-23 20:38:39
合計ジャッジ時間 13,298 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
23,640 KB
testcase_01 AC 42 ms
23,460 KB
testcase_02 AC 41 ms
23,412 KB
testcase_03 AC 41 ms
23,448 KB
testcase_04 AC 42 ms
23,616 KB
testcase_05 AC 41 ms
23,724 KB
testcase_06 AC 41 ms
24,216 KB
testcase_07 AC 41 ms
24,288 KB
testcase_08 AC 41 ms
23,484 KB
testcase_09 AC 40 ms
23,832 KB
testcase_10 AC 41 ms
23,976 KB
testcase_11 AC 40 ms
23,472 KB
testcase_12 AC 41 ms
24,348 KB
testcase_13 AC 41 ms
23,664 KB
testcase_14 AC 41 ms
24,312 KB
testcase_15 AC 41 ms
23,388 KB
testcase_16 AC 41 ms
24,036 KB
testcase_17 AC 42 ms
24,420 KB
testcase_18 AC 41 ms
23,640 KB
testcase_19 AC 42 ms
23,436 KB
testcase_20 AC 42 ms
24,000 KB
testcase_21 AC 42 ms
23,400 KB
testcase_22 AC 42 ms
23,388 KB
testcase_23 AC 42 ms
24,360 KB
testcase_24 AC 41 ms
23,412 KB
testcase_25 AC 41 ms
23,964 KB
testcase_26 AC 42 ms
23,724 KB
testcase_27 AC 42 ms
23,724 KB
testcase_28 AC 41 ms
23,604 KB
testcase_29 AC 43 ms
23,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
#endif
using ll = long long;
using ld = long double;
const ll INF = 1ll<<60;
const ld EPS = 1.0/1e9;
#define endl "\n"
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(x) (x).begin(),(x).end()
#define del(x) sort(all(x)); x.erase(unique(all(x)),x.end());

#define DEBUG_

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
template<typename T>
ostream& operator << (ostream &os, vector<T>& vec){
  os << "{";
  for(int i=0;i<vec.size();i++){
    os << vec[i] << (i+1==vec.size() ? "" : ", ");
  }
  os << "}";
  return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}

#define DUMPOUT cerr

void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

signed main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll ok=0, ng=(ll)1e9;
  while(abs(ok-ng)>1){
    ll mid=(ok+ng)/2;
    cout << "? " << mid << endl;
    flush(cout);
    int T; cin >> T;
    if(T) ok=mid;
    else ng=mid;
  }
  cout << "! " << ok << endl;
}
0