結果

問題 No.670 log は定数
ユーザー WarToks
提出日時 2019-07-22 21:11:04
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 1,364 ms / 4,000 ms
コード長 940 bytes
コンパイル時間 918 ms
コンパイル使用メモリ 130,072 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-11-30 14:16:51
合計ジャッジ時間 16,073 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>

using lli = long long int;
using ull = unsigned long long int;

#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)

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

constexpr int SEED_TIME = 10000;
constexpr int RANGE = 1 << 14;
constexpr int NUMBER = (__INT_MAX__ / RANGE);
std::vector<int> A[NUMBER + 2];
int S[NUMBER + 3];
int x, y, a, b, t;

int main(void){
    int n, q; scanf("%d%d%llu", &n, &q, &seed);
    REP(_, SEED_TIME) next();
    REP(i, n){
        x = next();
        a = x / RANGE;
        A[a].push_back(x);
    }
    S[0] = 0; REP(i, NUMBER + 1) S[i+1] = S[i] + A[i].size();

    lli res = 0;
    REP(i, q){
        x = next(); y = x / RANGE;
        lli cnt = S[y];
        for(int aa : A[y]) if(aa < x) cnt++;
        res ^= cnt * i;
    }
    printf("%lld\n", res);
    return 0;
}
0