結果

問題 No.670 log は定数
ユーザー %20
提出日時 2018-04-23 23:51:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2,125 ms / 4,000 ms
コード長 510 bytes
コンパイル時間 2,131 ms
コンパイル使用メモリ 196,120 KB
最終ジャッジ日時 2025-01-05 10:21:16
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:12:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   12 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull seed;
int next(){
	seed^=seed<<13;
	seed^=seed>>7;
	seed^=seed<<17;
	return seed>>33;
}
int a[200000],b[200000];
main(){
	int N,Q,d;
	cin>>N>>Q>>seed;
	d=(1u<<31)/N+1;
	for(int i=0;i<10000;++i){
		next();
	}
	for(int i=0;i<N;++i){
		++b[(a[i]=next())/d+1];
	}
	for(int i=0;i<N-1;++i){
		b[i+1]+=b[i];
	}
	sort(a,a+N);
	ull z=0;
	for(ull i=0;i<Q;++i){
		int x=next();
		z^=(lower_bound(a+b[x/d],a+b[x/d+1],x)-a)*i;
	}
	cout<<z;
}
0