結果
| 問題 | No.355 数当てゲーム(2) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-04-01 22:39:37 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                TLE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 1,494 bytes | 
| コンパイル時間 | 1,128 ms | 
| コンパイル使用メモリ | 106,388 KB | 
| 実行使用メモリ | 40,416 KB | 
| 平均クエリ数 | 5.15 | 
| 最終ジャッジ日時 | 2024-07-16 23:08:34 | 
| 合計ジャッジ時間 | 5,108 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 7 TLE * 1 -- * 44 | 
ソースコード
#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;
        }
    }
}
            
            
            
        