Submission #780242

# Submission time Handle Problem Language Result Execution time Memory
780242 2023-07-12T07:37:48 Z vjudge1 Go (COCI18_go) C++17
40 / 100
65 ms 164940 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define endl "\n"
#define ll long long
#define pb push_back
#define N 200005
// süre  nerde pokemon_deg 
vector<tuple<ll int,ll int,ll int>> pokemon;
int n,m,k;
ll int dp[102][103][2002];
map<int,int> mp;
ll int hesap(int hangi_pokemon,ll int sn,ll int sonyer){

	if(dp[hangi_pokemon][sonyer][sn]!=-1)return dp[hangi_pokemon][sonyer][sn];
	if(hangi_pokemon>=m)return 0;
	ll int a=hesap(hangi_pokemon+1,sn,sonyer);
	ll int b=0;

	ll int nerde,deg,tim;
	tie(tim,nerde,deg)=pokemon[hangi_pokemon];
	ll int xxx,yyy,zzz;
	if(sonyer!=102)tie(yyy,xxx,zzz)=pokemon[sonyer];
	else xxx=k;

	if(tim>abs(nerde-xxx)+sn){
		b=hesap(hangi_pokemon+1,sn+abs(nerde-xxx),hangi_pokemon)+deg;
	}
	dp[hangi_pokemon][sonyer][sn]=max(a,b);
	return dp[hangi_pokemon][sonyer][sn];

}
int main(){
	lalala;
	memset(dp,-1,sizeof(dp));
	int mm;cin>>n>>k>>mm;
	for(int i=0;i<mm;i++){
		ll int a,b,c;cin>>a>>b>>c;
		if(abs(k-a)<c){
			m++;
			pokemon.pb({c,a,b});
		}
	}
	sort(pokemon.begin(),pokemon.end());
	cout<<hesap(0,0,102)<<endl;

}
# Verdict Execution time Memory Grader output
1 Correct 65 ms 164940 KB Output is correct
2 Correct 57 ms 164900 KB Output is correct
3 Incorrect 56 ms 164868 KB Output isn't correct
4 Correct 58 ms 164856 KB Output is correct
5 Correct 58 ms 164908 KB Output is correct
6 Incorrect 59 ms 164884 KB Output isn't correct
7 Incorrect 59 ms 164864 KB Output isn't correct
8 Incorrect 59 ms 164840 KB Output isn't correct
9 Incorrect 58 ms 164940 KB Output isn't correct
10 Incorrect 57 ms 164904 KB Output isn't correct