結果

問題 No.355 数当てゲーム(2)
ユーザー mamekinmamekin
提出日時 2016-04-01 22:39:37
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,494 bytes
コンパイル時間 1,265 ms
コンパイル使用メモリ 106,148 KB
実行使用メモリ 24,228 KB
平均クエリ数 5.15
最終ジャッジ日時 2023-09-23 23:22:47
合計ジャッジ時間 5,088 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,496 KB
testcase_01 AC 25 ms
23,628 KB
testcase_02 AC 25 ms
24,228 KB
testcase_03 AC 29 ms
23,784 KB
testcase_04 AC 25 ms
23,388 KB
testcase_05 AC 26 ms
23,532 KB
testcase_06 AC 25 ms
23,340 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
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=123456789,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