結果

問題 No.3811 Mid Filter
コンテスト
ユーザー C
提出日時 2026-12-01 17:23:19
言語 C++23(gcc16)
(gcc 16.2.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc16.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 217 ms / 2,000 ms
+ 999µs
コード長 1,551 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,498 ms
コンパイル使用メモリ 421,608 KB
実行使用メモリ 6,400 KB
平均クエリ数 830.17
最終ジャッジ日時 2026-12-01 17:23:33
合計ジャッジ時間 12,712 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC optimize("O3")
#if defined(__x86_64__) || defined(__i386__)
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#endif
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
#define each(x, v) for (auto&& x : v)
#define each2(x, y, v) for (auto&& [x, y] : v)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(x) begin(x),end(x)
#define sz(x) (int)(x).size()
using namespace std;
using namespace atcoder;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vi>;
using pll=pair<ll,ll>;
using pi=pair<int,int>;

// using mint=modint998244353;
// using mint=modint1000000007;
// using mint2=static_modint<2>;

// using mint=LazyMontgomeryModInt<998244353>;
// using vm=vector<mint>;
// using vvm=vector<vm>;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int N,K;
	cin>>N>>K;
	unordered_map<int,set<int>>group;
	rep(x,1,2*K+2){
		cout<<'?';
		rep(i,1,2*K+2)if(i!=x)cout<<' '<<i;
		cout<<endl;
		int r;
		cin>>r;
		group[r].insert(x);
	}
	int p,q;
	each2(key,g,group){
		if(sz(g)==K+1)p=key;
		else q=key;
	}
	auto& C=group[q],H=group[p];
	rep(x,2*K+2,N+1){
		cout<<'?';
		each(c,C)cout<<' '<<c;
		cout<<' '<<x;
		int t=K-1;
		each(h,H){
			if(t--==0)break;
			cout<<' '<<h;
		}
		cout<<endl;
		int r;
		cin>>r;
		if(r!=p){
			C.erase(p);
			C.insert(x);
			p=r;
		}
	}
	cout<<'!';
	each(c,C)cout<<' '<<c;
	cout<<endl;
}
0