Submission #941148

#TimeUsernameProblemLanguageResultExecution timeMemory
941148PenguinsAreCuteSemiexpress (JOI17_semiexpress)C++17
48 / 100
261 ms262144 KiB
#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+1]; for(int i=0;i<m;i++) {cin>>s[i]; s[i]--;} s[m] = s[m-1] + 1; vector<int> v; int ans = -1; for(int i=0;i<m;i++) { int cur = s[i]; while(cur < s[i+1]) { int nxt = (cur * (a-c) + s[i] * (c-b) + t) / a + 1; // (7 * 5 + 5 * 2 + 25)/10 // 7 * 5 + 5 * 2 = 45 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 (stderr)

semiexpress.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...