# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
172473 | mhy908 | Semiexpress (JOI17_semiexpress) | C++14 | 25 ms | 4764 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const LL llinf=9000000000000000000;
const int inf=2000000000;
int m, k;
LL n, a, b, c, t;
LL arr[3010], ans;
vector<LL> vc;
int main()
{
scanf("%lld %d %d", &n, &m, &k);
scanf("%lld %lld %lld %lld", &a, &b, &c, &t);
k-=m;
for(int i=1; i<=m; i++){
scanf("%lld", &arr[i]);
}
arr[m+1]=n+1;
for(int i=1; i<=m; i++){
LL now=arr[i];
for(int j=0; j<=k&&now<arr[i+1]; j++){
if(t<b*(arr[i]-1)+c*(now-arr[i]))break;
LL nex=(t-b*(arr[i]-1)-c*(now-arr[i]))/a+now;
if(j==0){
if(nex<arr[i+1])ans+=nex-now+1, now=nex+1;
else{
ans+=arr[i+1]-now;
break;
}
}
else{
if(nex<arr[i+1])vc.pb(nex-now+1), now=nex+1;
else{
vc.pb(arr[i+1]-now);
break;
}
}
}
}
sort(all(vc), greater<LL>());
for(int i=0; i<vc.size()&&i<k; i++)ans+=vc[i];
printf("%lld", 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... |