結果

問題 No.670 log は定数
ユーザー imulanimulan
提出日時 2018-03-24 00:46:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,158 ms / 4,000 ms
コード長 1,303 bytes
コンパイル時間 1,795 ms
コンパイル使用メモリ 168,632 KB
実行使用メモリ 15,352 KB
最終ジャッジ日時 2023-09-07 07:48:07
合計ジャッジ時間 25,945 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,929 ms
15,244 KB
testcase_01 AC 1,916 ms
15,224 KB
testcase_02 AC 1,925 ms
15,352 KB
testcase_03 AC 2,158 ms
15,300 KB
testcase_04 AC 1,973 ms
15,212 KB
testcase_05 AC 2,067 ms
15,352 KB
testcase_06 AC 2,082 ms
15,272 KB
testcase_07 AC 2,150 ms
15,288 KB
testcase_08 AC 1,850 ms
15,240 KB
testcase_09 AC 1,864 ms
15,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using ull = unsigned long long;

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

const int B = 1<<18;
const int SZ = 1<<13;

vector<int> v[B];
int sum[B];

int main(){
    int n, q;
    cin >>n >> q >> seed;
    for (int i = 0; i < 10000; i++) next();

    vector<int> a(n);
    for (int i = 0; i < n; i++){
        a[i] = next();

        int bid = a[i]/SZ;
        v[bid].pb(a[i]);
        ++sum[bid];
    }

    rep(i,B-1) sum[i+1] += sum[i];

    ll sm = 0;
    for (int i = 0; i < q; i++) {
        int x = next();
        int bid = x/SZ;

        int cnt = 0;
        if(bid>0) cnt = sum[bid-1];
        for(int j:v[bid]) cnt += (j<x);
        sm ^= ll(cnt) * i;
    }
    cout << sm << endl;
    return 0;
}
0