Submission #941131

#TimeUsernameProblemLanguageResultExecution timeMemory
941131PenguinsAreCuteSemiexpress (JOI17_semiexpress)C++17
0 / 100
0 ms348 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]; 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 (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...