結果
| 問題 |
No.246 質問と回答
|
| コンテスト | |
| ユーザー |
JohnNakazawa
|
| 提出日時 | 2015-07-17 22:43:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 55 ms / 2,000 ms |
| コード長 | 1,712 bytes |
| コンパイル時間 | 1,145 ms |
| コンパイル使用メモリ | 159,316 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 101.00 |
| 最終ジャッジ日時 | 2024-07-16 19:40:32 |
| 合計ジャッジ時間 | 4,321 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#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;
}
JohnNakazawa