Submission #1256425

#TimeUsernameProblemLanguageResultExecution timeMemory
1256425minggaSemiexpress (JOI17_semiexpress)C++20
18 / 100
0 ms328 KiB
// Author: caption_mingle #include "bits/stdc++.h" using namespace std; #define ln "\n" #define pb push_back #define fi first #define se second #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) #define int long long const int mod = 1e9 + 7; const int inf = 2e9; const int N = 3005; int n, m, k, A, B, C, t, a[N]; signed main() { cin.tie(0) -> sync_with_stdio(0); #define task "" if(fopen(task ".INP", "r")) { freopen(task ".INP", "r", stdin); freopen(task ".OUT", "w", stdout); } cin >> n >> m >> k >> A >> B >> C >> t; for(int i = 1; i <= m; i++) { cin >> a[i]; } k -= m; int ans = 0; vector<int> cand; for(int i = 1; i <= m; i++) { int cur = a[i]; if(B * (cur - 1) > t) break; int time_left = t - B * (cur - 1); int mxA = time_left / A; ans++; if(i == m) break; ans += min(mxA, a[i + 1] - a[i] - 1); cur += min(mxA, a[i + 1] - a[i] - 1); // cerr << "STATION " << i << ' ' << time_left << ' ' << a[i] << ' ' << mxA << ' ' << ln; for(int j = 1; j <= k; j++) { int pos = cur + 1; if(pos >= a[i + 1]) break; if(time_left < C * (pos - a[i])) break; int time_left2 = time_left - C * (pos - a[i]); int val = time_left2 / A + 1; // cerr << pos << ' ' << time_left2 << ' ' << val << ln; cur += val; cand.pb(val); } } sort(all(cand), greater<int>()); for(int i = 0; i < min(k, sz(cand)); i++) ans += cand[i]; cout << ans - 1 << ln; cerr << "\nTime: " << clock() * 1000 / CLOCKS_PER_SEC; }

Compilation message (stderr)

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:22:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |                 freopen(task ".INP", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:23:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |                 freopen(task ".OUT", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...