#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
const int N = 200'010;
int a[N], b[N];
int n;
__attribute__((optimize("O3,unroll-loops"),target("avx")))
void up(int x)
{
Loop (i,0,n)
a[i] ^= a[i] <= x? b[i]: 0;
}
int main()
{
cin.tie(0) -> sync_with_stdio(false);
int q;
cin >> n >> q;
Loop (i,0,n) {
cin >> a[i] >> b[i];
b[i] ^= a[i];
}
while (q--) {
int t;
cin >> t;
up(t);
}
ll ans = 0;
Loop (i,0,n)
ans += a[i];
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
392 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
392 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
18 ms |
580 KB |
Output is correct |
15 |
Correct |
63 ms |
980 KB |
Output is correct |
16 |
Correct |
148 ms |
1420 KB |
Output is correct |
17 |
Correct |
238 ms |
1792 KB |
Output is correct |
18 |
Correct |
245 ms |
1740 KB |
Output is correct |
19 |
Correct |
240 ms |
1724 KB |
Output is correct |
20 |
Correct |
240 ms |
1788 KB |
Output is correct |
21 |
Correct |
249 ms |
1760 KB |
Output is correct |
22 |
Correct |
239 ms |
1264 KB |
Output is correct |
23 |
Correct |
245 ms |
1316 KB |
Output is correct |
24 |
Correct |
238 ms |
1236 KB |
Output is correct |
25 |
Correct |
234 ms |
1268 KB |
Output is correct |
26 |
Correct |
219 ms |
1612 KB |
Output is correct |
27 |
Correct |
236 ms |
1760 KB |
Output is correct |
28 |
Correct |
239 ms |
1740 KB |
Output is correct |
29 |
Correct |
253 ms |
1764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
392 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
18 ms |
580 KB |
Output is correct |
15 |
Correct |
63 ms |
980 KB |
Output is correct |
16 |
Correct |
148 ms |
1420 KB |
Output is correct |
17 |
Correct |
238 ms |
1792 KB |
Output is correct |
18 |
Correct |
245 ms |
1740 KB |
Output is correct |
19 |
Correct |
240 ms |
1724 KB |
Output is correct |
20 |
Correct |
240 ms |
1788 KB |
Output is correct |
21 |
Correct |
249 ms |
1760 KB |
Output is correct |
22 |
Correct |
239 ms |
1264 KB |
Output is correct |
23 |
Correct |
245 ms |
1316 KB |
Output is correct |
24 |
Correct |
238 ms |
1236 KB |
Output is correct |
25 |
Correct |
234 ms |
1268 KB |
Output is correct |
26 |
Correct |
219 ms |
1612 KB |
Output is correct |
27 |
Correct |
236 ms |
1760 KB |
Output is correct |
28 |
Correct |
239 ms |
1740 KB |
Output is correct |
29 |
Correct |
253 ms |
1764 KB |
Output is correct |
30 |
Correct |
309 ms |
2440 KB |
Output is correct |
31 |
Correct |
1472 ms |
3612 KB |
Output is correct |
32 |
Execution timed out |
3053 ms |
5076 KB |
Time limit exceeded |
33 |
Halted |
0 ms |
0 KB |
- |