제출 #644623

#제출 시각아이디문제언어결과실행 시간메모리
644623ymm운세 보기 2 (JOI14_fortune_telling2)C++17
35 / 100
3097 ms1996 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 = 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';
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...