結果
問題 | No.670 log は定数 |
ユーザー | mamekin |
提出日時 | 2018-03-26 09:09:25 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,842 ms / 4,000 ms |
コード長 | 1,360 bytes |
コンパイル時間 | 1,132 ms |
コンパイル使用メモリ | 109,544 KB |
実行使用メモリ | 9,732 KB |
最終ジャッジ日時 | 2023-09-07 12:36:32 |
合計ジャッジ時間 | 21,017 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,755 ms
9,536 KB |
testcase_01 | AC | 1,677 ms
9,712 KB |
testcase_02 | AC | 1,712 ms
9,608 KB |
testcase_03 | AC | 1,689 ms
9,672 KB |
testcase_04 | AC | 1,758 ms
9,568 KB |
testcase_05 | AC | 1,769 ms
9,732 KB |
testcase_06 | AC | 1,756 ms
9,660 KB |
testcase_07 | AC | 1,747 ms
9,668 KB |
testcase_08 | AC | 1,842 ms
9,588 KB |
testcase_09 | AC | 1,740 ms
9,592 KB |
ソースコード
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> using namespace std; unsigned long long seed; int next() { seed ^= seed << 13; seed ^= seed >> 7; seed ^= seed << 17; return seed >> 33; } const int MAX = INT_MAX; const int SIZE = 20000; 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(); sort(a.begin(), a.end()); vector<int> cnt(MAX / SIZE + 2, 0); vector<vector<int> > v(MAX / SIZE + 1); for(int i=0; i<n; ++i){ ++ cnt[a[i]/SIZE+1]; v[a[i]/SIZE].push_back(a[i]); } for(int i=0; i<=MAX/SIZE; ++i) cnt[i+1] += cnt[i]; long long ans = 0; for(int i=0; i<q; ++i){ int x = next(); int y = cnt[x/SIZE]; y += lower_bound(v[x/SIZE].begin(), v[x/SIZE].end(), x) - v[x/SIZE].begin(); ans ^= y * (long long)i; } cout << ans << endl; return 0; }