Submission #854663

# Submission time Handle Problem Language Result Execution time Memory
854663 2023-09-28T11:42:54 Z willychan Semiexpress (JOI17_semiexpress) C++14
48 / 100
1000 ms 600 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds
#define int ll

ll dp[3005];

vector<int> stop;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n,m,k;cin>>n>>m>>k;
	int a,b,c;cin>>a>>b>>c;
	ll T;cin>>T;
	stop.resize(m);
	k-=m;
	for(int i=0;i<k;i++) dp[i]=0;
	for(int i=0;i<m;i++){cin>>stop[i];stop[i]--;}
	for(int i=0;i<m-1;i++){
		if(stop[i]*b>T) break;
		for(int g=k;g>=0;g--){
			int ss = stop[i];
			int tt = stop[i]*b;
			for(int j=0;j<=g;j++){
				int kk = ss;
				ss = ss+((T-tt)/a)+1;
				//cout<<j<<" "<<ss<<" "<<T-tt<<" "<<((T-tt)/a)<<" "<<((T-tt)%a==0)<<"ff\n";
				dp[g] = max(dp[g-j]+min(ss-stop[i],stop[i+1]-stop[i]),dp[g]);
				tt = stop[i]*b+(ss-stop[i])*c;
				if(tt>T) break;
			}
			//cout<<i<<" "<<g<<" : "<<dp[g]<<"\n";
		}
		//cout<<"\n";
	}
	cout<<dp[k]+(((n-1)*b)<T)-1<<"\n";
	return 0;
}

Compilation message

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:27:9: warning: unused variable 'kk' [-Wunused-variable]
   27 |     int kk = ss;
      |         ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 47 ms 348 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 9 ms 348 KB Output is correct
23 Execution timed out 1064 ms 348 KB Time limit exceeded
24 Halted 0 ms 0 KB -