結果

問題 No.355 数当てゲーム(2)
ユーザー mamekinmamekin
提出日時 2016-04-01 22:40:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,494 bytes
コンパイル時間 1,163 ms
コンパイル使用メモリ 106,056 KB
実行使用メモリ 24,396 KB
平均クエリ数 16.04
最終ジャッジ日時 2023-09-23 23:23:18
合計ジャッジ時間 6,019 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,012 KB
testcase_01 AC 23 ms
23,856 KB
testcase_02 AC 21 ms
23,400 KB
testcase_03 AC 22 ms
23,532 KB
testcase_04 AC 21 ms
23,676 KB
testcase_05 AC 20 ms
23,544 KB
testcase_06 AC 21 ms
23,388 KB
testcase_07 AC 20 ms
24,396 KB
testcase_08 AC 21 ms
23,520 KB
testcase_09 AC 21 ms
23,412 KB
testcase_10 AC 21 ms
24,336 KB
testcase_11 AC 20 ms
23,808 KB
testcase_12 AC 20 ms
23,388 KB
testcase_13 AC 22 ms
23,640 KB
testcase_14 AC 21 ms
23,532 KB
testcase_15 AC 22 ms
23,964 KB
testcase_16 AC 22 ms
23,520 KB
testcase_17 AC 22 ms
24,036 KB
testcase_18 AC 22 ms
24,024 KB
testcase_19 AC 21 ms
23,700 KB
testcase_20 AC 20 ms
23,376 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

unsigned xor128(){
    static unsigned x=123452789,y=362436069,z=521288629,w=88675123;
    unsigned t;
    t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}

int main()
{
    vector<int> v = {0, 1, 2, 3};

    int xMax = -1;
    int yMax = -1;
    for(;;){
        vector<int> w = v;
        if(xMax + yMax == 4){
            int i = xor128() % 4;
            int j;
            do{
                j = xor128() % 4;
            }while(i == j);
            swap(w[i], w[j]);
        }
        else{
            int i = xor128() % 4;
            int a;
            do{
                a = xor128() % 10;
            }while(find(v.begin(), v.end(), a) != v.end());
            w[i] = a;
        }

        cout << w[0];
        for(int i=1; i<4; ++i)
            cout << ' ' << w[i];
        cout << endl;

        int x, y;
        cin >> x >> y;
        if(x == 4){
            return 0;
        }
        if(xMax + yMax < x + y || (xMax + yMax == x + y && xMax < x)){
            v = w;
            xMax = x;
            yMax = y;
        }
    }
}
0