結果

問題 No.670 log は定数
ユーザー 👑 kmjpkmjp
提出日時 2018-03-26 23:34:09
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,350 ms / 4,000 ms
コード長 1,272 bytes
コンパイル時間 1,718 ms
コンパイル使用メモリ 148,092 KB
実行使用メモリ 7,524 KB
最終ジャッジ日時 2023-09-07 18:37:32
合計ジャッジ時間 17,144 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,340 ms
7,452 KB
testcase_01 AC 1,350 ms
7,524 KB
testcase_02 AC 1,301 ms
7,396 KB
testcase_03 AC 1,304 ms
7,432 KB
testcase_04 AC 1,288 ms
7,432 KB
testcase_05 AC 1,301 ms
7,464 KB
testcase_06 AC 1,307 ms
7,456 KB
testcase_07 AC 1,285 ms
7,484 KB
testcase_08 AC 1,268 ms
7,424 KB
testcase_09 AC 1,270 ms
7,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

using ull = unsigned long long;

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

int N,Q;
int A[201010];
const int D=15;
vector<int> bucket[1<<(31-D)];
int S[5+(1<<(31-D))];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>Q>>seed;
	FOR(i,10000) next();
	FOR(i,N) {
		x=next();
		bucket[x>>D].push_back(x);
		S[1+(x>>D)]++;
	}
	FOR(i,3+(1<<(31-D))) S[i+1]+=S[i];
	
	ll ret=0;
	FOR(i,Q) {
		x = next();
		int num=S[x>>D];
		FORR(v,bucket[x>>D]) if(v<x) num++;
		ret^=num*1LL*i;
	}
	
	cout<<ret<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0