結果
問題 |
No.3246 80% Accuracy Calculator
|
ユーザー |
|
提出日時 | 2025-08-22 23:36:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 72 ms / 2,000 ms |
コード長 | 1,782 bytes |
コンパイル時間 | 1,897 ms |
コンパイル使用メモリ | 201,364 KB |
実行使用メモリ | 26,356 KB |
平均クエリ数 | 372.95 |
最終ジャッジ日時 | 2025-08-22 23:36:57 |
合計ジャッジ時間 | 6,397 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 43 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; //#define DEBUG int X = 2, Y = 3, Z = 0; vector<int> A = {2, 3, 0}; unsigned long long xor64() { static unsigned long long x = (unsigned long long)(chrono::duration_cast<chrono::nanoseconds>( chrono::high_resolution_clock::now().time_since_epoch()).count()) * 10150724397891781847ULL; x ^= x << 7; return x ^= x >> 9; } int main(){ ios::sync_with_stdio(false); cin.tie(0); constexpr int r = 19; array<int, r> tmp; auto ask1 = [&](char c){ for(int i = 0; i < r; i++){ cout << "? " << c << endl; #ifndef DEBUG cin >> tmp[i]; #else tmp[i] = xor64() % 10 < 8 ? A[c - 'A'] : xor64() % 1000; #endif } sort(tmp.begin(), tmp.end()); pair<int,int> mx; for(int i = 0; i < r; ){ int p = i; while(i < r && tmp[i] == tmp[p]) i++; mx = max(mx, make_pair(i - p, tmp[p])); } return mx.second; }; auto ask2 = [&](char c0, char c1, char c2){ int res; cout << "+ " << c0 << " " << c1 << " " << c2 << endl; #ifndef DEBUG cin >> res; assert(res == 0); #else A[c2 - 'A'] = xor64() % 10 < 8 ? A[c0 - 'A'] + A[c1 - 'A'] : xor64() % 1000; #endif }; int x = ask1('A'); int y = ask1('B'); int v = 0; char c0 = 'A', c1 = 'B', c2 = 'C'; while(y){ if(y & 1){ v += x; do{ ask2(c0, c2, c1); }while(ask1(c1) != v); swap(c1, c2); } do{ ask2(c0, c0, c1); }while(ask1(c1) != 2 * x); x += x; swap(c0, c1); y /= 2; } cout << "! " << c2 << endl; }