結果
| 問題 |
No.3347 Guess The Array
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-21 17:29:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,469 bytes |
| コンパイル時間 | 1,797 ms |
| コンパイル使用メモリ | 199,448 KB |
| 実行使用メモリ | 26,368 KB |
| 平均クエリ数 | 27968.56 |
| 最終ジャッジ日時 | 2025-11-21 17:30:40 |
| 合計ジャッジ時間 | 76,875 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 19 TLE * 16 |
コンパイルメッセージ
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, t(v.size());
for (int j = 0; j < v.size(); j++) {
ne.push_back(v[j]);
int l = 0, r = c[i];
while (l < r) {
int mid = l + r + 1 >> 1;
vector<int> t = ne;
for (int k = 0; k < mid; k++) t.push_back(i);
if (ask(t)) l = mid;
else r = mid - 1;
}
t[j] = l;
}
ne.clear();
for (int j = t.size() ? t[0] + 1 : 1; j <= c[i]; j++) ne.push_back(i);
for (int j = 0; j < v.size(); j++) {
ne.push_back(v[j]);
for (int k = 0; k < t[j] - (j == v.size() - 1 ? 0 : t[j + 1]); k++) ne.push_back(i);
}
swap(ne, v);
}
ans(v);
return 0;
}