結果

問題 No.355 数当てゲーム(2)
ユーザー tottoripapertottoripaper
提出日時 2018-03-11 15:14:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 1,384 bytes
コンパイル時間 1,655 ms
コンパイル使用メモリ 171,104 KB
実行使用メモリ 24,312 KB
平均クエリ数 64.75
最終ジャッジ日時 2023-09-24 01:40:08
合計ジャッジ時間 4,762 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,364 KB
testcase_01 AC 22 ms
24,012 KB
testcase_02 AC 21 ms
23,532 KB
testcase_03 AC 21 ms
24,168 KB
testcase_04 AC 25 ms
23,376 KB
testcase_05 AC 22 ms
24,252 KB
testcase_06 AC 22 ms
23,652 KB
testcase_07 AC 23 ms
24,036 KB
testcase_08 AC 21 ms
23,352 KB
testcase_09 AC 21 ms
23,388 KB
testcase_10 AC 21 ms
23,664 KB
testcase_11 AC 21 ms
24,288 KB
testcase_12 AC 21 ms
24,312 KB
testcase_13 AC 22 ms
23,664 KB
testcase_14 AC 21 ms
23,652 KB
testcase_15 AC 22 ms
23,772 KB
testcase_16 AC 22 ms
23,196 KB
testcase_17 AC 22 ms
23,784 KB
testcase_18 AC 22 ms
23,808 KB
testcase_19 AC 22 ms
23,388 KB
testcase_20 AC 22 ms
23,628 KB
testcase_21 AC 21 ms
23,532 KB
testcase_22 AC 22 ms
23,772 KB
testcase_23 AC 21 ms
23,352 KB
testcase_24 AC 23 ms
23,388 KB
testcase_25 AC 22 ms
23,988 KB
testcase_26 AC 22 ms
23,616 KB
testcase_27 AC 21 ms
23,532 KB
testcase_28 AC 21 ms
23,388 KB
testcase_29 AC 22 ms
23,652 KB
testcase_30 AC 21 ms
24,216 KB
testcase_31 AC 22 ms
23,796 KB
testcase_32 AC 21 ms
24,048 KB
testcase_33 AC 22 ms
23,664 KB
testcase_34 AC 22 ms
24,180 KB
testcase_35 AC 19 ms
23,952 KB
testcase_36 AC 23 ms
23,364 KB
testcase_37 AC 25 ms
23,940 KB
testcase_38 AC 22 ms
24,168 KB
testcase_39 AC 22 ms
24,036 KB
testcase_40 AC 21 ms
23,520 KB
testcase_41 AC 22 ms
23,604 KB
testcase_42 AC 22 ms
24,192 KB
testcase_43 AC 21 ms
23,940 KB
testcase_44 AC 21 ms
23,376 KB
testcase_45 AC 21 ms
23,376 KB
testcase_46 AC 21 ms
23,784 KB
testcase_47 AC 22 ms
23,652 KB
testcase_48 AC 21 ms
23,640 KB
testcase_49 AC 21 ms
23,340 KB
testcase_50 AC 21 ms
23,964 KB
testcase_51 AC 21 ms
23,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
次のファイルから読み込み:  /usr/local/gcc7/include/c++/12.2.0/functional:54,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/x86_64-pc-linux-gnu/bits/stdc++.h:71,
         次から読み込み:  main.cpp:1:
コンストラクタ ‘constexpr std::_Head_base<_Idx, _Head, false>::_Head_base(_UHead&&) [with _UHead = int&; long unsigned int _Idx = 1; _Head = int]’ 内,
    inlined from ‘constexpr std::_Tuple_impl<_Idx, _Head>::_Tuple_impl(_UHead&&) [with _UHead = int&; long unsigned int _Idx = 1; _Head = int]’ at /usr/local/gcc7/include/c++/12.2.0/tuple:441:38,
    inlined from ‘constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(_UHead&&, _UTail&& ...) [with _UHead = int&; _UTail = {int&}; <template-parameter-2-3> = void; long unsigned int _Idx = 0; _Head = int; _Tail = {int}]’ at /usr/local/gcc7/include/c++/12.2.0/tuple:292:38,
    inlined from ‘constexpr std::tuple<_T1, _T2>::tuple(_U1&&, _U2&&) [with _U1 = int&; _U2 = int&; typename std::enable_if<std::_TupleConstraints<(! __is_alloc_arg<_U1>()), _T1, _T2>::__is_implicitly_constructible<_U1, _U2>(), bool>::type <無名> = true; _T1 = int; _T2 = int]’ at /usr/local/gcc7/include/c++/12.2.0/tuple:1079:63,
    inlined from ‘constexpr std::tuple<typename std::__strip_reference_wrapper<typename std::decay<_Elements>::type>::__type ...> std::make_tuple(_Elements&& ...) [with _Elements = {int&, int&}]’ at /usr/local/gcc7/include/c++/12.2.0/tuple:1581:62,
    inlined from ‘P f(int, int)’ at main.cpp:49:34:
/usr/local/gcc7/include/c++/12.2.0/tuple:200:11: 警告: ‘x4’ may be used uninitialized [-Wmaybe-uninitialized]
  200 |         : _M_head_impl(std::forward<_UHead>(__h)) { }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: 関数 ‘P f(int, int)’ 内:
main.cpp:30:13: 備考: ‘x4’ はここで定義されています
   30 |     int x3, x4, mx = 0;
      |             ^~
コンストラクタ ‘constexpr std::_Head_base<_Idx, _

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;
using P4 = std::tuple<int,int,int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

P ask(int x1, int x2, int x3, int x4){
    std::cout << x1 << " " << x2 << " " << x3 << " " << x4 << std::endl;

    int a, b;
    std::cin >> a >> b;

    if(a == 4){
        exit(0);
    }
    return std::make_tuple(a, b);
}

P f(int x1, int x2){
    int x3, x4, mx = 0;
    
    for(int i=0;i<10;++i){
        for(int j=i+1;j<10;++j){
            if(i == x1 || i == x2 || j == x1 || j == x2){
                continue;
            }

            int s, t;
            tie(s, t) = ask(x1, x2, i, j);

            if(mx < s + t){
                mx = s + t;
                x3 = i;
                x4 = j;
            }
        }
    }

    return std::make_tuple(x3, x4);
}

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    int xs[4];
    tie(xs[0], xs[1]) = f(0, 1);
    tie(xs[2], xs[3]) = f(xs[0], xs[1]);

    sort(xs, xs+4);
    while(true){
        ask(xs[0], xs[1], xs[2], xs[3]);
        
        if(!next_permutation(xs, xs+4)){
            break;
        }
    }
}
0