結果
| 問題 |
No.1793 実数当てゲーム
|
| コンテスト | |
| ユーザー |
assy1028
|
| 提出日時 | 2021-12-23 13:35:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,793 bytes |
| コンパイル時間 | 1,058 ms |
| コンパイル使用メモリ | 111,752 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 2230.56 |
| 最終ジャッジ日時 | 2024-09-28 13:37:26 |
| 合計ジャッジ時間 | 3,926 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 9 |
ソースコード
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
#include <stdio.h>
#include <bitset>
#include <cassert>
using namespace std;
#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef tuple<int, int, vector<int>> T;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
template<typename T, typename U>
size_t operator()(const pair<T, U> &x) const {
size_t seed = hash<T>()(x.first);
return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);
double get_elapsed_time(struct timeval *begin, struct timeval *end) {
return (end->tv_sec - begin->tv_sec) * 1000
+ (end->tv_usec - begin->tv_usec) / 1000.0;
}
unsigned long xor128(void) {
static unsigned long x=123456789,y=362436069,z=521288629,w=88675123;
unsigned long t;
t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}
// [0, k)
int rand(int k) {
return xor128() % k;
}
random_device seed_gen;
ranlux24 engine(seed_gen());
double error(const double x, const double y) {
return min(abs(x - y) / x, abs(x - y));
}
void solve() {
int ub = 1;
while (pow(2, ub) < 1.222e75) ub++;
int lb = -1;
int i;
string s;
for (i = 0; i < 24; i++) {
if (ub - lb <= 1)
break;
const int m = (lb + ub) / 2;
const double v = pow(2, m);
cout << "? " << v << endl; cout.flush();
cin >> s;
if (s == "Yes") {
lb = m;
} else {
ub = m;
}
}
double lbt = (lb < 0 ? 0 : pow(2, lb));
double ubt = pow(2, ub);
for (int j = 0; j < 24-i; j++) {
const double m = (lbt + ubt) / 2;
cout << "? " << m << endl; cout.flush();
cin >> s;
if (s == "Yes") {
lbt = m;
} else {
ubt = m;
}
}
const double y = (lbt + ubt) / 2;
cout << "! " << y << endl; cout.flush();
}
void input() {
}
int main(int argc, char *argv[]) {
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed << setprecision(15);
int t;
cin >> t;
for (int i = 0; i < t; i++) {
//input();
solve();
}
}
assy1028