結果

問題 No.670 log は定数
ユーザー sigma425sigma425
提出日時 2017-09-11 21:52:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,155 ms / 4,000 ms
コード長 1,237 bytes
コンパイル時間 1,637 ms
コンパイル使用メモリ 168,864 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 06:55:26
合計ジャッジ時間 14,591 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,155 ms
5,248 KB
testcase_01 AC 1,113 ms
5,248 KB
testcase_02 AC 1,099 ms
5,376 KB
testcase_03 AC 1,126 ms
5,376 KB
testcase_04 AC 1,121 ms
5,376 KB
testcase_05 AC 1,115 ms
5,376 KB
testcase_06 AC 1,124 ms
5,376 KB
testcase_07 AC 1,122 ms
5,376 KB
testcase_08 AC 1,152 ms
5,376 KB
testcase_09 AC 1,134 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}

using ull = unsigned long long;
using ll = long long;

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

const int X = 17;
const int B = 1<<X;
vector<int> a;
int acc[B+1];

int main(){
	int N,Q;
	cin>>N>>Q>>seed;
	a.resize(N);
	rep(i,10000) next();

	rep(i,N){
		int x = next();
		a[i] = x;
		int b = x>>(31-X);
		acc[b+1]++;
	}
	sort(all(a));

	rep(i,B) acc[i+1] += acc[i];

	ll res = 0;
	rep(qt,Q){
		int x = next();
		int b = x>>(31-X);
		int cnt = lower_bound(a.begin()+acc[b],a.begin()+acc[b+1],x) - a.begin();
		res ^= ll(cnt)*qt;
	}
	cout<<res<<endl;
}
0