結果
| 問題 |
No.2502 Optimization in the Dark
|
| コンテスト | |
| ユーザー |
publfl2
|
| 提出日時 | 2023-10-13 22:27:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,063 bytes |
| コンパイル時間 | 460 ms |
| コンパイル使用メモリ | 51,840 KB |
| 実行使用メモリ | 25,836 KB |
| 平均クエリ数 | 4.00 |
| 最終ジャッジ日時 | 2024-09-15 18:12:11 |
| 合計ジャッジ時間 | 3,890 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 43 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:23:21: warning: 't' is used uninitialized [-Wuninitialized]
23 | int t = getQuery(t,2*a,3,2*a);
| ~~~~~~~~^~~~~~~~~~~~~
main.cpp:23:9: note: 't' was declared here
23 | int t = getQuery(t,2*a,3,2*a);
| ^
ソースコード
#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(t,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);
}
publfl2