結果

問題 No.670 log は定数
ユーザー ゆにぽけゆにぽけ
提出日時 2024-03-05 02:27:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,306 ms / 4,000 ms
コード長 1,333 bytes
コンパイル時間 5,664 ms
コンパイル使用メモリ 131,384 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-03-05 02:27:50
合計ジャッジ時間 16,950 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,271 ms
7,424 KB
testcase_01 AC 1,280 ms
7,424 KB
testcase_02 AC 1,294 ms
7,424 KB
testcase_03 AC 1,269 ms
7,424 KB
testcase_04 AC 1,273 ms
7,424 KB
testcase_05 AC 1,294 ms
7,424 KB
testcase_06 AC 1,294 ms
7,424 KB
testcase_07 AC 1,280 ms
7,424 KB
testcase_08 AC 1,306 ms
7,424 KB
testcase_09 AC 1,272 ms
7,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <iterator>
#include <string>
#include <cctype>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <ctime>
#include <iomanip>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <random>
#include <utility>
#include <functional>
using namespace std;
using ull = unsigned long long;

ull seed;
int next() {
    seed = seed ^ (seed << 13);
    seed = seed ^ (seed >> 7);
    seed = seed ^ (seed << 17);
    return (seed >> 33);
}
void Main()
{
	int N,Q;
	cin >> N >> Q >> seed;
	for(int i = 0;i < (int)1e4;i++)
	{
		next();
	}
	const int D = 15;
	vector<vector<int>> B(1 << (31 - D));
	for(int i = 0;i < N;i++)
	{
		int a = next();
		B[a >> D].push_back(a);
	}
	vector<int> S((1 << (31 - D)) + 1);
	for(int i = 0;i < (int)B.size();i++)
	{
		S[i + 1] = S[i] + B[i].size();
	}
	long long ans = 0;
	for(int i = 0;i < Q;i++)
	{
		int x = next();
		int cnt = S[x >> D];
		for(const int &v : B[x >> D])
		{
			if(v < x)
			{
				cnt++;
			}
		}
		ans ^= (long long) cnt * i;
	}
	cout << ans << "\n";
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int tt = 1;
	/* cin >> tt; */
	while(tt--) Main();
}
0