結果

問題 No.670 log は定数
ユーザー ksomemoksomemo
提出日時 2018-03-23 23:40:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,088 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 76,388 KB
実行使用メモリ 13,600 KB
最終ジャッジ日時 2023-09-07 04:24:55
合計ジャッジ時間 11,206 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using ull = unsigned long long;

// https://gist.github.com/yosupo06/f8b62b4d070275d9814ecaf45519f720
//  g++-5 -W -std=c++14 0670.cpp
ull seed;
int next() {
  seed = seed ^ (seed << 13);
  seed = seed ^ (seed >> 7);
  seed = seed ^ (seed << 17);
  return (seed >> 33);
}

void TLE2(int n, int q, vector<int> a) {
  ll sm = 0;
  sort(all(a));

  for (int i = 0; i < q; i++) {
    int x = next();
    int cnt = lower_bound(all(a), x) - a.begin();
    sm ^= ll(cnt) * i;
  }
  cout << sm << endl;
}

void TLE(int n, int q, vector<int> a) {
  ll sm = 0;
  for (int i = 0; i < q; i++) {
    int x = next();
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] < x) cnt++;
    }
    sm ^= ll(cnt) * i;
  }
  cout << sm << endl;
}

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();

  TLE2(n, q, a);
  // TLE(n, q, a);
  return 0;
}
0