結果

問題 No.1004 サイコロの実装 (2)
ユーザー beet
提出日時 2020-03-06 22:18:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 675 bytes
コンパイル時間 2,746 ms
コンパイル使用メモリ 191,408 KB
最終ジャッジ日時 2025-01-09 05:20:13
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25 TLE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;

  if(~x&1) cout<<0<<" "<<n/2<<endl;
  else cout<<n/2<<" "<<0<<endl;
  return 0;
}
0