Submission #755871

# Submission time Handle Problem Language Result Execution time Memory
755871 2023-06-10T17:06:10 Z vjudge1 Password (RMI18_password) C++17
0 / 100
33 ms 292 KB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "C:\GCC\debug.h"
#else
#define debug(...) void(42)
#endif

int query(string str);

/*
int query(string str) {
  cout << str << endl;
  int x;
  cin >> x;
  return x;
}
*/

string guess(int n, int s) {
  string endChars;

  vector<int> freq(s);
  for (int i = 0; i < s; i++) {
    string str;
    for (int it = 0; it < n; it++) {
      str += (i + 'a');
    }
    freq[i] = query(str);
    if (freq[i] == n) {
      return str;
    }
  }

  string res;
  for (int i = 0; i < s; i++) {
    for (int j = 0; j < freq[i]; j++) {
      res += (i + 'a');
    }
  }

  auto Build = [&](char i, char j) {
    string str;
    str += i;
    str += j;
    return str;
  };

  sort(res.begin(), res.end(), [&](char i, char j) {
    if (i == j) {
      return 0;
    }
    return query(Build(i, j));
  });

  return res;
}

/*
int main() {
  guess(5, 5);
}
*/
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Returned early from guess() after 30 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 208 KB Returned early from guess() after 553 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 292 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Returned early from guess() after 30 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Returned early from guess() after 30 queries.
2 Halted 0 ms 0 KB -