結果

問題 No.2502 Optimization in the Dark
ユーザー publfl2publfl2
提出日時 2023-10-13 22:28:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,063 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 51,588 KB
実行使用メモリ 24,456 KB
平均クエリ数 4.00
最終ジャッジ日時 2023-10-13 22:28:51
合計ジャッジ時間 3,598 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,000 KB
testcase_01 AC 22 ms
23,448 KB
testcase_02 AC 22 ms
24,264 KB
testcase_03 AC 22 ms
24,048 KB
testcase_04 AC 23 ms
24,000 KB
testcase_05 AC 22 ms
23,688 KB
testcase_06 AC 22 ms
23,436 KB
testcase_07 AC 21 ms
24,024 KB
testcase_08 AC 23 ms
24,264 KB
testcase_09 AC 23 ms
23,484 KB
testcase_10 AC 22 ms
23,976 KB
testcase_11 AC 22 ms
23,436 KB
testcase_12 AC 23 ms
23,628 KB
testcase_13 AC 23 ms
23,676 KB
testcase_14 AC 23 ms
23,640 KB
testcase_15 AC 26 ms
23,592 KB
testcase_16 AC 23 ms
24,048 KB
testcase_17 AC 22 ms
24,204 KB
testcase_18 AC 23 ms
24,036 KB
testcase_19 AC 22 ms
23,592 KB
testcase_20 AC 23 ms
23,508 KB
testcase_21 AC 23 ms
24,036 KB
testcase_22 AC 23 ms
23,400 KB
testcase_23 AC 22 ms
24,264 KB
testcase_24 AC 23 ms
23,604 KB
testcase_25 AC 23 ms
24,000 KB
testcase_26 AC 23 ms
23,604 KB
testcase_27 AC 22 ms
24,252 KB
testcase_28 AC 22 ms
23,388 KB
testcase_29 AC 22 ms
23,592 KB
testcase_30 AC 22 ms
23,544 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
}
0