結果

問題 No.1004 サイコロの実装 (2)
ユーザー hanachanXhanachanX
提出日時 2020-04-12 18:34:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,790 bytes
コンパイル時間 2,941 ms
コンパイル使用メモリ 184,928 KB
実行使用メモリ 121,448 KB
最終ジャッジ日時 2023-10-22 03:19:51
合計ジャッジ時間 24,087 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
121,188 KB
testcase_01 AC 13 ms
42,516 KB
testcase_02 AC 13 ms
42,516 KB
testcase_03 AC 13 ms
42,516 KB
testcase_04 AC 13 ms
42,516 KB
testcase_05 AC 13 ms
42,516 KB
testcase_06 AC 41 ms
121,188 KB
testcase_07 AC 13 ms
42,516 KB
testcase_08 AC 42 ms
121,188 KB
testcase_09 AC 40 ms
121,188 KB
testcase_10 WA -
testcase_11 AC 41 ms
121,188 KB
testcase_12 AC 43 ms
121,188 KB
testcase_13 AC 13 ms
42,516 KB
testcase_14 AC 36 ms
121,304 KB
testcase_15 AC 36 ms
121,304 KB
testcase_16 WA -
testcase_17 AC 36 ms
121,304 KB
testcase_18 AC 36 ms
121,304 KB
testcase_19 WA -
testcase_20 AC 36 ms
121,304 KB
testcase_21 AC 36 ms
121,304 KB
testcase_22 AC 35 ms
121,304 KB
testcase_23 WA -
testcase_24 AC 36 ms
121,304 KB
testcase_25 AC 36 ms
121,304 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) printf("%d\n",(x));
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;
template<class T> using V = vector<T>;
using I = int;
using VI = V<I>;
const int INF = 2e9;
const int64 MOD = 1e9 + 7;

template <class T> inline bool chmin(T& a, T b){if(a>b){a=b; return true;} return false;}
template <class T> inline bool chmax(T& a, T b){if(a<b){a=b; return true;} return false;}

vector<uint64> x(5032704);
vector<uint64> ta , ao;

int main(){
    uint64 a , b , x0 ,n;
    cin >> a >> b >> x0 >> n;
    if( n == 0) { cout << 0 << " " << 0 << endl; return 0; }
    ta.resize(5032704,0);
    ao.resize(5032704,0);
    x[0] = x0;
    for(int i = 1; i <= n*2+3 ; ++i){
        x[i]=(a*x[i-1]+b)%(uint64)pow(2,32); 
    }
    int t_[2]={0};
    int a_[2]={0};
    uint64 i , j;
    ta[0]=(x[1]%6+1);
    ao[0]=(x[2]%6+1);
    for(i=3 , j=1; j < n ; i+=2 , ++j){
        ta[i]=ta[i-1]+(x[i]%6+1);
    }
    for(i=4 , j=1; j < n ; i+=2 , ++j){
        ao[i]=ao[i-1]+(x[i]%6+1);
    }
    for(int i = 0 ; i <n ; ++i){
        if(ta[i]%2 == 0) ++t_[0];
        else ++t_[1];
    }
    for(int i = 0 ; i < n ; ++i){
        if(ao[i]%2 == 0) ++a_[0];
        else ++a_[1];
    }
    //cout << "takahashi black:" << t_[0] << " takahashi white:" << t_[1] << endl;
    //cout << "Aoki black:" << a_[0] << " Aoki white:" << a_[1] << endl;
    chmin(t_[0] , t_[1]);
    chmin(a_[0] , a_[1]);

    cout << t_[0] << " " << a_[0] << endl;
}
0