結果
問題 |
No.3246 80% Accuracy Calculator
|
ユーザー |
![]() |
提出日時 | 2025-08-22 23:41:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 55 ms / 2,000 ms |
コード長 | 3,135 bytes |
コンパイル時間 | 4,597 ms |
コンパイル使用メモリ | 264,080 KB |
実行使用メモリ | 25,972 KB |
平均クエリ数 | 596.65 |
最終ジャッジ日時 | 2025-08-22 23:42:05 |
合計ジャッジ時間 | 8,674 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 43 |
ソースコード
#include "atcoder/fenwicktree.hpp" #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using isize = size_t; using i32 = int; using u32 = unsigned int; using i64 = long long; using u64 = unsigned long long; using i128 = __int128_t; using u128 = __uint128_t; using f64 = long double; using p2 = pair<i64, i64>; using el = tuple<i64, i64, i64>; using mint = atcoder::modint998244353; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } i64 pow(i64 x, i64 n) { i64 res = 1; i64 t = x; while (n > 0) { if (n & 1) { res = res * t; } t = t * t; n >>= 1; } return res; } i64 pow(i64 x, i64 n, i64 m) { i64 res = 1; i64 t = x % m; while (n > 0) { if (n & 1) { res = res * t % m; } t = t * t % m; n >>= 1; } return res; } vector<vector<mint>> mul(vector<vector<mint>> &a, vector<vector<mint>> &b) { vector<vector<mint>> res(a.size(), vector<mint>(b[0].size(), 0)); assert(a[0].size() == b.size()); for (i64 i = 0; i < a.size(); i++) { for (i64 j = 0; j < b[0].size(); j++) { for (i64 k = 0; k < b.size(); k++) { res[i][j] += a[i][k] * b[k][j]; } } } return res; } vector<vector<mint>> pow(vector<vector<mint>> &a, i64 n) { assert(a.size() == a[0].size()); vector<vector<mint>> res(a.size(), vector<mint>(a[0].size(), 0)); vector<vector<mint>> t = a; for (i64 i = 0; i < a.size(); i++) res[i][i] = 1; while (n > 0) { if (n & 1) { vector<vector<mint>> nres = mul(res, t); swap(res, nres); } vector<vector<mint>> nt = mul(t, t); swap(nt, t); n >>= 1; } return res; } void _main() { i64 m = 30; // f64 p = 0; // for (i64 i = 0; i <= m; i++) { // i64 j = m - i; // // 20 C i * (0.2)^j * (0.8)^i // f64 cur = 1; // for (i64 k = 1; k <= m; k++) cur *= k; // for (i64 k = 1; k <= i; k++) cur /= k; // for (i64 k = 1; k <= j; k++) cur /= k; // cur *= pow(0.2, j) * pow(0.8, i); // if (j >= i) { // p += cur; // } // } // cout << p << "\n"; // return; auto input = [&](char c) { map<i64, i64> mp; for (i64 k = 0; k < m; k++) { cout << "? " << c << "\n"; cout.flush(); i64 x; cin >> x; mp[x]++; } i64 res = -1, mx = -1; for (auto [c, x] : mp) { if (mx < x) { res = c; mx = x; } } return res; }; i64 x, y; x = input('A'), y = input('B'); char t = 'A', res = 'C', em = 'B'; i64 T = x, RES = 0; while (y > 0) { if (y & 1) { RES += T; while (true) { cout << "+ " << res << " " << t << " " << em << "\n"; cout.flush(); i64 ok; cin >> ok; assert(ok == 0); i64 x = input(em); if (x == RES) break; } swap(res, em); } T += T; while (true) { cout << "+ " << t << " " << t << " " << em << "\n"; cout.flush(); i64 ok; cin >> ok; assert(ok == 0); i64 x = input(em); if (x == T) break; } swap(t, em); y >>= 1; } cout << "! " << res << "\n"; cout.flush(); }