QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#709319#7703. Base Hi-Lo Gamerand123WA 0ms3548kbC++141.9kb2024-11-04 13:58:142024-11-04 13:58:14

Judging History

你现在查看的是最新测评结果

  • [2024-11-04 13:58:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3548kb
  • [2024-11-04 13:58:14]
  • 提交

answer

#include <bits/stdc++.h>
#define pii pair<int,int>
#define pb push_back
#define yes "YES"
#define no "NO"
#define ll long long
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define MOD2 998244353
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll b;
char cvt(int a){
    if (a<=9) return a+'0';
    if (a<=35) return (a-10+'A');
    return a-35 + 'a';
}
void solve(int cas){
    int d; cin>>d;
    vector<ll> lp(d, 0), rp (d, b - 1);
    vector<map<ll,char>> r(d);
    while (1){
        string s;
        for (int i = 0; i < d; i++) s.pb(cvt((lp[i]+rp[i])/2));
        cout<<s<<endl;
        string res; cin>>res;
        if (res=="correct") return;
        bool bad = false;
        for (int i = 0; i < d; i++){
            if (r[i].count((lp[i]+rp[i])/2) && r[i][(lp[i]+rp[i])/2]!=res[i]){
                cout<<"cheater"<<endl;
                return;
            }
            r[i][(lp[i] + rp[i])/2] = res[i];
            ll mid = (lp[i] + rp[i])/2;
            if (res[i]=='='){
                lp[i] = rp[i] = mid;
            }
            else if (res[i] == '-'){
                if (mid==lp[i]){
                    cout<<"cheater"<<endl;
                    return;
                }
                rp[i] = mid - 1;
            }
            else if (res[i]=='+'){
                if (mid==rp[i]){
                    cout<<"cheater"<<endl;
                    return;
                }
                lp[i] = mid + 1;
            }
            if (lp[i]!=rp[i]) bad = true;
        }
        if (!bad) break;
    }
    for (int i = 0; i < d; i++) cout<<cvt(lp[i]);
    cout<<endl;
}
int main(){
    int t=1;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>b;
    cout.tie(NULL);
    cin>>t;
    for (int i = 1; i<=t; i++){
        solve(i);
    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3548kb

input:

10 2
5
---=+
=++=-
==+==
correct
6

output:

44444
11147
12245
12345



result:

wrong answer format  Unexpected end of file - token expected (test case 2)