結果

問題 No.670 log は定数
ユーザー ゆにぽけゆにぽけ
提出日時 2024-03-05 02:27:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,328 ms / 4,000 ms
コード長 1,333 bytes
コンパイル時間 1,315 ms
コンパイル使用メモリ 127,984 KB
最終ジャッジ日時 2025-02-20 00:58:43
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <iterator>
#include <string>
#include <cctype>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <ctime>
#include <iomanip>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <random>
#include <utility>
#include <functional>
using namespace std;
using ull = unsigned long long;
ull seed;
int next() {
seed = seed ^ (seed << 13);
seed = seed ^ (seed >> 7);
seed = seed ^ (seed << 17);
return (seed >> 33);
}
void Main()
{
int N,Q;
cin >> N >> Q >> seed;
for(int i = 0;i < (int)1e4;i++)
{
next();
}
const int D = 15;
vector<vector<int>> B(1 << (31 - D));
for(int i = 0;i < N;i++)
{
int a = next();
B[a >> D].push_back(a);
}
vector<int> S((1 << (31 - D)) + 1);
for(int i = 0;i < (int)B.size();i++)
{
S[i + 1] = S[i] + B[i].size();
}
long long ans = 0;
for(int i = 0;i < Q;i++)
{
int x = next();
int cnt = S[x >> D];
for(const int &v : B[x >> D])
{
if(v < x)
{
cnt++;
}
}
ans ^= (long long) cnt * i;
}
cout << ans << "\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int tt = 1;
/* cin >> tt; */
while(tt--) Main();
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0