Submission #644656

# Submission time Handle Problem Language Result Execution time Memory
644656 2022-09-25T05:21:41 Z ymm Fortune Telling 2 (JOI14_fortune_telling2) C++17
35 / 100
3000 ms 2496 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 = 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/8; i < r/8; i += 2) {
		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
1 Correct 18 ms 1876 KB Output is correct
2 Correct 19 ms 1796 KB Output is correct
3 Correct 19 ms 1792 KB Output is correct
4 Correct 18 ms 1812 KB Output is correct
5 Correct 25 ms 1868 KB Output is correct
6 Correct 22 ms 2004 KB Output is correct
7 Correct 20 ms 1868 KB Output is correct
8 Correct 18 ms 1868 KB Output is correct
9 Correct 18 ms 1876 KB Output is correct
10 Correct 18 ms 1812 KB Output is correct
11 Correct 19 ms 1844 KB Output is correct
12 Correct 19 ms 1884 KB Output is correct
13 Correct 20 ms 1812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 1876 KB Output is correct
2 Correct 19 ms 1796 KB Output is correct
3 Correct 19 ms 1792 KB Output is correct
4 Correct 18 ms 1812 KB Output is correct
5 Correct 25 ms 1868 KB Output is correct
6 Correct 22 ms 2004 KB Output is correct
7 Correct 20 ms 1868 KB Output is correct
8 Correct 18 ms 1868 KB Output is correct
9 Correct 18 ms 1876 KB Output is correct
10 Correct 18 ms 1812 KB Output is correct
11 Correct 19 ms 1844 KB Output is correct
12 Correct 19 ms 1884 KB Output is correct
13 Correct 20 ms 1812 KB Output is correct
14 Correct 172 ms 1812 KB Output is correct
15 Correct 359 ms 1864 KB Output is correct
16 Correct 530 ms 2028 KB Output is correct
17 Correct 682 ms 1940 KB Output is correct
18 Correct 706 ms 2064 KB Output is correct
19 Correct 689 ms 2036 KB Output is correct
20 Correct 698 ms 1940 KB Output is correct
21 Correct 688 ms 2312 KB Output is correct
22 Correct 680 ms 2036 KB Output is correct
23 Correct 695 ms 1972 KB Output is correct
24 Correct 683 ms 2096 KB Output is correct
25 Correct 688 ms 2052 KB Output is correct
26 Correct 690 ms 2124 KB Output is correct
27 Correct 677 ms 1948 KB Output is correct
28 Correct 677 ms 1968 KB Output is correct
29 Correct 697 ms 1944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 1876 KB Output is correct
2 Correct 19 ms 1796 KB Output is correct
3 Correct 19 ms 1792 KB Output is correct
4 Correct 18 ms 1812 KB Output is correct
5 Correct 25 ms 1868 KB Output is correct
6 Correct 22 ms 2004 KB Output is correct
7 Correct 20 ms 1868 KB Output is correct
8 Correct 18 ms 1868 KB Output is correct
9 Correct 18 ms 1876 KB Output is correct
10 Correct 18 ms 1812 KB Output is correct
11 Correct 19 ms 1844 KB Output is correct
12 Correct 19 ms 1884 KB Output is correct
13 Correct 20 ms 1812 KB Output is correct
14 Correct 172 ms 1812 KB Output is correct
15 Correct 359 ms 1864 KB Output is correct
16 Correct 530 ms 2028 KB Output is correct
17 Correct 682 ms 1940 KB Output is correct
18 Correct 706 ms 2064 KB Output is correct
19 Correct 689 ms 2036 KB Output is correct
20 Correct 698 ms 1940 KB Output is correct
21 Correct 688 ms 2312 KB Output is correct
22 Correct 680 ms 2036 KB Output is correct
23 Correct 695 ms 1972 KB Output is correct
24 Correct 683 ms 2096 KB Output is correct
25 Correct 688 ms 2052 KB Output is correct
26 Correct 690 ms 2124 KB Output is correct
27 Correct 677 ms 1948 KB Output is correct
28 Correct 677 ms 1968 KB Output is correct
29 Correct 697 ms 1944 KB Output is correct
30 Execution timed out 3024 ms 2496 KB Time limit exceeded
31 Halted 0 ms 0 KB -