이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define pb push_back
using namespace std;
const int MAXN = 3000;
int n, m, k;
int a, b, c;
int T;
int s[MAXN+2];
int ans;
vector <int> arr;
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> n >> m >> k;
cin >> a >> b >> c;
cin >> T;
for (int i = 1; i <= m; i++)
cin >> s[i], s[i]--;
s[m+1] = n;
for (int i = 1; i <= m; i++) {
if (b * s[i] > T) break;
int now = (T - b * s[i]) / a + 1;
int t = T - b * s[i];
int cnt = 0;
ans += min(now, s[i+1] - s[i]);
while (cnt < k-m && now < s[i+1] - s[i] && t - c * now >= 0) {
int tmp = (t - c * now) / a + 1;
arr.pb(min(tmp, s[i+1] - s[i] - now));
now += tmp;
cnt++;
}
}
sort(arr.begin(), arr.end(), greater<int>());
for (int i = 0; i < k-m && i < arr.size(); i++)
ans += arr[i];
cout << ans-1 << "\n";
}
컴파일 시 표준 에러 (stderr) 메시지
semiexpress.cpp: In function 'int main()':
semiexpress.cpp:36:32: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
36 | for (int i = 0; i < k-m && i < arr.size(); i++)
| ~~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |