QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#723874#7703. Base Hi-Lo GameMattTheNub#TL 0ms3784kbC++232.7kb2024-11-08 02:07:242024-11-08 02:07:25

Judging History

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

  • [2024-11-08 02:07:25]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3784kb
  • [2024-11-08 02:07:24]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

template <class T> using v = vector<T>;
using ll = long long;
using dd = long double;
using int2 = pair<int, int>;
using ll2 = pair<ll, ll>;
using dd2 = pair<dd, dd>;

#define f first
#define s second
#define all(x) begin(x), end(x)
istream &__cin = cin;
#ifdef DEV_MODE
#include "debug.h"
__cinwrapper __cin_wrapper;
#define cin __cin_wrapper
#else
#define dbg(...)
#define dbg2d(...)
#endif

template <class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
  in >> p.first >> p.second;
  return in;
}
template <class T> istream &operator>>(istream &in, v<T> &v) {
  for (auto &x : v)
    in >> x;
  return in;
}
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

/*
 _______________________________________
( If you don't fail at least 90% of the )
( time, you're not aiming high enough.  )
(                                       )
( - Alan Kay                            )
 ---------------------------------------
        o   ^__^
         o  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
*/

const bool INTERACTIVE = true;
const bool MULTITEST = false;
/******************************************************************************/

#pragma region templates

#pragma endregion templates

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

  const string digits =
      "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

  while (n--) {
    int d;
    cin >> d;

    v<int> lo(d), hi(d, b - 1), mid(d);
    while (true) {
      for (int i = 0; i < d; i++) {
        mid[i] = (lo[i] + hi[i]) >> 1;
        if (hi[i] < lo[i]) {
          string r;
          cout << "cheater" << endl;
          cin >> r;
          goto brk;
        }
      }
      for (int i = 0; i < d; i++) {
        cout << digits[mid[i]];
      }
      cout << endl;
      string r;
      cin >> r;
      if (r == "correct")
        break;
      for (int i = 0; i < d; i++) {
        if (r[i] == '+') {
          lo[i] = mid[i] + 1;
        } else if (r[i] == '-') {
          hi[i] = mid[i] - 1;
        } else {
          lo[i] = hi[i] = mid[i];
        }
      }
    }
  brk:;
  }
}

int main() {
#ifdef DEV_MODE
  debug_start(INTERACTIVE, "j.txt");
#else
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  int t;
  if (MULTITEST)
    cin >> t;
  else
    t = 1;
  while (t--)
    solve();

#ifdef DEV_MODE
  debug_exit(INTERACTIVE);
#endif
}
#ifdef DEV_MODE
#include "debug.cpp"
#endif

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3596kb

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: 0ms
memory: 3784kb

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: -100
Time Limit Exceeded

input:

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

output:

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

result: