#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define flush fflush(stdout)
#define debug printf("Hello\n")
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
//priority_queue <int, vector <int>, greater <int> > pq;
int query(string str);
int freq[30];
string guess(int n, int s) {
string ret;
FOR(i, 0, 25) {
char c = 'a' + i;
string q(n, c);
freq[i] = query(q);
}
int st = 0;
FOR(i, 0, 25) {
if (freq[i] > 0) {
char c = i + 'a';
FOR(j, 1, freq[i]) {
ret += c;
}
st = i + 1;
break;
}
}
int curlen = ret.length();
FOR(i, st, 25) {
char c = i + 'a';
string ch;
ch += c;
int pos = -1; //insert new letter just after position pos
string q;
while (true) {
if (freq[i] == 0) break;
if (pos == -1) {
q = ch + ret;
} else {
q = ret.substr(0, pos+1) + ch;
q += ret.substr(pos+1, curlen - pos - 1);
}
if (query(q) == curlen + 1) {
ret = q;
curlen++;
pos++;
freq[i]--;
} else {
pos++;
}
if (pos >= curlen) break;
}
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
Token "ppppppppppppppp" doesn't correspond to pattern "[a-o]{1,15}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Token "cccccccccccccccccccccccccccccccccccccccccccccccccc" doesn't correspond to pattern "[a-b]{1,50}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Token "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm...mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm" doesn't correspond to pattern "[a-l]{1,1000}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
Token "ppppppppppppppp" doesn't correspond to pattern "[a-o]{1,15}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
Token "ppppppppppppppp" doesn't correspond to pattern "[a-o]{1,15}" |
2 |
Halted |
0 ms |
0 KB |
- |