結果

問題 No.670 log は定数
ユーザー sigma425sigma425
提出日時 2017-09-11 21:42:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,232 ms / 4,000 ms
コード長 1,211 bytes
コンパイル時間 1,510 ms
コンパイル使用メモリ 163,424 KB
実行使用メモリ 10,288 KB
最終ジャッジ日時 2024-04-25 06:54:18
合計ジャッジ時間 25,202 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,104 ms
10,240 KB
testcase_01 AC 1,987 ms
10,288 KB
testcase_02 AC 1,999 ms
10,112 KB
testcase_03 AC 1,984 ms
10,240 KB
testcase_04 AC 1,938 ms
10,112 KB
testcase_05 AC 2,232 ms
10,244 KB
testcase_06 AC 2,214 ms
10,240 KB
testcase_07 AC 1,965 ms
10,240 KB
testcase_08 AC 1,962 ms
10,240 KB
testcase_09 AC 1,977 ms
10,240 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[B];
int acc[B+1];

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

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

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