This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |