結果

問題 No.398 ハーフパイプ(2)
ユーザー koyumeishikoyumeishi
提出日時 2015-10-27 23:54:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,110 ms / 2,000 ms
コード長 1,578 bytes
コンパイル時間 1,164 ms
コンパイル使用メモリ 87,824 KB
実行使用メモリ 100,644 KB
最終ジャッジ日時 2023-09-09 21:48:56
合計ジャッジ時間 21,389 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,077 ms
100,568 KB
testcase_01 AC 1,064 ms
100,444 KB
testcase_02 AC 1,059 ms
100,464 KB
testcase_03 AC 1,061 ms
100,504 KB
testcase_04 AC 1,067 ms
100,396 KB
testcase_05 AC 1,064 ms
100,568 KB
testcase_06 AC 1,056 ms
100,444 KB
testcase_07 AC 1,066 ms
100,440 KB
testcase_08 AC 1,079 ms
100,512 KB
testcase_09 AC 1,070 ms
100,332 KB
testcase_10 AC 1,053 ms
100,572 KB
testcase_11 AC 1,070 ms
100,444 KB
testcase_12 AC 1,081 ms
100,536 KB
testcase_13 AC 1,077 ms
100,640 KB
testcase_14 AC 1,102 ms
100,568 KB
testcase_15 AC 1,110 ms
100,644 KB
testcase_16 AC 1,110 ms
100,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>
using namespace std;

#define SZ 101
#define NUM 6

map<int,long long> m;


//resize(vector, {v1,v2,v3});

void resize(int& val , vector<int>::iterator itr){val = 0;}
void resize(long long& val , vector<int>::iterator itr){val = 0;}
void resize(double& val , vector<int>::iterator itr){val = 0;}

template<class T>
void resize(vector<T>& vec, vector<int>::iterator itr){
	vec.resize(*itr);
	for(int i=0; i<*itr; i++){
		resize(vec[i], itr+1);
	}
}

template<class T>
void resize(T& vec, vector<int> sz){
	resize(vec, sz.begin());
}

int main(){
	vector<vector<vector<long long>>> dp;	//dp[min][max][sum]
	resize(dp, {SZ,SZ,SZ*NUM+1});

	for(int i=0; i<SZ; i++){
		dp[i][i][i] = 1;
	}
	for(int i=1; i<NUM; i++){
		vector<vector<vector<long long>>> dp_;
		resize(dp_, {SZ,SZ,SZ*NUM+1});

		for(int k=0; k<SZ; k++)
		for(int min_=0;    min_<SZ; min_++)
		for(int max_=min_; max_<SZ; max_++)
		for(int sum=0; sum<i*SZ; sum++){
			dp_[min(min_,k)][max(max_,k)][sum+k] += dp[min_][max_][sum];	
		}
		swap(dp, dp_);
	}

	for(int min_=0;    min_<SZ; min_++)
	for(int max_=min_; max_<SZ; max_++)
	for(int sum=0; sum<NUM*SZ; sum++){
		if(dp[min_][max_][sum] > 0)
			m[sum-(min_+max_)] += dp[min_][max_][sum];
	}

	// cout << "{";
	// for(int i=0; i<=200; i++){
	// 	cout << m[i] << (m[i]>1e9?"LL":"") << ",";
	// }
	// cout << "}" << endl;

	int a,b;
	scanf("%d.%d", &a,&b);
	a = (a*100+b)/25;
	assert(0<=a && a<=400);

	cout << m[a] << endl;
	return 0;
}
0