結果
問題 | No.670 log は定数 |
ユーザー |
![]() |
提出日時 | 2018-10-09 22:44:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3,967 ms / 4,000 ms |
コード長 | 1,083 bytes |
コンパイル時間 | 1,184 ms |
コンパイル使用メモリ | 107,036 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 17:04:54 |
合計ジャッジ時間 | 43,741 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#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;}