結果
| 問題 |
No.3347 Guess The Array
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-14 01:17:36 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,839 bytes |
| コンパイル時間 | 5,692 ms |
| コンパイル使用メモリ | 335,212 KB |
| 実行使用メモリ | 26,620 KB |
| 平均クエリ数 | 5534.76 |
| 最終ジャッジ日時 | 2025-11-14 01:17:57 |
| 合計ジャッジ時間 | 20,282 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 46 |
ソースコード
// 去年のCPCTFでこの問題思いついて出してほしかったんだけど!!!わからん!!!
#include <bits/stdc++.h>
#include <atcoder/all>
#define all(v) v.begin(), v.end()
#define eb emplace_back
#define fast cin.tie(nullptr); ios_base::sync_with_stdio(false)
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
constexpr ll mod = 998244353;
bool query(vector<int> &b){
int s = b.size();
cout << "? " << s << " ";
for(int i=0;i<s;i++) cout << b[i] << (i==s-1 ? "\n" : " ");
cout.flush();
string res;
cin >> res;
return res == "Yes";
}
int n;
int main(){
fast;
cin >> n;
vector<int> cnt(n + 1);
int rem = n;
for(int i = 1; i <= n; i++){
if(rem == 0) break;
vector<int> tmp = {i};
for(int j = 1; j <= n; j++){
if(!query(tmp)){
cnt[i] = tmp.size();
cnt[i]--;
break;
}
tmp.eb(i);
}
cnt[i] = tmp.size();
rem -= cnt[i];
}
vector<int> ans = vector<int>(cnt[1],1);
for(int i = 2; i <= n; i++){
for(int k = 1; k <= cnt[i]; k++){
int l = 0, r = ans.size() + 2;
while(r - l > 1){
int m = (l + r) / 2;
vector<int> tmp;
for(int j = 0; j < m; j++){
tmp.eb(ans[j]);
}
for(int j = 0; j < k; j++){
tmp.eb(i);
}
if(query(tmp)){
l = m;
}
else{
r = m;
}
}
ans.insert(ans.begin() + l, i);
}
}
cout << "! ";
for(auto &x : ans){
cout << x << " ";
}
cout << endl;
}