QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#191365 | #7531. Hacking the Project | Days_of_Future_Past# | WA | 0ms | 3788kb | C++14 | 1.6kb | 2023-09-29 22:14:31 | 2023-09-29 22:14:32 |
Judging History
answer
#include <bits/stdc++.h>
#define SZ(c) ((int)(c).size())
using namespace std;
const int N = 1111;
const int INF = 1e9;
typedef pair<int, int> pii;
int dp[N][N];
void build() {
for (int len = 2; len < N; ++len)
for (int i = 0; i < N; ++i) {
int r = i + len - 1;
if (r >= N)
break;
dp[i][r] = INF;
for (int m = i + 1; m <= r; ++m)
dp[i][r] = min(dp[i][r], m + max(dp[i][m - 1], dp[m][r]));
}
printf("%d\n", dp[0][1000]);
}
vector<string> query(char c, int k) {
static char buf[111];
printf("%c %d\n", c, k);
fflush(stdout);
vector<string> res;
int real_k;
scanf("%d", &real_k);
for (int i = 0; i < real_k; ++i) {
scanf("%s", buf);
res.push_back(buf);
}
return res;
}
void answer(const vector<string> &ss) {
printf("answer");
for (int i = 0; i < SZ(ss); ++i)
printf(" %s", ss[i].c_str());
printf("\n");
fflush(stdout);
}
int n;
vector<string> ans[33];
void main2() {
scanf("%d", &n);
for (int c = 0; c < 26; ++c)
ans[c].clear();
int remaining = n;
for (int c = 0; c < 26; ++c) {
int guess = 1;
while (guess <= remaining) {
ans[c] = query('a' + c, guess);
if (SZ(ans[c]) < guess || SZ(ans[c]) == remaining) {
break;
} else {
guess = min(guess * 2, remaining);
}
}
remaining -= SZ(ans[c]);
}
vector<string> all_ans;
for (int c = 0; c < 26; ++c)
for (auto s: ans[c])
all_ans.push_back(s);
answer(all_ans);
}
int main() {
//build();
int tc;
scanf("%d", &tc);
while (tc--) {
main2();
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3788kb
input:
1 4
output:
a 1
result:
wrong answer Invalid query 'a'