Submission #644623

# Submission time Handle Problem Language Result Execution time Memory
644623 2022-09-25T04:28:21 Z ymm Fortune Telling 2 (JOI14_fortune_telling2) C++17
35 / 100
3000 ms 1996 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;
int a[N];
int n;

__attribute__((optimize("O3,unroll-loops"),target("avx2")))
void up(int x, int y, int z)
{
	typedef int ymm __attribute__((vector_size(32),aligned(32)));
	const auto b = (ymm*)a;
	for (int i = 0; i < N/8; i += 2) {
		b[i] ^= b[i] <= x? b[i+1]: 0;
		b[i] ^= b[i] <= y? b[i+1]: 0;
		b[i] ^= b[i] <= z? b[i+1]: 0;
	}
}

int main()
{
	cin.tie(0) -> sync_with_stdio(false);
	int q;
	cin >> n >> q;
	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;
	}
	int g[3] = {rand(), rand(), rand()};
	for (int i = 0; i < q; i += 3) {
		int x, y, z;
		i+0 < q? cin >> x, 0: (x = 0);
		i+1 < q? cin >> y, 0: (y = 0);
		i+2 < q? cin >> z, 0: (z = 0);
		up(x, y, z);
	}
	ll ans = 0;
	Loop (i,0,n)
		ans += a[(i/8)*16 + i%8];
	cout << ans << '\n';
}

Compilation message

fortune_telling2.cpp: In function 'int main()':
fortune_telling2.cpp:37:6: warning: unused variable 'g' [-Wunused-variable]
   37 |  int g[3] = {rand(), rand(), rand()};
      |      ^
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1876 KB Output is correct
2 Correct 24 ms 1876 KB Output is correct
3 Correct 20 ms 1888 KB Output is correct
4 Correct 24 ms 1872 KB Output is correct
5 Correct 20 ms 1892 KB Output is correct
6 Correct 20 ms 1888 KB Output is correct
7 Correct 20 ms 1876 KB Output is correct
8 Correct 21 ms 1876 KB Output is correct
9 Correct 20 ms 1876 KB Output is correct
10 Correct 21 ms 1876 KB Output is correct
11 Correct 20 ms 1876 KB Output is correct
12 Correct 19 ms 1876 KB Output is correct
13 Correct 19 ms 1888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1876 KB Output is correct
2 Correct 24 ms 1876 KB Output is correct
3 Correct 20 ms 1888 KB Output is correct
4 Correct 24 ms 1872 KB Output is correct
5 Correct 20 ms 1892 KB Output is correct
6 Correct 20 ms 1888 KB Output is correct
7 Correct 20 ms 1876 KB Output is correct
8 Correct 21 ms 1876 KB Output is correct
9 Correct 20 ms 1876 KB Output is correct
10 Correct 21 ms 1876 KB Output is correct
11 Correct 20 ms 1876 KB Output is correct
12 Correct 19 ms 1876 KB Output is correct
13 Correct 19 ms 1888 KB Output is correct
14 Correct 192 ms 1876 KB Output is correct
15 Correct 368 ms 1876 KB Output is correct
16 Correct 556 ms 1876 KB Output is correct
17 Correct 786 ms 1876 KB Output is correct
18 Correct 741 ms 1876 KB Output is correct
19 Correct 778 ms 1876 KB Output is correct
20 Correct 736 ms 1876 KB Output is correct
21 Correct 741 ms 1876 KB Output is correct
22 Correct 757 ms 1876 KB Output is correct
23 Correct 796 ms 1872 KB Output is correct
24 Correct 749 ms 1876 KB Output is correct
25 Correct 781 ms 1864 KB Output is correct
26 Correct 773 ms 1996 KB Output is correct
27 Correct 753 ms 1872 KB Output is correct
28 Correct 737 ms 1872 KB Output is correct
29 Correct 738 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1876 KB Output is correct
2 Correct 24 ms 1876 KB Output is correct
3 Correct 20 ms 1888 KB Output is correct
4 Correct 24 ms 1872 KB Output is correct
5 Correct 20 ms 1892 KB Output is correct
6 Correct 20 ms 1888 KB Output is correct
7 Correct 20 ms 1876 KB Output is correct
8 Correct 21 ms 1876 KB Output is correct
9 Correct 20 ms 1876 KB Output is correct
10 Correct 21 ms 1876 KB Output is correct
11 Correct 20 ms 1876 KB Output is correct
12 Correct 19 ms 1876 KB Output is correct
13 Correct 19 ms 1888 KB Output is correct
14 Correct 192 ms 1876 KB Output is correct
15 Correct 368 ms 1876 KB Output is correct
16 Correct 556 ms 1876 KB Output is correct
17 Correct 786 ms 1876 KB Output is correct
18 Correct 741 ms 1876 KB Output is correct
19 Correct 778 ms 1876 KB Output is correct
20 Correct 736 ms 1876 KB Output is correct
21 Correct 741 ms 1876 KB Output is correct
22 Correct 757 ms 1876 KB Output is correct
23 Correct 796 ms 1872 KB Output is correct
24 Correct 749 ms 1876 KB Output is correct
25 Correct 781 ms 1864 KB Output is correct
26 Correct 773 ms 1996 KB Output is correct
27 Correct 753 ms 1872 KB Output is correct
28 Correct 737 ms 1872 KB Output is correct
29 Correct 738 ms 1876 KB Output is correct
30 Execution timed out 3097 ms 1876 KB Time limit exceeded
31 Halted 0 ms 0 KB -