Submission #644630

# Submission time Handle Problem Language Result Execution time Memory
644630 2022-09-25T04:42:47 Z ymm Fortune Telling 2 (JOI14_fortune_telling2) C++17
4 / 100
3000 ms 724 KB
#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'032;
const int S = 1024;
int a[N], b[N];
int q[N];
int n;

__attribute__((optimize("O3,unroll-loops"),target("avx")))
void up(int x, int y, int z, int l, int r)
{
	Loop (i,l,r) {
		a[i] ^= a[i] <= x? b[i]: 0;
		a[i] ^= a[i] <= y? b[i]: 0;
		a[i] ^= a[i] <= z? b[i]: 0;
	}
}

int main()
{
	cin.tie(0) -> sync_with_stdio(false);
	int k;
	cin >> n >> k;
	Loop (i,0,n) {
		cin >> a[i] >> b[i];
		b[i] ^= a[i];
	}
	Loop (i,0,k)
		cin >> q[i];
	for (int l = 0; l < n; l += S) {
		int r = min(n, l+S);
		for (int i = 0; i < k; i += 3)
			up(q[i+0], q[i+1], q[i+2], l, r);
	}
	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 2 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 2 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 3 ms 340 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 2 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 3 ms 340 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 215 ms 432 KB Output is correct
15 Correct 812 ms 552 KB Output is correct
16 Correct 1799 ms 672 KB Output is correct
17 Execution timed out 3073 ms 724 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 2 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 3 ms 340 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 215 ms 432 KB Output is correct
15 Correct 812 ms 552 KB Output is correct
16 Correct 1799 ms 672 KB Output is correct
17 Execution timed out 3073 ms 724 KB Time limit exceeded
18 Halted 0 ms 0 KB -