結果
問題 |
No.1004 サイコロの実装 (2)
|
ユーザー |
![]() |
提出日時 | 2020-03-06 22:13:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 602 bytes |
コンパイル時間 | 3,710 ms |
コンパイル使用メモリ | 191,232 KB |
最終ジャッジ日時 | 2025-01-09 05:17:05 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 TLE * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; using Int = long long; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} //INSERT ABOVE HERE signed main(){ cin.tie(0); ios::sync_with_stdio(0); using uint = unsigned int; uint a,b,x; long long n; cin>>a>>b>>x>>n; uint cs[2][2]={}; uint ps[2]={}; for(long long i=0;i<n*2;i++){ x=a*x+b; ps[i&1]=(ps[i&1]+x+1)&1; cs[i&1][ps[i&1]]++; } cout<<min(cs[0][0],cs[0][1])<<" "<<min(cs[1][0],cs[1][1])<<endl; return 0; }