結果
問題 |
No.2502 Optimization in the Dark
|
ユーザー |
![]() |
提出日時 | 2023-10-13 22:28:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,063 bytes |
コンパイル時間 | 623 ms |
コンパイル使用メモリ | 51,968 KB |
実行使用メモリ | 25,580 KB |
平均クエリ数 | 4.00 |
最終ジャッジ日時 | 2024-09-15 18:13:18 |
合計ジャッジ時間 | 4,074 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 WA * 12 |
ソースコード
#include <stdio.h> #include <vector> char x[110]; int getQuery(int a, int b, int c, int d) { printf("? %d %d %d %d\n",a,b,c,d); fflush(stdout); scanf("%s",x+1); if(x[1]=='N') return a; else return c; } std::vector<int> V; std::vector< std::pair<int,int> > ans; int main() { int a; scanf("%d",&a); int s = getQuery(1,2*a,2,2*a); int t = getQuery(s,2*a,3,2*a); for(int i=1;i<=3;i++) { if(i==t) continue; V.push_back(i); } for(int i=1;i<=a-1;i++) { ans.push_back(std::make_pair(V[0],t)); ans.push_back(std::make_pair(V[1],t)); } int k = getQuery(V[0],a,V[1],a); if(k==V[0]) { ans.push_back(std::make_pair(V[0],t)); ans.push_back(std::make_pair(V[1],t)); } else { ans.push_back(std::make_pair(V[1],t)); ans.push_back(std::make_pair(V[0],t)); } for(int i=1;i<=a;i++) ans.push_back(std::make_pair(V[0],V[1])); printf("! "); for(int i=0;i<ans.size();i++) printf("%d %d ",ans[i].first,ans[i].second); }