結果
| 問題 |
No.3347 Guess The Array
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-21 18:04:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,264 bytes |
| コンパイル時間 | 1,610 ms |
| コンパイル使用メモリ | 199,172 KB |
| 実行使用メモリ | 26,608 KB |
| 平均クエリ数 | 3419.89 |
| 最終ジャッジ日時 | 2025-11-21 18:05:21 |
| 合計ジャッジ時間 | 15,427 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 RE * 25 |
コンパイルメッセージ
main.cpp: In function ‘bool ask(const std::vector<int>&)’:
main.cpp:13:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
13 | printf("? %d ", v.size());
| ~^ ~~~~~~~~
| | |
| int std::vector<int>::size_type {aka long unsigned int}
| %ld
main.cpp:17:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%s", s + 1);
| ~~~~~^~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const int N = 2000010, MOD = 1e9 + 7, INF = 0x3f3f3f3f;
int n, m, w[N];
char s[N];
int c[N];
bool ask(const vector<int>& v) {
printf("? %d ", v.size());
for (auto u : v) printf("%d ", u);
puts("");
fflush(stdout);
scanf("%s", s + 1);
return s[1] == 'Y';
}
void ans(vector<int>& v) {
printf("! ");
for (auto u : v) printf("%d ", u);
puts("");
fflush(stdout);
}
int main() {
cin >> n;
for (int i = 1; i < n + 1; i++)
while (c[i] != n && ask(vector<int>(c[i] + 1, i)))
c[i]++;
vector<int> v;
for (int i = 1; i < n + 1; i++) {
vector<int> ne = v, t(v.size() + 1);
for (int j = 1; j <= c[i]; j++) {
while (1) {
vector<int> t = ne;
for (int k = 0; k < j; k++) t.push_back(i);
if (!ask(t)) ne.pop_back();
else break;
}
t[ne.size()]++;
}
ne.clear();
for (int j = 0; j <= v.size(); j++) {
if (j) ne.push_back(v[j - 1]);
for (int k = 0; k < t[j]; k++) ne.push_back(i);
}
swap(ne, v);
}
ans(v);
return 0;
}