Submission #644588

#TimeUsernameProblemLanguageResultExecution timeMemory
644588ymmFortune Telling 2 (JOI14_fortune_telling2)C++17
35 / 100
3068 ms2252 KiB
#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("avx2")))
void up(int x, int y)
{
	Loop (i,0,n) {
		a[i] ^= a[i] <= x? b[i]: 0;
		a[i] ^= a[i] <= y? 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];
	}
	for (int i = 0; i < q; i += 2) {
		int x, y;
		cin >> x;
		i+1 < q? cin >> y, 0: (y = 0);
		up(x, y);
	}
	ll ans = 0;
	Loop (i,0,n)
		ans += a[i];
	cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...