結果
| 問題 |
No.1004 サイコロの実装 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-06 21:32:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,144 bytes |
| コンパイル時間 | 1,453 ms |
| コンパイル使用メモリ | 166,960 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-14 04:21:21 |
| 合計ジャッジ時間 | 5,263 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 17 TLE * 1 -- * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
void solve();
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(numeric_limits<double>::max_digits10);
solve();
return 0;
}
void solve() {
ll a, b, x, n;
cin >> a >> b >> x >> n;
auto roll = [&](int x0) {
return (a * x0 + b) % (int)pow(2, 32);
};
ll takahashi = 0;
ll aoki = 0;
int t_b = 0;
int t_w = 0;
int a_b = 0;
int a_w = 0;
REP(i, n) {
REP(j, 2) {
x = roll(x);
// cout << x << endl;
if (j == 0) {
takahashi += (x % 6) + 1;
if (takahashi % 2 == 0) {
t_w++;
} else {
t_b++;
}
} else {
aoki += (x % 6) + 1;
if (aoki % 2 == 0) {
a_w++;
} else {
a_b++;
}
}
}
}
cout << min(t_b, t_w) << " " << min(a_b, a_w) << endl;
}