QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#709345#7703. Base Hi-Lo Gamerand123AC ✓1ms3860kbC++142.0kb2024-11-04 14:12:052024-11-04 14:12:05

Judging History

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

  • [2024-11-04 14:12:05]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3860kb
  • [2024-11-04 14:12:05]
  • 提交

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 f = true;
        for (int i = 0; i < d; i++){
            if (res[i]!='=') f = false;
            if (r[i].count((lp[i]+rp[i])/2) && r[i][(lp[i]+rp[i])/2]!=res[i]){
                cout<<"cheater"<<endl;
                string c; cin>>c;
                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;
                    string c; cin>>c;
                    return;
                }
                rp[i] = mid - 1;
            }
            else if (res[i]=='+'){
                if (mid==rp[i]){
                    cout<<"cheater"<<endl;
                    string c; cin>>c;
                    return;
                }
                lp[i] = mid + 1;
            }
        }
        if (f){
            cout<<"cheater"<<endl;
            string c; cin>>c;
            return;
        }
    }
}
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: 100
Accepted
time: 1ms
memory: 3860kb

input:

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

output:

44444
11147
12245
12345
444444
147717
245808
246809

result:

ok correct (2 test cases)

Test #2:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

38 2
1
+
+
+
+
correct
3
---
+-+
---
=--
correct

output:

I
S
X
Z
b
III
888
D3D
A1A
A09

result:

ok correct (2 test cases)

Test #3:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

10 6
3
--+
=++
=++
=+=
correct
3
-++
==+
=-+
correct
5
+++++
++=--
+==++
====-
correct
4
----
====
correct
4
++++
++++
====
correct
4
====
correct

output:

444
117
128
139
cheater
444
177
178
cheater
44444
77777
88755
98766
cheater
4444
1111
cheater
4444
7777
8888
cheater
4444
cheater

result:

ok correct (6 test cases)

Test #4:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

62 2
4
====
correct
64
================================================================
correct

output:

UUUU
cheater
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
cheater

result:

ok correct (2 test cases)

Test #5:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

10 10
2
-=
=-
correct
2
-=
=-
correct
2
-=
=-
correct
2
-=
=-
correct
2
-+
=-
=-
correct
2
--
=+
=+
=+
correct
2
--
=+
=+
=+
correct
2
--
=+
=+
=+
correct
2
--
=+
=+
=+
correct
2
--
=+
=+
=+
correct

output:

44
14
cheater
44
14
cheater
44
14
cheater
44
14
cheater
44
17
15
cheater
44
11
12
13
cheater
44
11
12
13
cheater
44
11
12
13
cheater
44
11
12
13
cheater
44
11
12
13
cheater

result:

ok correct (10 test cases)

Test #6:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

8 2
2
++
--
correct
2
++
--
correct

output:

33
55
44
33
55
44

result:

ok correct (2 test cases)