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 <bits/stdc++.h>
using namespace std;
using ll = long long int;
//stress test brute force
int main() {
ll n, k, ans = 0, idx = 0; cin >> n >> k;
ll card[2][n], oper[k];
for (int i = 0; i < n; i++) cin >> card[0][i] >> card[1][i];
for (int i = 0; i < k; i++) cin >> oper[i];
for (int i = 0; i < n; i++, idx = 0) {
for (int j = 0; j < k; j++) {
idx ^= (card[idx][i] <= oper[j]);
}
ans += card[idx][i];
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |