結果

問題 No.398 ハーフパイプ(2)
ユーザー sortreew
提出日時 2016-07-15 23:53:59
言語 C++11
(gcc 4.8.5)
結果
AC  
実行時間 154 ms
コード長 1,212 Byte
コンパイル時間 907 ms
使用メモリ 64,592 KB
最終ジャッジ日時 2019-09-08 00:46:08

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
0_0.txt AC 4 ms
6,868 KB
0_1.txt AC 4 ms
6,872 KB
0_2.txt AC 140 ms
61,032 KB
1_0.txt AC 143 ms
61,616 KB
1_1.txt AC 143 ms
61,316 KB
1_2.txt AC 66 ms
60,096 KB
1_3.txt AC 43 ms
28,268 KB
1_4.txt AC 100 ms
48,448 KB
1_5.txt AC 13 ms
42,800 KB
99_system_test1.txt AC 70 ms
40,464 KB
99_system_test2.txt AC 109 ms
50,652 KB
99_system_test3.txt AC 113 ms
64,120 KB
99_system_test4.txt AC 96 ms
47,704 KB
99_system_test5.txt AC 52 ms
58,024 KB
99_system_test6.txt AC 131 ms
56,808 KB
99_system_test7.txt AC 138 ms
62,256 KB
99_system_test8.txt AC 76 ms
42,508 KB
99_system_test9.txt AC 86 ms
45,244 KB
99_system_test10.txt AC 140 ms
63,964 KB
99_system_test11.txt AC 136 ms
56,804 KB
99_system_test12.txt AC 97 ms
47,480 KB
99_system_test13.txt AC 129 ms
54,312 KB
99_system_test14.txt AC 154 ms
62,612 KB
99_system_test15.txt AC 147 ms
61,236 KB
99_system_test16.txt AC 123 ms
54,312 KB
99_system_test17.txt AC 130 ms
64,588 KB
99_system_test18.txt AC 139 ms
59,240 KB
99_system_test19.txt AC 94 ms
63,004 KB
99_system_test20.txt AC 119 ms
52,560 KB
99_system_test21.txt AC 129 ms
56,140 KB
99_system_test22.txt AC 127 ms
56,292 KB
99_system_test23.txt AC 130 ms
62,936 KB
99_system_test24.txt AC 125 ms
54,100 KB
99_system_test25.txt AC 138 ms
58,136 KB
99_system_test26.txt AC 138 ms
64,240 KB
99_system_test27.txt AC 140 ms
60,820 KB
99_system_test28.txt AC 130 ms
64,592 KB
99_system_test29.txt AC 125 ms
55,292 KB
99_system_test30.txt AC 74 ms
61,284 KB
99_system_test31.txt AC 109 ms
64,128 KB
99_system_test32.txt AC 106 ms
50,844 KB
99_system_test33.txt AC 105 ms
49,988 KB
99_system_test34.txt AC 135 ms
58,436 KB
99_system_test35.txt AC 73 ms
42,504 KB
99_system_test36.txt AC 36 ms
28,296 KB
99_system_test37.txt AC 67 ms
40,472 KB
99_system_test38.txt AC 138 ms
62,748 KB
99_system_test39.txt AC 142 ms
56,652 KB
99_system_test40.txt AC 127 ms
64,540 KB
99_system_test41.txt AC 86 ms
62,392 KB
99_system_test42.txt AC 129 ms
64,576 KB
99_system_test43.txt AC 98 ms
48,660 KB
99_system_test44.txt AC 136 ms
63,888 KB
99_system_test45.txt AC 131 ms
56,292 KB
99_system_test46.txt AC 121 ms
53,116 KB
99_system_test47.txt AC 106 ms
63,996 KB
99_system_test48.txt AC 136 ms
63,928 KB
99_system_test49.txt AC 141 ms
60,700 KB
99_system_test50.txt AC 135 ms
63,960 KB
99_system_test51.txt AC 18 ms
16,096 KB
99_system_test52.txt AC 139 ms
62,604 KB
99_system_test53.txt AC 138 ms
63,292 KB
99_system_test54.txt AC 118 ms
53,932 KB
99_system_test55.txt AC 110 ms
51,492 KB
99_system_test56.txt AC 108 ms
50,844 KB
99_system_test57.txt AC 138 ms
59,236 KB
99_system_test58.txt AC 128 ms
55,084 KB
99_system_test59.txt AC 128 ms
54,592 KB
99_system_test60.txt AC 144 ms
61,228 KB
99_system_test61.txt AC 120 ms
53,560 KB
99_system_test62.txt AC 134 ms
55,828 KB
99_system_test63.txt AC 86 ms
62,296 KB
99_system_test64.txt AC 136 ms
64,372 KB
99_system_test65.txt AC 82 ms
44,556 KB
99_system_test66.txt AC 102 ms
63,944 KB
99_system_test67.txt AC 140 ms
59,632 KB
99_system_test68.txt AC 134 ms
57,652 KB
99_system_test69.txt AC 100 ms
48,664 KB
99_system_test70.txt AC 141 ms
61,612 KB
99_system_test71.txt AC 114 ms
51,488 KB
99_system_test72.txt AC 130 ms
55,620 KB
99_system_test73.txt AC 58 ms
34,372 KB
99_system_test74.txt AC 20 ms
18,140 KB
99_system_test75.txt AC 136 ms
64,320 KB
99_system_test76.txt AC 129 ms
56,292 KB
99_system_test77.txt AC 134 ms
57,848 KB
99_system_test78.txt AC 64 ms
38,444 KB
99_system_test79.txt AC 129 ms
64,404 KB
99_system_test80.txt AC 126 ms
64,500 KB
99_system_test81.txt AC 144 ms
62,892 KB
99_system_test82.txt AC 145 ms
60,592 KB
99_system_test83.txt AC 141 ms
60,592 KB
99_system_test84.txt AC 142 ms
63,620 KB
99_system_test85.txt AC 133 ms
64,404 KB
99_system_test86.txt AC 143 ms
60,908 KB
99_system_test87.txt AC 144 ms
63,452 KB
99_system_test88.txt AC 127 ms
54,920 KB
99_system_test89.txt AC 123 ms
53,928 KB
99_system_test90.txt AC 125 ms
55,288 KB
99_system_test91.txt AC 121 ms
53,740 KB
99_system_test92.txt AC 96 ms
47,936 KB
99_system_test93.txt AC 86 ms
44,920 KB
99_system_test94.txt AC 146 ms
61,320 KB
99_system_test95.txt AC 126 ms
64,560 KB
99_system_test96.txt AC 31 ms
53,120 KB
99_system_test97.txt AC 118 ms
64,520 KB
99_system_test98.txt AC 124 ms
54,912 KB
99_system_test99.txt AC 148 ms
62,120 KB
99_system_test100.txt AC 140 ms
59,236 KB
99_system_test101.txt AC 136 ms
64,300 KB
99_system_test102.txt AC 101 ms
48,180 KB
system_test1.txt AC 89 ms
62,496 KB
system_test2.txt AC 79 ms
61,636 KB
system_test3.txt AC 63 ms
59,520 KB
system_test4.txt AC 116 ms
64,480 KB
system_test5.txt AC 116 ms
64,380 KB
system_test6.txt AC 122 ms
64,496 KB
system_test7.txt AC 39 ms
55,160 KB
system_test8.txt AC 117 ms
64,380 KB
テストケース一括ダウンロード

