結果

問題 No.355 数当てゲーム(2)
ユーザー tottoripapertottoripaper
提出日時 2018-03-11 15:14:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 1,384 bytes
コンパイル時間 1,950 ms
コンパイル使用メモリ 172,308 KB
実行使用メモリ 25,580 KB
平均クエリ数 64.75
最終ジャッジ日時 2024-07-17 01:36:42
合計ジャッジ時間 6,634 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
25,088 KB
testcase_01 AC 31 ms
24,848 KB
testcase_02 AC 31 ms
24,848 KB
testcase_03 AC 30 ms
25,232 KB
testcase_04 AC 28 ms
24,848 KB
testcase_05 AC 27 ms
24,848 KB
testcase_06 AC 29 ms
24,592 KB
testcase_07 AC 28 ms
25,472 KB
testcase_08 AC 31 ms
25,232 KB
testcase_09 AC 26 ms
25,104 KB
testcase_10 AC 27 ms
24,848 KB
testcase_11 AC 29 ms
24,592 KB
testcase_12 AC 27 ms
25,232 KB
testcase_13 AC 29 ms
25,232 KB
testcase_14 AC 25 ms
25,104 KB
testcase_15 AC 27 ms
25,204 KB
testcase_16 AC 26 ms
25,232 KB
testcase_17 AC 29 ms
24,964 KB
testcase_18 AC 30 ms
24,592 KB
testcase_19 AC 31 ms
25,104 KB
testcase_20 AC 31 ms
25,208 KB
testcase_21 AC 29 ms
25,208 KB
testcase_22 AC 29 ms
25,208 KB
testcase_23 AC 30 ms
25,208 KB
testcase_24 AC 31 ms
25,208 KB
testcase_25 AC 31 ms
24,952 KB
testcase_26 AC 30 ms
24,824 KB
testcase_27 AC 30 ms
24,824 KB
testcase_28 AC 29 ms
24,568 KB
testcase_29 AC 30 ms
24,824 KB
testcase_30 AC 27 ms
24,824 KB
testcase_31 AC 28 ms
25,208 KB
testcase_32 AC 28 ms
24,952 KB
testcase_33 AC 27 ms
24,824 KB
testcase_34 AC 29 ms
25,208 KB
testcase_35 AC 26 ms
25,068 KB
testcase_36 AC 29 ms
25,196 KB
testcase_37 AC 28 ms
24,940 KB
testcase_38 AC 27 ms
24,812 KB
testcase_39 AC 28 ms
25,196 KB
testcase_40 AC 28 ms
25,580 KB
testcase_41 AC 31 ms
25,196 KB
testcase_42 AC 26 ms
24,800 KB
testcase_43 AC 27 ms
25,196 KB
testcase_44 AC 28 ms
24,940 KB
testcase_45 AC 30 ms
25,068 KB
testcase_46 AC 29 ms
25,452 KB
testcase_47 AC 29 ms
25,196 KB
testcase_48 AC 27 ms
24,812 KB
testcase_49 AC 27 ms
24,940 KB
testcase_50 AC 29 ms
25,452 KB
testcase_51 AC 29 ms
24,812 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/functional:54,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:71,
                 from main.cpp:1:
In constructor '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 /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/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 /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/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 <anonymous> = true; _T1 = int; _T2 = int]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/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 /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/tuple:1581:62,
    inlined from 'P f(int, int)' at main.cpp:49:34:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/tuple:200:11: warning: 'x4' may be used uninitialized [-Wmaybe-uninitialized]
  200 |         : _M_head_impl(std::forward<_UHead>(__h)) { }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: In function 'P f(int, int)':
main.cpp:30:13: note: 'x4' was declared here
   30 |     int x3,

ソースコード

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