結果

問題 No.670 log は定数
ユーザー firiexpfiriexp
提出日時 2020-04-11 23:52:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,785 ms / 4,000 ms
コード長 1,131 bytes
コンパイル時間 1,184 ms
コンパイル使用メモリ 112,928 KB
実行使用メモリ 37,584 KB
最終ジャッジ日時 2023-10-19 21:19:57
合計ジャッジ時間 20,484 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,728 ms
37,584 KB
testcase_01 AC 1,674 ms
37,584 KB
testcase_02 AC 1,630 ms
37,584 KB
testcase_03 AC 1,749 ms
37,584 KB
testcase_04 AC 1,655 ms
37,584 KB
testcase_05 AC 1,653 ms
37,584 KB
testcase_06 AC 1,623 ms
37,584 KB
testcase_07 AC 1,686 ms
37,584 KB
testcase_08 AC 1,648 ms
37,584 KB
testcase_09 AC 1,785 ms
37,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

u64 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();
    vector<vector<int>> v(1 << 20);
    for (int i = 0; i < n; i++) {
        int x = next();
        v[x >> 11].emplace_back(x);
    }
    vector<int> s(1 << 20);
    for (int i = 0; i+1 < s.size(); ++i) {
        s[i+1] = s[i]+v[i].size();
    }
    ll sm = 0;
    for (int i = 0; i < q; i++) {
        int x = next();
        int cnt = s[x >> 11];
        for (auto &&j : v[x >> 11]) {
            if(j < x) cnt++;
        }
        sm ^= ll(cnt) * i;
    }
    cout << sm << endl;
    return 0;
}
0