結果
| 問題 |
No.3246 80% Accuracy Calculator
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2025-08-22 22:52:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 1,273 bytes |
| コンパイル時間 | 3,831 ms |
| コンパイル使用メモリ | 256,924 KB |
| 実行使用メモリ | 26,356 KB |
| 平均クエリ数 | 536.81 |
| 最終ジャッジ日時 | 2025-08-22 22:52:22 |
| 合計ジャッジ時間 | 8,140 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
コンパイルメッセージ
main.cpp: In function ‘int query(char)’:
main.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
26 | }
| ^
ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000005
#define Inf64 1000000000000000001LL
int query(char c){
map<int,int> mp;
rep(i,30){
cout<<"? "<<c<<endl;
int res;
cin>>res;
assert(res!=-1);
mp[res]++;
}
int ma = 0;
for(auto a:mp){
ma = max(ma,a.second);
}
for(auto a:mp){
if(ma==a.second)return a.first;
}
}
int add(char a,char b,char c){
cout<<"+ "<<a<<' '<<b<<' '<<c<<endl;
int z;
cin>>z;
assert(z!=-1);
return z;
}
int main(){
int x = query('A');
int y = query('B');
int curx = x;
while(true){
add('A','A','B');
if(query('B')==curx*2)break;
}
curx *= 2;
char cx,ans,trash;
int cans = 0;
if(y%2==1){
ans = 'A';
trash = 'C';
cx = 'B';
cans = x;
}
else{
ans = 'C';
cx = 'B';
trash = 'A';
}
y /= 2;
while(y!=0){
if(y%2==1){
cans += curx;
while(true){
// cout<<"fuga"<<curx<<endl;
add(cx,ans,trash);
if(query(trash)==cans)break;
}
swap(trash,ans);
}
y /= 2;
while(true){
//cout<<"hoge"<<curx<<endl;
add(cx,cx,trash);
if(query(trash)==curx*2)break;
}
swap(cx,trash);
curx *= 2;
}
cout<<"! "<<ans<<endl;
}
沙耶花