Submission #8485627


Source Code Expand

Copy
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll int N,T;
struct st{ ll A,B; }arr[3001];
struct dy{ ll t,c; }dp[3001];
map<ll,ll> jido;
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>N>>T;
	for(int i=1;i<=N;i++){
		cin>>arr[i].A>>arr[i].B;
		dp[i].t=9000000000; dp[i].c=0;
	}
	for(int i=1;i<=N;i++){
		for(int j=T-1;j>=0;j--){
			if((jido[j] || j==0)){
				jido[j+arr[i].A] = max(jido[j+arr[i].A], jido[j]+arr[i].B);
			}
		}
	}
	ll ans=0;
	for(int i=0;i<T+3000;i++) if(jido[i]) ans=max(ans,jido[i]);
	cout<<ans;
}

Submission Info

Submission Time
Task E - All-you-can-eat
User Seremo
Language C++14 (GCC 5.4.1)
Score 0
Code Size 572 Byte
Status WA
Exec Time 2064 ms
Memory 768 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 4
AC × 14
WA × 15
TLE × 2
Set Name Test Cases
Sample sample_01, sample_02, sample_03, sample_04
All corner_01, corner_02, corner_03, corner_04, corner_05, corner_06, corner_07, hand_01, hand_02, max_01, max_02, max_03, max_04, max_05, max_06, max_07, max_08, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, random_10, sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
corner_01 AC 11 ms 512 KB
corner_02 AC 99 ms 640 KB
corner_03 AC 197 ms 640 KB
corner_04 AC 24 ms 640 KB
corner_05 AC 42 ms 640 KB
corner_06 AC 45 ms 640 KB
corner_07 WA 248 ms 640 KB
hand_01 AC 2 ms 512 KB
hand_02 AC 2 ms 512 KB
max_01 TLE 2064 ms 768 KB
max_02 TLE 2051 ms 768 KB
max_03 AC 447 ms 768 KB
max_04 AC 437 ms 768 KB
max_05 WA 1223 ms 768 KB
max_06 WA 1217 ms 768 KB
max_07 WA 1236 ms 768 KB
max_08 WA 1228 ms 768 KB
random_01 WA 266 ms 512 KB
random_02 WA 133 ms 512 KB
random_03 WA 733 ms 640 KB
random_04 WA 127 ms 512 KB
random_05 WA 288 ms 640 KB
random_06 WA 977 ms 640 KB
random_07 WA 889 ms 640 KB
random_08 WA 148 ms 640 KB
random_09 WA 714 ms 640 KB
random_10 WA 779 ms 640 KB
sample_01 AC 2 ms 512 KB
sample_02 AC 2 ms 512 KB
sample_03 AC 2 ms 512 KB
sample_04 AC 2 ms 512 KB