結果

問題 No.1163 I want to be a high achiever
ユーザー chocoruskchocorusk
提出日時 2020-08-12 00:24:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,117 bytes
コンパイル時間 1,442 ms
コンパイル使用メモリ 126,364 KB
実行使用メモリ 199,424 KB
最終ジャッジ日時 2024-04-17 17:58:53
合計ジャッジ時間 6,909 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 192 ms
199,168 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 192 ms
199,168 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 192 ms
199,168 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 2 ms
5,376 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, x; cin>>n>>x;
	int a[505], b[505];
	const int geta=100;
	for(int i=0; i<n; i++){
		cin>>a[i];
		a[i]-=x;
		a[i]+=geta;
	}
	for(int i=0; i<n; i++) cin>>b[i];
	int dp[501][200*500+1];
	const int INF=1e9+7;
	for(int i=0; i<=n; i++) for(int j=0; j<=2*geta*n; j++) dp[i][j]=INF;
	dp[0][0]=0;
	for(int i=0; i<n; i++){
		for(int j=0; j<=2*geta*i; j++){
			dp[i+1][j+a[i]]=min(dp[i+1][j+a[i]], dp[i][j]);
			dp[i+1][j]=min(dp[i+1][j], dp[i][j]+b[i]);
		}
	}
	int ans=INF;
	for(int i=geta*n; i<=2*geta*n; i++) ans=min(ans, dp[n][i]);
	cout<<ans<<endl;
	return 0;
}
0