ソースコード

diff #
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define TT second.second
#define SS second.first
#define FF first
using namespace std;
typedef long double ld;
typedef long long LL;
typedef int ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
const int INF=1<<30;
const int BITSIZE=1<<12;
const int SIZE=10+2*1e4;
LL DP[101][101][5][400];
LL solve(int a,int b,int n,LL sum){
	if(n==0) return sum==0;
	if(n*b<sum) return 0;
	if(sum<n*a) return 0;
	if(DP[a][b][n][sum]) return DP[a][b][n][sum];
	LL answer=0;
	FOR(i,a,b+1)
		answer+=solve(a,b,n-1,sum-i);
	return DP[a][b][n][sum]=answer; 
}
LL nCrDP[100][100];
LL nCr(int n,int r){
	if(r==0 || r==n) return 1;
	if(nCrDP[n][r]) return nCrDP[n][r];
	return nCrDP[n][r]=nCr(n-1,r-1)+nCr(n-1,r);
}
int main(){
	ld x;
	cin >> x;
	LL sum=x*4;
	LL answer=0;
	REP(i,101)
		REP(j,i){
			FOR(k,1,5+1)
				FOR(l,1,6-k+1){
					answer+=nCr(6,k)*nCr(6-k,l)*solve(j+1,i-1,6-k-l,sum-i*(k-1)-j*(l-1));
					}
		}
	if(sum%4==0) answer++;
	cout << answer << endl;
	return 0;
}
0