結果
問題 |
No.1004 サイコロの実装 (2)
|
ユーザー |
![]() |
提出日時 | 2020-03-06 21:35:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 674 bytes |
コンパイル時間 | 1,436 ms |
コンパイル使用メモリ | 166,548 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-10-14 04:27:14 |
合計ジャッジ時間 | 5,213 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 TLE * 1 -- * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; using ull=unsigned long long; using pii=pair<int,int>; #define INF LONG_MAX #define MOD 1000000007 #define rng(a) a.begin(),a.end() #define rrng(a) a.end(),a.begin() #define rep(i,N) for(int i=0;i<N;i++) int main(){ ios::sync_with_stdio(false); cin.tie(0); ull a,b,x,N; cin>>a>>b>>x>>N; ull t=0,ao=0; ull tb=0,tw=0,aob=0,aow=0; for(ull i=0;i<2*N;i++){ x=a*x+b; ull X=x%6+1; if(i%2==0){ t+=X; if(t%2==0)tb++; else tw++; } else{ ao+=X; if(ao%2==0)aob++; else aow++; } } cout<<min(tb,tw)<<" "<<min(aob,aow)<<endl; return 0; }