답안 #366178

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
366178 2021-02-13T12:45:30 Z inluminas Semiexpress (JOI17_semiexpress) C++14
100 / 100
16 ms 4580 KB
#include"bits/stdc++.h"
using namespace std;
 
#define ll long long
#define fastio ios_base::sync_with_stdio(false)
#define endl "\n"
 
const ll lmt=3e4;
ll n,m,k,a,b,c,t,s[lmt],ans;
 
int main(){
	fastio;
 
	cin>>n>>m>>k>>a>>b>>c>>t;
	for(int i=1;i<=m;i++){
		cin>>s[i];
	}
	vector<ll>big;
	k-=m;
	if((n-1)*b<=t) ans++;
 
	for(int i=1;i<m;i++){
		ll last=(s[i]-1)*b;
		if(last>t) break;
		ll seat=(t-last)/a;
		ll seg=min(s[i+1]-1,s[i]+seat);
		ans+=(seg-s[i]+1);
		if(i==1) ans--;
		seg++;
		for(int j=1;j<=k && seg<s[i+1];j++){
			ll tme=last+(seg-s[i])*c;
			if(tme>t) break;
			ll seat2=(t-tme)/a;
			ll seg2=min(s[i+1]-1,seg+seat2);
			seg2++;
			big.push_back(seg2-seg);
			seg=seg2;
		}
	}
	sort(big.begin(),big.end());
	reverse(big.begin(),big.end());
	for(int i=0;i<min(k,(ll)big.size());i++){
		ans+=big[i];
	}
	cout<<ans<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 2 ms 620 KB Output is correct
23 Correct 16 ms 4580 KB Output is correct
24 Correct 1 ms 492 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 12 ms 4580 KB Output is correct
30 Correct 7 ms 2536 KB Output is correct