Submission #506205

#TimeUsernameProblemLanguageResultExecution timeMemory
506205colossal_pepeFortune Telling 2 (JOI14_fortune_telling2)C++17
4 / 100
3076 ms1860 KiB
#include <iostream> #include <vector> using namespace std; int n, k; vector<int> a, b, t; int main() { cin >> n >> k; a.resize(n), b.resize(n); t.resize(k); for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; } for (int i = 0; i < k; i++) { cin >> t[i]; } long long ans = 0; for (int i = 0; i < n; i++) { int upside = 0; for (int j = 0; j < k; j++) { int x; if (upside % 2 == 0) x = a[i]; else x = b[i]; if (x <= t[j]) upside++; } if (upside % 2 == 0) ans += a[i]; else ans += b[i]; } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...