# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
69411 | MrTEK | Semiexpress (JOI17_semiexpress) | C++14 | 3 ms | 1284 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define len(a) (int)a.size()
#define fi first
#define sc second
#define d1(w) cerr<<#w<<":"<<w<<endl;
#define d2(w,c) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<endl;
#define d3(w,c,z) cerr<<#w<<":"<<w<<" "<<#c<<":"<<c<<" "<<#z<<":"<<z<<endl;
#define left isc+isc
#define right isc+isc+1
#define mid (l+r)/2
#define FAfi_IO ios_base::sync_with_fidio(false);
#define escl '\n'
typedef long long int ll;
const int maxn = 620;
const long long LINF = 1e18;
const int LOG = 31;
const int INF = 1e9;
const int N = 3e3 + 5;
const int M = 1e4 + 5;
const int SQ = 350;
const int MOD = 998244353;
typedef long long int lli;
typedef pair<int,int> pii;
priority_queue <pair <long long,int> > Q;
int n,m,k,mx,s[N];
long long t,a,b,c,ans,rem[N];
long long calc(int ind) {
long long tut = (t - (s[ind] - 1) * b - (s[ind + 1] - s[ind] - 1 - rem[ind]) * c);
if (tut < c) return 0;
return min(rem[ind],(tut - c) / a + 1);
}
int main() {
scanf("%d %d %d %lld %lld %lld %lld",&n,&m,&k,&a,&b,&c,&t);
for (int i = 1 ; i <= m ; i++)
scanf("%d",&s[i]);
for (int i = 1 ; i < m ; i++) {
if ((s[i] - s[1]) * b > t) break;
mx = i;
}
for (int i = 1 ; i <= mx ; i++) {
rem[i] = max(0ll,(s[i + 1] - s[i] - 1) - (t - (s[i] - 1) * b) / a);
Q.push(mp(calc(i),i));
}
k -= m;
while(k--) {
long long temp = Q.top().fi;
int ind = Q.top().sc;
Q.pop();
rem[ind] -= temp;
Q.push(mp(calc(ind),ind));
}
for (int i = 1 ; i <= mx ; i++)
ans += s[i + 1] - s[i] - rem[i];
if ((s[m] - 1) * b <= t) ans++;
printf("%lld\n",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... |