結果
問題 |
No.3246 80% Accuracy Calculator
|
ユーザー |
![]() |
提出日時 | 2025-08-22 22:41:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,103 bytes |
コンパイル時間 | 4,239 ms |
コンパイル使用メモリ | 266,304 KB |
実行使用メモリ | 26,356 KB |
平均クエリ数 | 59.35 |
最終ジャッジ日時 | 2025-08-22 22:42:06 |
合計ジャッジ時間 | 8,481 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 TLE * 1 -- * 33 |
ソースコード
/** author: shobonvip created: 2025.08.22 22:33:26 **/ #include<bits/stdc++.h> using namespace std; //* ATCODER #include<atcoder/all> using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include<boost/multiprecision/cpp_int.hpp> using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) #define all(v) v.begin(), v.end() template <typename T> bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template <typename T> bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template <typename T> T max(vector<T> &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template <typename T> T min(vector<T> &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template <typename T> T sum(vector<T> &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int x,y; auto ask=[&](char c) -> int { map<int,int> mp; rep(num,0,31){ cout<<'?'<<' '<<c<<endl; int w;cin>>w; mp[w]++; } int tar=-1; int val=-1; for(auto[x,y]:mp){ if(chmax(tar,y))val=x; } return val; }; map<char,int> kakuno; kakuno['A']=ask('A'); kakuno['B']=ask('B'); kakuno['C']=0; auto add=[&](char a,char b,char c) -> void { kakuno[c]=kakuno[a]+kakuno[b]; while(true){ cout<<'+'<<' '<<a<<' '<<b<<' '<<c<<endl; if(ask(c)==kakuno[c])break; } return; }; x=kakuno['A']; y=kakuno['B']; vector<int> a; while(x>0){ a.push_back(x&1); x>>=1; } reverse(all(a)); char c='B'; rep(i,1,(int)a.size()){ if(c=='B'){add(c,c,'C');c='C';} else if(c=='A'){add(c,c,'C');c='C';} else if(c=='C'){add(c,c,'A');c='A';} if(a[i]==1){ if(c=='A'){add(c,'B','C');c='C';} else if(c=='C'){add(c,'B','A');c='A';} } } cout<<'!'<<' '<<c<<endl; }