QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#731319#7703. Base Hi-Lo GameTheZoneAC ✓1ms3828kbC++205.9kb2024-11-10 02:07:102024-11-10 02:07:11

Judging History

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

  • [2024-11-10 02:07:11]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3828kb
  • [2024-11-10 02:07:10]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define pb push_back

const ld pi = 3.14159265358979323846;
const ll INF = 1e18;

template<typename T>
T chmax(T a, T b) {
    return a > b ? a : b;
}

template<typename T>
T chmin(T a, T b) {
    return a > b ? b : a;
}

const int N = (int)1e5 + 1, M = N * 2;

void solve(int b) {
    int n;
    cin >> n;

    int t = floor(log(b)) + 2;

    string s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

    vector<int> l(n, 0), r(n, b - 1);

    while(1){
        string st = "";
        for(int i = 0; i < n; i++){
            st += s[l[i] + r[i] >> 1];
        }

        cout << st << endl;
        string q;
        cin >> q;

        int uwu = 0;
        for(int i = 0; i < q.size(); i++){
            if (q[i] == '='){
                uwu++;
            }
        }

        if(uwu == n){
            cout << "cheater" << endl;
            string q;
            cin >> q;
            return;
        }
        if(q == "correct"){
            return;
        }

        for(int i = 0; i < n; i++){
            if(q[i] == '+'){
                if(l[i] >= r[i]){
                    cout << "cheater" << endl;
                    string q;
                    cin >> q;
                    return;
                }
                l[i] = (l[i] + r[i] >> 1) + 1;
            }
            if(q[i] == '-'){
                if(l[i] >= r[i]){
                    cout << "cheater" << endl;
                    string q;
                    cin >> q;
                    return;
                }
                r[i] = (l[i] + r[i] >> 1) - 1;
            }
        }
    }
    cout << 114514 << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int b;
    cin >> b;

    int t = 1;
    cin >> t;

    while (t--) {
        solve(b);
    }

    return 0;
}
/*#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define pb push_back

const ld pi = 3.14159265358979323846;
const ll INF = 1e18;

template<typename T>
T chmax(T a, T b) {
    return a > b ? a : b;
}

template<typename T>
T chmin(T a, T b) {
    return a > b ? b : a;
}

const int N = (int)1e5 + 1, M = N * 2;

void solve(int b) {
    int n;
    cin >> n;

    int t = floor(log(b)) + 2;

    string s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

    vector<int> l(n, 0), r(n, b - 1);

    while(1){
        string st = "";
        for(int i = 0; i < n; i++){
            st += s[l[i] + r[i] >> 1];
        }

        cout << st << endl;
        string q;
        cin >> q;

        int uwu = 0;
        for(int i = 0; i < q.size(); i++){
            if (q[i] == '='){
                uwu++;
            }
        }

        if(uwu == n){
            cout << "cheater" << endl;
            string q;
            cin >> q;
            return;
        }
        if(q == "correct"){
            return;
        }

        for(int i = 0; i < n; i++){
            if(q[i] == '+'){
                if(l[i] >= r[i]){
                    cout << "cheater" << endl;
                    string q;
                    cin >> q;
                    return;
                }
                l[i] = (l[i] + r[i] >> 1) + 1;
            }
            if(q[i] == '-'){
                if(l[i] >= r[i]){
                    cout << "cheater" << endl;
                    string q;
                    cin >> q;
                    return;
                }
                r[i] = (l[i] + r[i] >> 1) - 1;
            }
        }
    }
    cout << 114514 << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int b;
    cin >> b;

    int t = 1;
    cin >> t;

    while (t--) {
        solve(b);
    }

    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define pb push_back

const ld pi = 3.14159265358979323846;
const ll INF = 1e18;

template<typename T>
T chmax(T a, T b) {
    return a > b ? a : b;
}

template<typename T>
T chmin(T a, T b) {
    return a > b ? b : a;
}

const int N = (int)1e5 + 1, M = N * 2;

void solve(int b) {
    int n;
    cin >> n;

    int t = floor(log(b)) + 2;

    string s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

    vector<int> l(n, 0), r(n, b - 1);

    while(1){
        string st = "";
        for(int i = 0; i < n; i++){
            st += s[l[i] + r[i] >> 1];
        }

        cout << st << endl;
        string q;
        cin >> q;

        int uwu = 0;
        for(int i = 0; i < q.size(); i++){
            if (q[i] == '='){
                uwu++;
            }
        }

        if(uwu == n){
            cout << "cheater" << endl;
            string q;
            cin >> q;
            return;
        }
        if(q == "correct"){
            return;
        }

        for(int i = 0; i < n; i++){
            if(q[i] == '+'){
                if(l[i] >= r[i]){
                    cout << "cheater" << endl;
                    string q;
                    cin >> q;
                    return;
                }
                l[i] = (l[i] + r[i] >> 1) + 1;
            }
            if(q[i] == '-'){
                if(l[i] >= r[i]){
                    cout << "cheater" << endl;
                    string q;
                    cin >> q;
                    return;
                }
                r[i] = (l[i] + r[i] >> 1) - 1;
            }
        }
    }
    cout << 114514 << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int b;
    cin >> b;

    int t = 1;
    cin >> t;

    while (t--) {
        solve(b);
    }

    return 0;
}
*/

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3576kb

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: 3620kb

input:

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

output:

I
S
X
Z
a
b
III
888
D3D
A1A
A09

result:

ok correct (2 test cases)

Test #3:

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

input:

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

output:

444
117
128
139
cheater
444
177
178
159
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: 3552kb

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: 3544kb

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
11
10
44
14
11
44
14
11
12
44
14
11
12
13
44
17
15
14
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: 3828kb

input:

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

output:

33
55
44
33
55
44

result:

ok correct (2 test cases)