Submission #743781

# Submission time Handle Problem Language Result Execution time Memory
743781 2023-05-18T01:02:16 Z LCJLY Semiexpress (JOI17_semiexpress) C++14
100 / 100
39 ms 33320 KB
#include <bits/stdc++.h> 
using namespace std;

#define int long long 
typedef pair<int,int>pii;

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m,k,a,b,c,t;
	cin >> n >> m >> k;
	cin >> a >> b >> c;
	cin >> t;

	int arr[m+5];
	for(int x=1;x<=m;x++){
		cin >> arr[x];
	}

	int counter=0;
	if((n-1)*b<=t) counter++;
	// cout << counter << " cnt\n";
	priority_queue<int>pq;
	
	for(int x=1;x<m;x++){
		int timer=b*(arr[x]-1);
		if(timer>t) continue;
		int hold=(t-timer)/a;
		int target=min(arr[x+1]-1,hold+arr[x]);
		counter+=(target-arr[x]+1);
		// cout << x << " " << target << " " << target-arr[x]+1 << " add\n";
		for(int y=0;y<k&&target<arr[x+1]-1;y++){
			int hold2=timer+(target-arr[x]+1)*c;
			if(hold2>t) break;
			int hold3=(t-hold2)/a;
			int target2=min(arr[x+1]-1,target+hold3+1);
			pq.push(target2-target);
			target=target2;
		}
	}

	for(int x=m;x<k;x++){
		if(pq.empty()) break;
		counter+=pq.top();
		pq.pop();
	}

	cout << counter-1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 320 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 320 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 3 ms 2512 KB Output is correct
22 Correct 2 ms 1480 KB Output is correct
23 Correct 10 ms 8708 KB Output is correct
24 Correct 10 ms 4596 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 31 ms 16828 KB Output is correct
28 Correct 39 ms 33320 KB Output is correct
29 Correct 8 ms 4556 KB Output is correct
30 Correct 4 ms 2512 KB Output is correct