結果

問題 No.670 log は定数
ユーザー chocoruskchocorusk
提出日時 2018-10-09 22:44:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,083 bytes
コンパイル時間 1,178 ms
コンパイル使用メモリ 107,604 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 19:19:32
合計ジャッジ時間 44,620 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 3,733 ms
5,376 KB
testcase_02 AC 3,826 ms
5,376 KB
testcase_03 AC 3,609 ms
5,376 KB
testcase_04 AC 3,975 ms
5,376 KB
testcase_05 AC 3,609 ms
5,376 KB
testcase_06 AC 3,895 ms
5,376 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 3,682 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef unsigned long long ull;

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

int main()
{
	int n, q;
	cin>>n>>q>>seed;
	for (int i = 0; i < 10000; i++) next();
    int a[200000];
    for (int i = 0; i < n; i++) a[i] = next();
	sort(a, a+n);
	ll sm=0;
	ll mx=1ll<<31;
  int d=1000;
	for(int i=0; i<q; i++){
		int x=next();
		int i0=(ll)x*(ll)n/mx, i1=max(i0-d, 0), i2=min(i0+d, n-1);
      if(x<a[i1]){
        sm^=((ll)(lower_bound(a, a+i1, x)-a)*i);
      }else if(x>=a[i2]){
        sm^=((ll)(lower_bound(a+i2, a+n, x)-a)*i);
      }else{
        sm^=((ll)(lower_bound(a+i1, a+i2, x)-a)*i);
      }
	}
	cout<<sm<<endl;
	return 0;
}
0