답안 #941131

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
941131 2024-03-08T07:44:42 Z PenguinsAreCute Semiexpress (JOI17_semiexpress) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
main() {
	int n, m, k, a, b, c, t; cin >> n >> m >> k >> a >> b >> c >> t;
	int s[m]; for(int i=0;i<m;i++) cin>>s[i];
	vector<int> v;
	int ans = 0;
	for(int i=0;i<m-1;i++) {
		int cur = s[i];
		while(cur < s[i+1]) {
			int nxt = (cur * (a-c) + s[i] * (c-b) + t) / a + 1;
			if(nxt <= cur) break;
			nxt = min(nxt, s[i+1]);
			if(cur == s[i]) ans += (nxt - cur);
			else v.push_back(nxt-cur);
			cur = nxt;
		}
	}
	sort(v.begin(),v.end());
	for(int i=1;i<=min((int)(v.size()),k-m);i++) ans += end(v)[-i];
	cout << ans;
}

Compilation message

semiexpress.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main() {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -