結果
問題 | No.670 log は定数 |
ユーザー |
![]() |
提出日時 | 2023-03-19 16:26:55 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,069 ms / 4,000 ms |
コード長 | 991 bytes |
コンパイル時間 | 1,834 ms |
コンパイル使用メモリ | 99,348 KB |
最終ジャッジ日時 | 2025-02-11 15:23:40 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
main.cpp:5:23: warning: left shift count >= width of type [-Wshift-count-overflow] 5 | uint64_t mask = (1ull << 64) - 1ull; | ~~~~~^~~~~
ソースコード
#include <iostream>#include <vector>using namespace std;uint64_t mask = (1ull << 64) - 1ull;uint64_t seed;uint64_t value() {seed ^= (seed << 13);seed ^= (seed >> 7);seed ^= (seed << 17);return seed >> 33;}int main() {int n, q;cin >> n >> q >> seed;for (int i = 0; i < 10000; i++) {value();}const int m = 1 << 18;vector<vector<uint64_t>> aa(m);vector<uint64_t> cs(m + 1, 0);for (int i = 0; i < n; i++) {uint64_t a = value();uint64_t g = a >> 13;aa[g].push_back(a);cs[g + 1]++;}for (int i = 0; i < m; i++) {cs[i + 1] += cs[i];}uint64_t ans = 0;for (int i = 0; i < q; i++) {uint64_t x = value();uint64_t g = x >> 13;uint64_t s = 0;for (auto a : aa[g]) {if (a < x) {s++;}}ans ^= (s + cs[g]) * i;}cout << ans << endl;return 0;}