結果
| 問題 | No.3496 協力カード当て |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-06 17:35:16 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,638 bytes |
| 記録 | |
| コンパイル時間 | 961 ms |
| コンパイル使用メモリ | 108,212 KB |
| 実行使用メモリ | 30,308 KB |
| スコア | 0 |
| 平均クエリ数 | 40.00 |
| 最終ジャッジ日時 | 2026-04-14 23:48:19 |
| 合計ジャッジ時間 | 4,300 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 16 |
ソースコード
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main() {
int id, N, M;
scanf("%d %d %d", &id, &N, &M);
vector<int> hand(N);
map<int, int> my_count;
for (int i = 0; i < N; i++) { scanf("%d", &hand[i]); my_count[hand[i]]++; }
map<int, int> total_count;
int next_ask = 1;
char cmd[16];
while (scanf("%s", cmd) == 1) {
if (strcmp(cmd, "END") == 0) { int q; scanf("%d", &q); break; }
if (strcmp(cmd, "TURN") == 0) {
if (next_ask <= M) {
printf("ASK %d\n", next_ask++); fflush(stdout);
} else {
vector<int> guess;
for (int v = 1; v <= M; v++) {
int t = total_count.count(v) ? total_count[v] : 0;
int mine = my_count.count(v) ? my_count[v] : 0;
int c_guess = (t - mine + 1) / 2;
for (int j = 0; j < c_guess; j++) guess.push_back(v);
}
while ((int)guess.size() > N) guess.pop_back();
while ((int)guess.size() < N) guess.push_back(1);
sort(guess.begin(), guess.end());
printf("GUESS");
for (int v : guess) printf(" %d", v);
printf("\n"); fflush(stdout);
}
} else if (strcmp(cmd, "WAIT") == 0) {
} else if (strcmp(cmd, "COUNT") == 0) {
int x, k; scanf("%d %d", &x, &k); total_count[x] = k;
} else if (strcmp(cmd, "GUESSED") == 0) {
int gid, ok; scanf("%d %d", &gid, &ok);
}
}
return 0;
}