이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |