Submission #670518

# Submission time Handle Problem Language Result Execution time Memory
670518 2022-12-09T12:25:04 Z S2speed Semiexpress (JOI17_semiexpress) C++17
100 / 100
35 ms 16860 KB
#include<bits/stdc++.h>

using namespace std;

#define all(x) x.begin() , x.end()
#define sze(x) (ll)(x.size())
typedef long long ll;

const ll maxn = 3e3 + 17;

ll s[maxn];
vector<ll> v;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	ll n , m , k , a , b , c , t;
	cin>>n>>m>>k;
	cin>>a>>b>>c;
	cin>>t;
	for(ll i = 0 ; i < m ; i++){
		cin>>s[i]; s[i]--;
	}
	k -= m;
	ll res = 0;
	for(ll i = 0 ; i < m - 1 ; i++){
		ll o = t - s[i] * b , h = o / a;
		if(o < 0) break;
		ll x = min(s[i] + h + 1 , s[i + 1]);
		res += x - s[i];
//		cout<<res<<' ';
		ll pr = s[i];
		for(ll j = 1 ; j <= k ; j++){
			o -= c * (x - pr);
			if(o < 0) break;
			h = o / a;
			ll y = min(x + h + 1 , s[i + 1]);
			v.push_back(y - x);
//			cout<<i<<' '<<j<<' '<<y - x<<'\n';
			pr = x;
			x = y;
		}
	}
	sort(all(v) , greater<ll>());
	while(sze(v) < k) v.push_back(0);
	for(ll i = 0 ; i < k ; i++){
		res += v[i];
	}
	res += ((n - 1) * b <= t);
	res--;
	cout<<res<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 320 KB Output is correct
19 Correct 3 ms 1492 KB Output is correct
20 Correct 7 ms 2508 KB Output is correct
21 Correct 1 ms 428 KB Output is correct
22 Correct 2 ms 720 KB Output is correct
23 Correct 35 ms 16860 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 10 ms 4556 KB Output is correct
30 Correct 6 ms 2512 KB Output is correct