Submission #1112199

#TimeUsernameProblemLanguageResultExecution timeMemory
1112199ortsacFortune Telling 2 (JOI14_fortune_telling2)C++17
4 / 100
3056 ms2384 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<long long, long long> #define fr first #define se second const int MAXN = 1e5 + 10; int v[MAXN]; int32_t main() { int n, k; cin >> n >> k; vector<pii> c(n); for (int i = 0; i < n; i++) { cin >> c[i].fr >> c[i].se; } for (int i = 1; i <= k; i++) { cin >> v[i]; } int ans = 0; for (int i = 0; i < n; i++) { bool curr = 0; for (int j = 1; j <= k; j++) { if (!curr) { if (c[i].fr <= v[j]) { curr = 1; } } else { if (c[i].se <= v[j]) { curr = 0; } } } if (curr) ans += c[i].se; else ans += c[i].fr; } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...