結果

問題 No.670 log は定数
ユーザー chocoruskchocorusk
提出日時 2018-11-04 03:34:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,178 ms / 4,000 ms
コード長 1,012 bytes
コンパイル時間 1,266 ms
コンパイル使用メモリ 97,376 KB
実行使用メモリ 14,976 KB
最終ジャッジ日時 2024-04-30 21:38:58
合計ジャッジ時間 14,875 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,178 ms
14,848 KB
testcase_01 AC 1,102 ms
14,848 KB
testcase_02 AC 1,150 ms
14,848 KB
testcase_03 AC 1,101 ms
14,976 KB
testcase_04 AC 1,115 ms
14,848 KB
testcase_05 AC 1,109 ms
14,976 KB
testcase_06 AC 1,106 ms
14,848 KB
testcase_07 AC 1,115 ms
14,848 KB
testcase_08 AC 1,129 ms
14,848 KB
testcase_09 AC 1,168 ms
14,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef unsigned long long ull;

ull seed;
int next() {
    seed = seed ^ (seed << 13);
    seed = seed ^ (seed >> 7);
    seed = seed ^ (seed << 17);
    return (seed >> 33);
}

int main()
{
	int n, q;
	cin>>n>>q>>seed;
	for (int i = 0; i < 10000; i++) next();
	vector<int> v[1<<18];
    for (int i = 0; i < n; i++){
		int a = next();
		v[a/(1<<13)].push_back(a);
	}
	int s[1<<18];
	s[0]=v[0].size();
	for(int i=1; i<(1<<18); i++){
		s[i]=s[i-1]+v[i].size();
	}
	ll sm=0;
	for(ll i=0; i<q; i++){
		int x=next();
		ll ans=s[x/(1<<13)];
		for(int j=0; j<v[x/(1<<13)].size(); j++){
			if(v[x/(1<<13)][j]>=x) ans--;
		}
		sm^=(ans*i);
	}
	cout<<sm<<endl;
	return 0;
}
0