結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 226 ms
199,248 KB
testcase_05 AC 179 ms
199,296 KB
testcase_06 AC 176 ms
199,296 KB
testcase_07 AC 227 ms
199,252 KB
testcase_08 AC 197 ms
199,168 KB
testcase_09 AC 180 ms
199,280 KB
testcase_10 AC 226 ms
199,296 KB
testcase_11 AC 179 ms
199,296 KB
testcase_12 AC 176 ms
199,168 KB
testcase_13 AC 178 ms
199,176 KB
testcase_14 AC 175 ms
199,128 KB
testcase_15 AC 201 ms
199,296 KB
testcase_16 AC 179 ms
199,296 KB
testcase_17 AC 186 ms
199,168 KB
testcase_18 AC 180 ms
199,292 KB
testcase_19 AC 177 ms
199,296 KB
testcase_20 AC 177 ms
199,168 KB
testcase_21 AC 176 ms
199,296 KB
testcase_22 AC 176 ms
199,424 KB
testcase_23 AC 177 ms
199,276 KB
testcase_24 AC 225 ms
199,172 KB
testcase_25 AC 229 ms
199,392 KB
testcase_26 AC 183 ms
199,168 KB
testcase_27 AC 3 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 176 ms
199,296 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 3 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+geta]=min(dp[i+1][j+geta], dp[i][j]+b[i]);
		}
	}
	int ans=INF;
	for(int i=geta*n; i<=2*geta*n; i++) ans=min(ans, dp[n][i]);
	if(ans<INF) cout<<ans<<endl;
	else cout<<-1<<endl;
	return 0;
}
0