#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 = 400'000;
const int S = 2000;
int a[N];
int q[N];
int n;
__attribute__((optimize("O3,unroll-loops"),target("avx2")))
void up(int x, int y, int z, int l, int r)
{
typedef int ymm __attribute((vector_size(32),aligned(32)));
ymm *const b = (ymm*)a;
for (int i = l/16; i < r/16; ++i) {
auto v = b[i], u = b[i+1];
v ^= v <= x? u: 0;
v ^= v <= y? u: 0;
v ^= v <= z? u: 0;
b[i] = v;
}
}
int main()
{
cin.tie(0) -> sync_with_stdio(false);
int k;
cin >> n >> k;
Loop (i,0,n) {
int x, y;
cin >> x >> y;
y ^= x;
a[i/8*16 + i%8] = x;
a[i/8*16 + i%8 + 8] = y;
}
Loop (i,0,k)
cin >> q[i];
for (int l = 0; l < N; l += S) {
for (int i = 0; i < k; i += 3)
up(q[i+0], q[i+1], q[i+2], l, l+S);
}
ll ans = 0;
Loop (i,0,n)
ans += a[i/8*16 + i%8];
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
1108 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
1108 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
1108 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |