# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
169506 | combi1k1 | Semiexpress (JOI17_semiexpress) | C++14 | 277 ms | 33348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define pb emplace_back
#define ll long long
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, m, k; cin >> n >> m >> k;
ll A, B, C; cin >> A >> B >> C;
ll T; cin >> T;
vector<int> s(m);
vector<ll> pot;
for(int i = 0 ; i < m ; ++i) cin >> s[i]; s.pb(n + 1);
for(int i = 0 ; i < m ; ++i) {
ll rem = T - B * (s[i] - 1);
int rig = s[i];
if (rem < 0) {
pot.pb(n);
continue;
}
int Q = 1;
for(int j = 0 ; j < k ; ++j) {
ll nxt = rig + rem / A + 1;
if (nxt > s[i + 1])
nxt = s[i + 1];
ll len = nxt - rig;
pot.pb(len + Q * n); Q = 0;
rig += len;
rem -= len * C;
if (rem < 0) break;
if (rig == s[i + 1]) break;
}
}
sort(pot.begin(),pot.end(),greater<ll>());
if (k > sz(pot))
k = sz(pot);
cout << accumulate(pot.begin(),pot.begin() + k,0ll) - 1ll * m * n - 1 << endl;
}
/*
300 8 16
345678901 123456789 234567890
12345678901
1
10
77
82
137
210
297
300
*/
컴파일 시 표준 에러 (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... |