#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 |
1 |
Correct |
1 ms |
308 KB |
Output is correct |
2 |
Correct |
4 ms |
212 KB |
Output is correct |
3 |
Correct |
7 ms |
344 KB |
Output is correct |
4 |
Correct |
7 ms |
340 KB |
Output is correct |
5 |
Correct |
6 ms |
340 KB |
Output is correct |
6 |
Correct |
6 ms |
348 KB |
Output is correct |
7 |
Correct |
6 ms |
316 KB |
Output is correct |
8 |
Correct |
7 ms |
340 KB |
Output is correct |
9 |
Correct |
6 ms |
340 KB |
Output is correct |
10 |
Correct |
6 ms |
308 KB |
Output is correct |
11 |
Correct |
6 ms |
340 KB |
Output is correct |
12 |
Correct |
6 ms |
348 KB |
Output is correct |
13 |
Correct |
6 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
308 KB |
Output is correct |
2 |
Correct |
4 ms |
212 KB |
Output is correct |
3 |
Correct |
7 ms |
344 KB |
Output is correct |
4 |
Correct |
7 ms |
340 KB |
Output is correct |
5 |
Correct |
6 ms |
340 KB |
Output is correct |
6 |
Correct |
6 ms |
348 KB |
Output is correct |
7 |
Correct |
6 ms |
316 KB |
Output is correct |
8 |
Correct |
7 ms |
340 KB |
Output is correct |
9 |
Correct |
6 ms |
340 KB |
Output is correct |
10 |
Correct |
6 ms |
308 KB |
Output is correct |
11 |
Correct |
6 ms |
340 KB |
Output is correct |
12 |
Correct |
6 ms |
348 KB |
Output is correct |
13 |
Correct |
6 ms |
340 KB |
Output is correct |
14 |
Correct |
462 ms |
800 KB |
Output is correct |
15 |
Correct |
1734 ms |
1320 KB |
Output is correct |
16 |
Execution timed out |
3076 ms |
1744 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
308 KB |
Output is correct |
2 |
Correct |
4 ms |
212 KB |
Output is correct |
3 |
Correct |
7 ms |
344 KB |
Output is correct |
4 |
Correct |
7 ms |
340 KB |
Output is correct |
5 |
Correct |
6 ms |
340 KB |
Output is correct |
6 |
Correct |
6 ms |
348 KB |
Output is correct |
7 |
Correct |
6 ms |
316 KB |
Output is correct |
8 |
Correct |
7 ms |
340 KB |
Output is correct |
9 |
Correct |
6 ms |
340 KB |
Output is correct |
10 |
Correct |
6 ms |
308 KB |
Output is correct |
11 |
Correct |
6 ms |
340 KB |
Output is correct |
12 |
Correct |
6 ms |
348 KB |
Output is correct |
13 |
Correct |
6 ms |
340 KB |
Output is correct |
14 |
Correct |
462 ms |
800 KB |
Output is correct |
15 |
Correct |
1734 ms |
1320 KB |
Output is correct |
16 |
Execution timed out |
3076 ms |
1744 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |