Submission #8486681


Source Code Expand

Copy
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
using namespace std;
ll int N,T;
struct st{ ll A,B; }arr[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;
	}
	sort(arr+1,arr+N+1,[&](st a,st b){
		return a.A<b.A;
	});
	for(int i=1;i<=N;i++){
		for(ll 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(ll 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 500
Code Size 596 Byte
Status AC
Exec Time 1978 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 4
AC × 31
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 13 ms 512 KB
corner_02 AC 87 ms 640 KB
corner_03 AC 169 ms 640 KB
corner_04 AC 22 ms 640 KB
corner_05 AC 46 ms 640 KB
corner_06 AC 28 ms 640 KB
corner_07 AC 165 ms 640 KB
hand_01 AC 2 ms 512 KB
hand_02 AC 2 ms 512 KB
max_01 AC 1978 ms 640 KB
max_02 AC 1918 ms 640 KB
max_03 AC 429 ms 640 KB
max_04 AC 427 ms 640 KB
max_05 AC 1181 ms 640 KB
max_06 AC 1180 ms 640 KB
max_07 AC 1180 ms 640 KB
max_08 AC 1177 ms 640 KB
random_01 AC 269 ms 512 KB
random_02 AC 140 ms 512 KB
random_03 AC 694 ms 640 KB
random_04 AC 140 ms 512 KB
random_05 AC 283 ms 640 KB
random_06 AC 927 ms 640 KB
random_07 AC 869 ms 640 KB
random_08 AC 156 ms 640 KB
random_09 AC 696 ms 640 KB
random_10 AC 754 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