結果

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

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
0_0.txt AC 4 ms
1,528 KB
0_1.txt AC 4 ms
1,536 KB
0_2.txt AC 159 ms
38,276 KB
1_0.txt AC 159 ms
38,256 KB
1_1.txt AC 159 ms
38,252 KB
1_2.txt AC 66 ms
24,824 KB
1_3.txt AC 57 ms
21,060 KB
1_4.txt AC 120 ms
32,248 KB
1_5.txt AC 6 ms
1,940 KB
99_system_test1.txt AC 90 ms
27,172 KB
99_system_test2.txt AC 129 ms
33,460 KB
99_system_test3.txt AC 117 ms
33,612 KB
99_system_test4.txt AC 120 ms
31,568 KB
99_system_test5.txt AC 51 ms
21,304 KB
99_system_test6.txt AC 154 ms
36,780 KB
99_system_test7.txt AC 158 ms
38,064 KB
99_system_test8.txt AC 102 ms
28,280 KB
99_system_test9.txt AC 110 ms
30,104 KB
99_system_test10.txt AC 155 ms
37,648 KB
99_system_test11.txt AC 157 ms
36,784 KB
99_system_test12.txt AC 120 ms
31,444 KB
99_system_test13.txt AC 149 ms
35,508 KB
99_system_test14.txt AC 162 ms
38,400 KB
99_system_test15.txt AC 165 ms
38,284 KB
99_system_test16.txt AC 149 ms
35,508 KB
99_system_test17.txt AC 144 ms
36,476 KB
99_system_test18.txt AC 164 ms
37,772 KB
99_system_test19.txt AC 98 ms
30,576 KB
99_system_test20.txt AC 137 ms
34,656 KB
99_system_test21.txt AC 149 ms
36,528 KB
99_system_test22.txt AC 150 ms
36,568 KB
99_system_test23.txt AC 141 ms
36,596 KB
99_system_test24.txt AC 142 ms
35,392 KB
99_system_test25.txt AC 154 ms
37,492 KB
99_system_test26.txt AC 149 ms
37,660 KB
99_system_test27.txt AC 158 ms
38,280 KB
99_system_test28.txt AC 138 ms
36,476 KB
99_system_test29.txt AC 147 ms
36,184 KB
99_system_test30.txt AC 76 ms
26,968 KB
99_system_test31.txt AC 118 ms
33,608 KB
99_system_test32.txt AC 130 ms
33,528 KB
99_system_test33.txt AC 128 ms
33,088 KB
99_system_test34.txt AC 156 ms
37,584 KB
99_system_test35.txt AC 97 ms
28,112 KB
99_system_test36.txt AC 51 ms
19,484 KB
99_system_test37.txt AC 87 ms
26,848 KB
99_system_test38.txt AC 157 ms
38,332 KB
99_system_test39.txt AC 149 ms
36,728 KB
99_system_test40.txt AC 136 ms
35,900 KB
99_system_test41.txt AC 88 ms
29,192 KB
99_system_test42.txt AC 135 ms
36,252 KB
99_system_test43.txt AC 122 ms
32,368 KB
99_system_test44.txt AC 153 ms
37,776 KB
99_system_test45.txt AC 150 ms
36,572 KB
99_system_test46.txt AC 142 ms
35,388 KB
99_system_test47.txt AC 113 ms
33,048 KB
99_system_test48.txt AC 149 ms
37,716 KB
99_system_test49.txt AC 158 ms
38,268 KB
99_system_test50.txt AC 151 ms
37,648 KB
99_system_test51.txt AC 26 ms
12,692 KB
99_system_test52.txt AC 159 ms
38,396 KB
99_system_test53.txt AC 156 ms
38,420 KB
99_system_test54.txt AC 142 ms
35,332 KB
99_system_test55.txt AC 132 ms
33,888 KB
99_system_test56.txt AC 129 ms
33,532 KB
99_system_test57.txt AC 158 ms
37,776 KB
99_system_test58.txt AC 151 ms
36,528 KB
99_system_test59.txt AC 150 ms
36,312 KB
99_system_test60.txt AC 159 ms
38,276 KB
99_system_test61.txt AC 142 ms
35,160 KB
99_system_test62.txt AC 148 ms
36,412 KB
99_system_test63.txt AC 88 ms
28,992 KB
99_system_test64.txt AC 145 ms
37,060 KB
99_system_test65.txt AC 101 ms
29,096 KB
99_system_test66.txt AC 111 ms
32,892 KB
99_system_test67.txt AC 157 ms
37,844 KB
99_system_test68.txt AC 158 ms
37,664 KB
99_system_test69.txt AC 120 ms
32,368 KB
99_system_test70.txt AC 162 ms
38,252 KB
99_system_test71.txt AC 140 ms
33,892 KB
99_system_test72.txt AC 152 ms
36,308 KB
99_system_test73.txt AC 76 ms
24,504 KB
99_system_test74.txt AC 29 ms
13,568 KB
99_system_test75.txt AC 145 ms
37,328 KB
99_system_test76.txt AC 150 ms
36,568 KB
99_system_test77.txt AC 153 ms
37,404 KB
99_system_test78.txt AC 82 ms
25,876 KB
99_system_test79.txt AC 143 ms
36,776 KB
99_system_test80.txt AC 131 ms
35,556 KB
99_system_test81.txt AC 159 ms
38,264 KB
99_system_test82.txt AC 158 ms
38,260 KB
99_system_test83.txt AC 159 ms
38,256 KB
99_system_test84.txt AC 155 ms
38,140 KB
99_system_test85.txt AC 142 ms
36,780 KB
99_system_test86.txt AC 161 ms
38,256 KB
99_system_test87.txt AC 156 ms
38,268 KB
99_system_test88.txt AC 146 ms
36,004 KB
99_system_test89.txt AC 144 ms
35,324 KB
99_system_test90.txt AC 149 ms
36,188 KB
99_system_test91.txt AC 140 ms
35,248 KB
99_system_test92.txt AC 120 ms
31,704 KB
99_system_test93.txt AC 104 ms
29,820 KB
99_system_test94.txt AC 159 ms
38,244 KB
99_system_test95.txt AC 136 ms
36,032 KB
99_system_test96.txt AC 26 ms
13,700 KB
99_system_test97.txt AC 127 ms
35,052 KB
99_system_test98.txt AC 145 ms
36,012 KB
99_system_test99.txt AC 159 ms
38,520 KB
99_system_test100.txt AC 158 ms
37,772 KB
99_system_test101.txt AC 147 ms
37,408 KB
99_system_test102.txt AC 118 ms
32,068 KB
system_test1.txt AC 90 ms
29,396 KB
system_test2.txt AC 81 ms
27,684 KB
system_test3.txt AC 61 ms
23,820 KB
system_test4.txt AC 127 ms
34,920 KB
system_test5.txt AC 123 ms
34,508 KB
system_test6.txt AC 138 ms
35,556 KB
system_test7.txt AC 35 ms
16,780 KB
system_test8.txt AC 122 ms
34,508 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