結果

問題 No.2502 Optimization in the Dark
ユーザー 沙耶花沙耶花
提出日時 2023-10-13 21:42:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 1,110 bytes
コンパイル時間 4,623 ms
コンパイル使用メモリ 260,580 KB
実行使用メモリ 24,312 KB
平均クエリ数 4.00
最終ジャッジ日時 2023-10-13 21:43:04
合計ジャッジ時間 8,877 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
23,508 KB
testcase_01 AC 26 ms
23,988 KB
testcase_02 AC 26 ms
24,192 KB
testcase_03 AC 26 ms
23,964 KB
testcase_04 AC 25 ms
24,216 KB
testcase_05 AC 26 ms
23,340 KB
testcase_06 AC 25 ms
23,916 KB
testcase_07 AC 26 ms
23,352 KB
testcase_08 AC 26 ms
23,508 KB
testcase_09 AC 27 ms
23,604 KB
testcase_10 AC 26 ms
23,568 KB
testcase_11 AC 26 ms
24,312 KB
testcase_12 AC 27 ms
23,796 KB
testcase_13 AC 26 ms
23,568 KB
testcase_14 AC 25 ms
23,616 KB
testcase_15 AC 26 ms
23,556 KB
testcase_16 AC 26 ms
23,352 KB
testcase_17 AC 26 ms
23,592 KB
testcase_18 AC 26 ms
23,316 KB
testcase_19 AC 26 ms
23,376 KB
testcase_20 AC 25 ms
23,964 KB
testcase_21 AC 26 ms
23,628 KB
testcase_22 AC 25 ms
24,000 KB
testcase_23 AC 25 ms
24,240 KB
testcase_24 AC 27 ms
23,400 KB
testcase_25 AC 26 ms
23,316 KB
testcase_26 AC 26 ms
24,012 KB
testcase_27 AC 25 ms
23,760 KB
testcase_28 AC 26 ms
23,292 KB
testcase_29 AC 26 ms
23,304 KB
testcase_30 AC 26 ms
23,496 KB
testcase_31 AC 26 ms
24,276 KB
testcase_32 AC 26 ms
23,352 KB
testcase_33 AC 26 ms
23,556 KB
testcase_34 AC 25 ms
23,796 KB
testcase_35 AC 26 ms
23,796 KB
testcase_36 AC 26 ms
23,352 KB
testcase_37 AC 25 ms
23,496 KB
testcase_38 AC 26 ms
23,388 KB
testcase_39 AC 25 ms
23,592 KB
testcase_40 AC 25 ms
23,772 KB
testcase_41 AC 25 ms
23,568 KB
testcase_42 AC 26 ms
23,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001
bool query(int i,int x,int j,int y){
	cout<<"? "<<i<<' '<<x<<' '<<j<<' '<<y<<endl;
	string s;
	cin>>s;
	return s=="Yes";
}
int main(){
	
	int n;
	cin>>n;
	
	int ii;
	if(query(1,2*n,2,2*n)){
		if(query(2,2*n,3,2*n))ii = 3;
		else ii = 2;
	}
	else{
		if(query(1,2*n,3,2*n))ii = 3;
		else ii = 1;
	}
	vector<int> ans;
	vector<int> rem(3,n*2);
	rep(i,n){
		for(int j=1;j<=3;j++){
			if(j==ii)continue;
			ans.push_back(j);
			rem[j-1]--;
		}
	}
	int jj;
	if(ii==1){
		if(!query(2,n,3,n))jj = 3;
		else jj = 2;
	}
	else if(ii==2){
		if(!query(1,n,3,n))jj = 3;
		else jj = 1;
	}
	else{
		if(!query(1,n,2,n))jj = 2;
		else jj = 1;
	}
	
	rep(i,n){
		ans.push_back(ii);
		ans.push_back(jj);
	}
	rep(i,n){
		ans.push_back(ii);
		ans.push_back(ii^jj);
	}
	reverse(ans.begin(),ans.end());
	cout<<"!";
	rep(i,ans.size()){
		cout<<' '<<ans[i];
	}
	cout<<endl;
	
	return 0;
}
0