結果

問題 No.670 log は定数
ユーザー %20%20
提出日時 2018-04-23 23:51:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,623 ms / 4,000 ms
コード長 510 bytes
コンパイル時間 2,179 ms
コンパイル使用メモリ 202,184 KB
実行使用メモリ 5,064 KB
最終ジャッジ日時 2023-09-09 21:40:16
合計ジャッジ時間 20,833 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,620 ms
4,868 KB
testcase_01 AC 1,611 ms
4,884 KB
testcase_02 AC 1,617 ms
4,892 KB
testcase_03 AC 1,613 ms
4,884 KB
testcase_04 AC 1,613 ms
4,924 KB
testcase_05 AC 1,623 ms
4,884 KB
testcase_06 AC 1,606 ms
4,868 KB
testcase_07 AC 1,609 ms
5,064 KB
testcase_08 AC 1,611 ms
4,988 KB
testcase_09 AC 1,601 ms
4,980 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:12:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-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