# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
119122 | HungAnhGoldIBO2020 | Semiexpress (JOI17_semiexpress) | C++14 | 3 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<queue>
#define int long long
using namespace std;
const int N=3005;
int ar[N],numm[N];
priority_queue<pair<pair<int,int>,int> > ohyeah;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,i,j,k,l,m,num,a,b,c,t,ans=0;
cin>>n>>m>>num>>a>>b>>c>>t;
for(i=1;i<=m;i++){
cin>>ar[i];
}
ar[m+1]=n+1;
for(i=1;i<=m;i++){
if(b*(ar[i]-1)>t){
break;
}
ans+=min((t-b*(ar[i]-1))/a+1,ar[i+1]-ar[i]);
if(t>=b*(ar[i]-1)+c*((t-b*(ar[i]-1))/a+1)&&i<m){
ohyeah.push({{min((t-b*(ar[i]-1)-c*((t-b*(ar[i]-1))/a+1))/a+1,max(ar[i+1]-(ar[i]+(t-b*(ar[i]-1))/a+1),0ll)),min(ar[i+1],ar[i]+(t-b*(ar[i]-1))/a+1+(t-b*(ar[i]-1)-c*((t-b*(ar[i]-1))/a+1))/a+1)},i});
//cout<<min((t-b*(ar[i]-1)-c*((t-b*(ar[i]-1))/a+1))/a+1,max(ar[i+1]-(ar[i]+(t-b*(ar[i]-1))/a+1),0ll))<<" "<<min(ar[i+1],ar[i]+(t-b*(ar[i]-1))/a+1+(t-b*(ar[i]-1)-c*((t-b*(ar[i]-1))/a+1))/a+1)<<" cac"<<endl;
}
}
//cout<<ans<<endl;
for(i=1;i<=num-m;i++){
if(ohyeah.size()){
ans+=ohyeah.top().first.first;
j=ohyeah.top().first.second;
k=ohyeah.top().second;
l=ohyeah.top().first.first;
ohyeah.pop();
if(t>=b*(ar[k]-1)+c*(j-ar[k])){
ohyeah.push({{min((t-b*(ar[k]-1)-c*(j-ar[k]))/a+1,ar[k+1]-j),min(ar[k+1],j+(t-b*(ar[k]-1)-c*(j-ar[k]))/a+1)},k});
//if(i<=10){
// cout<<min((t-b*(ar[k]-1)+c*(j-ar[k]))/a+1,ar[k+1]-j)<<" "<<min(ar[k+1],j+(t-b*(ar[k]-1)+c*(j-ar[k]))/a+1)<<endl;
//}
}
}
else{
break;
}
}
cout<<ans-1;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |