|
| 1 | +#include <bits/stdc++.h> |
| 2 | +using namespace std; |
| 3 | +using ll = long long; |
| 4 | + |
| 5 | +// Template |
| 6 | +#define REP(n) for (int _=0; _<(n); _++) |
| 7 | +#define FOR(i, a, b) for (int i=a; i<(b); i++) |
| 8 | +#define F0R(i, a) for (int i=0; i<(a); i++) |
| 9 | +#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--) |
| 10 | +#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--) |
| 11 | + |
| 12 | +#define sz(x) (int)(x).size() |
| 13 | +#define all(x) x.begin(), x.end() |
| 14 | + |
| 15 | +template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } |
| 16 | +template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } |
| 17 | + |
| 18 | +namespace std { |
| 19 | + template<class Fun> |
| 20 | + class y_combinator_result { |
| 21 | + Fun fun_; |
| 22 | + public: |
| 23 | + template<class T> |
| 24 | + explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {} |
| 25 | + |
| 26 | + template<class ...Args> |
| 27 | + decltype(auto) operator()(Args &&...args) { |
| 28 | + return fun_(std::ref(*this), std::forward<Args>(args)...); |
| 29 | + } |
| 30 | + }; |
| 31 | + |
| 32 | + template<class Fun> |
| 33 | + decltype(auto) y_combinator(Fun &&fun) { |
| 34 | + return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun)); |
| 35 | + } |
| 36 | +} // namespace std |
| 37 | + |
| 38 | +#define DEBUG(x) cerr << #x << ": " << x << '\n' |
| 39 | +template<typename A, typename B> |
| 40 | +ostream& operator<<(ostream &os, const pair<A, B> &p) { |
| 41 | + return os << '(' << p.first << ", " << p.second << ')'; |
| 42 | +} |
| 43 | +template<typename T_container, |
| 44 | + typename T = typename enable_if<!is_same<T_container, string>::value, |
| 45 | + typename T_container::value_type>::type> |
| 46 | +ostream& operator<<(ostream &os, const T_container &v) { |
| 47 | + os << '['; string sep; |
| 48 | + for (const T &x : v) |
| 49 | + os << sep << x, sep = ", "; |
| 50 | + return os << ']'; |
| 51 | +} |
| 52 | +mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); |
| 53 | + |
| 54 | +int main() { |
| 55 | + ios_base::sync_with_stdio(false); cin.tie(NULL); |
| 56 | + int N = 4; |
| 57 | + string t; |
| 58 | + vector<int> times(N), dist(N); |
| 59 | + cin >> t; |
| 60 | + F0R(i, 4) cin >> times[i]; |
| 61 | + cin >> t; |
| 62 | + F0R(i, 4) cin >> dist[i]; |
| 63 | + |
| 64 | + ll ans = 1; |
| 65 | + F0R(i, N) { |
| 66 | + int T = times[i]; |
| 67 | + int record = dist[i]; |
| 68 | + |
| 69 | + int ways = 0; |
| 70 | + for (int x = 0; x <= T; x++) { |
| 71 | + int d = (T - x) * x; |
| 72 | + if (d > record) ways++; |
| 73 | + } |
| 74 | + DEBUG(ways); |
| 75 | + |
| 76 | + ans *= ways; |
| 77 | + } |
| 78 | + cout << ans << '\n'; |
| 79 | +} |
0 commit comments