結果

問題 No.670 log は定数
ユーザー ryoissyryoissy
提出日時 2018-03-23 23:07:20
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,032 ms / 4,000 ms
コード長 1,249 bytes
コンパイル時間 1,443 ms
コンパイル使用メモリ 148,836 KB
実行使用メモリ 348,368 KB
最終ジャッジ日時 2023-09-07 04:10:11
合計ジャッジ時間 24,621 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,009 ms
348,204 KB
testcase_01 AC 2,002 ms
347,420 KB
testcase_02 AC 1,999 ms
347,296 KB
testcase_03 AC 2,023 ms
347,228 KB
testcase_04 AC 2,020 ms
348,360 KB
testcase_05 AC 2,010 ms
347,188 KB
testcase_06 AC 2,032 ms
347,300 KB
testcase_07 AC 2,014 ms
348,368 KB
testcase_08 AC 2,020 ms
347,124 KB
testcase_09 AC 2,019 ms
348,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;


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


int n,q;
int a[200001];
int sum[12500001];
vector<int> vi[12500001];
map<int,int> mp;

vector<int> vec;
int main(void){
	scanf("%d%d",&n,&q);
	cin >> seed;
	for(int i=0;i<10000;i++){
		next();
	}
	for(int i=0;i<n;i++){
		a[i]=next();
		sum[(a[i]/200)+1]++;
		vi[a[i]/200].push_back(a[i]);
		//vec.push_back(a[i]);
	}
	//sort(vec.begin(),vec.end());
	//vec.erase(unique(vec.begin(),vec.end()),vec.end());
	/*
	for(int i=0;i<n;i++){
		a[i]=lower_bound(vec.begin(),vec.end(),a[i])-vec.begin();
		sum[a[i]+1]++;
	}
	*/
	for(int i=0;i<(INT_MAX/200)+1;i++){
		sum[i+1]+=sum[i];
	}
	ll ans=0;
	for(int i=0;i<q;i++){
		int x=next();
		int cnt=sum[x/200];
		for(int j=0;j<vi[x/200].size();j++){
			if(vi[x/200][j]<x)cnt++;
		}
		ans^=(ll)cnt*i;
	}
	/*
	sort(vi.begin(),vi.end());
	int now=0;
	for(int i=0;i<q;i++){
		while(now<vec.size() && vec[now]<vi[i].first)now++;
		int cnt=sum[now];
		ans^=(ll)cnt*vi[i].second;
	}
	*/
	cout << ans << endl;
	return 0;
}
0