結果

問題 No.670 log は定数
ユーザー WarToksWarToks
提出日時 2019-07-22 21:11:04
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 1,187 ms / 4,000 ms
コード長 940 bytes
コンパイル時間 743 ms
コンパイル使用メモリ 94,804 KB
実行使用メモリ 10,596 KB
最終ジャッジ日時 2023-08-20 12:36:48
合計ジャッジ時間 14,125 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,145 ms
10,584 KB
testcase_01 AC 1,187 ms
10,504 KB
testcase_02 AC 1,156 ms
10,408 KB
testcase_03 AC 1,146 ms
10,396 KB
testcase_04 AC 1,144 ms
10,500 KB
testcase_05 AC 1,158 ms
10,456 KB
testcase_06 AC 1,179 ms
10,404 KB
testcase_07 AC 1,164 ms
10,472 KB
testcase_08 AC 1,152 ms
10,496 KB
testcase_09 AC 1,162 ms
10,596 KB
権限があれば一括ダウンロードができます

ソースコード

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