結果
| 問題 |
No.2741 Balanced Choice
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-21 02:56:11 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 695 bytes |
| コンパイル時間 | 3,181 ms |
| コンパイル使用メモリ | 246,408 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-13 01:20:09 |
| 合計ジャッジ時間 | 3,566 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 6 WA * 4 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long n,tw,d;
cin >> n >> tw >> d;
vector<long long> d0(tw+1,0);
vector<long long> d1(tw+1,0);
while(n>0){
n--;
long long t,w,v;
cin >> t >> w >> v;
if(t==0){
for(long long i=tw-w;i>=0;i--){
d0[i+w]=max(d0[i+w],d0[i]+v);
}
}
else{
for(long long i=tw-w;i>=0;i--){
d1[i+w]=max(d1[i+w],d1[i]+v);
}
}
}
long long res=0;
for(long long i=0;i<=tw;i++){
for(long long j=0;i+j<=tw;j++){
if(abs(i-j)<=d){
res=max(res,d0[i]+d1[j]);
}
}
}
cout << res << "\n";
return 0;
}