結果

問題 No.670 log は定数
ユーザー pekempeypekempey
提出日時 2018-03-23 22:32:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,683 ms / 4,000 ms
コード長 877 bytes
コンパイル時間 711 ms
コンパイル使用メモリ 70,728 KB
実行使用メモリ 124,864 KB
最終ジャッジ日時 2023-09-07 03:07:43
合計ジャッジ時間 19,871 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,670 ms
124,796 KB
testcase_01 AC 1,669 ms
124,820 KB
testcase_02 AC 1,670 ms
124,860 KB
testcase_03 AC 1,665 ms
124,684 KB
testcase_04 AC 1,683 ms
124,812 KB
testcase_05 AC 1,675 ms
124,792 KB
testcase_06 AC 1,670 ms
124,864 KB
testcase_07 AC 1,671 ms
124,812 KB
testcase_08 AC 1,669 ms
124,808 KB
testcase_09 AC 1,680 ms
124,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const int N = 1 << 22;
vector<int> g[N + 1];

int sum[N + 1];

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();
    
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      a[i] = next();
      g[a[i] >> 9].push_back(a[i]);
    }
    for (int i = 0; i < N; i++) {
      sum[i + 1] = sum[i] + g[i].size();
    }

    ll sm = 0;
    for (int i = 0; i < q; i++) {
        int x = next();
        int cnt = sum[x >> 9];
        for (int y : g[x >> 9]) {
          if (y < x) cnt++;
        }
        sm ^= ll(cnt) * i;
    }
    cout << sm << endl;
    return 0;
}
0