結果
問題 | No.398 ハーフパイプ(2) |
ユーザー | sugim48 |
提出日時 | 2016-07-15 22:44:34 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 211 ms / 2,000 ms |
コード長 | 1,632 bytes |
コンパイル時間 | 948 ms |
コンパイル使用メモリ | 103,480 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-09 21:58:43 |
合計ジャッジ時間 | 3,976 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
4,380 KB |
testcase_01 | AC | 211 ms
4,376 KB |
testcase_02 | AC | 91 ms
4,376 KB |
testcase_03 | AC | 94 ms
4,376 KB |
testcase_04 | AC | 92 ms
4,376 KB |
testcase_05 | AC | 164 ms
4,376 KB |
testcase_06 | AC | 46 ms
4,380 KB |
testcase_07 | AC | 60 ms
4,376 KB |
testcase_08 | AC | 209 ms
4,376 KB |
testcase_09 | AC | 150 ms
4,376 KB |
testcase_10 | AC | 156 ms
4,380 KB |
testcase_11 | AC | 166 ms
4,376 KB |
testcase_12 | AC | 129 ms
4,376 KB |
testcase_13 | AC | 133 ms
4,376 KB |
testcase_14 | AC | 125 ms
4,380 KB |
testcase_15 | AC | 182 ms
4,376 KB |
testcase_16 | AC | 131 ms
4,376 KB |
ソースコード
#define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cstdio> #include <functional> #include <iostream> #include <cfloat> #include <climits> #include <cstdlib> #include <cstring> #include <cmath> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> #include <random> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> i_i; typedef pair<ll, int> ll_i; typedef pair<double, int> d_i; typedef pair<ll, ll> ll_ll; typedef pair<double, double> d_d; struct edge { int u, v; ll w; }; typedef vector<vector<bool> > grid; ll INF = LLONG_MAX / 3; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int calc(vector<int> lb, vector<int> ub, int tot) { for (int i = 0; i < 4; i++) { tot -= lb[i]; ub[i] -= lb[i]; if (ub[i] < 0) return 0; } if (tot < 0) return 0; vector<int> dp(tot + 1); dp[0] = 1; for (int x: ub) { for (int y = tot; y >= x + 1; y--) dp[y] -= dp[y - x - 1]; for (int y = 1; y <= tot; y++) dp[y] += dp[y - 1]; } return dp[tot]; } int main() { double X; cin >> X; int tot = X * 4 + 0.5; ll ans = 0; for (int i = 0; i < 6; i++) for (int j = 0; j < 6; j++) { if (i == j) continue; for (int mi = 0; mi <= 100; mi++) for (int ma = (i < j ? mi : mi + 1); ma <= 100; ma++) { vector<int> lb, ub; for (int k = 0; k < 6; k++) { if (k == i || k == j) continue; lb.push_back(k < i ? mi + 1 : mi); ub.push_back(k < j ? ma - 1 : ma); } ans += calc(lb, ub, tot); } } cout << ans << endl; }