結果

問題 No.670 log は定数
ユーザー tnakao0123
提出日時 2018-03-25 17:31:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1,919 ms / 4,000 ms
コード長 1,446 bytes
コンパイル時間 877 ms
コンパイル使用メモリ 89,120 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2024-06-25 06:05:23
合計ジャッジ時間 22,362 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:59:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   59 |   scanf("%d%d%lld", &n, &q, &seed);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

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

/* -*- coding: utf-8 -*-
*
* 670.cc: No.670 log - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_N = 200000;
const int PRE = 10000;
const int BN = 16;
const int BITS = 1 << BN;
/* typedef */
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<ui> vui;
/* global variables */
ull seed;
int acs[BITS + 1];
vui as[BITS];
/* subroutines */
inline ui next() {
seed = seed ^ (seed << 13);
seed = seed ^ (seed >> 7);
seed = seed ^ (seed << 17);
return (seed >> 33);
}
/* main */
int main() {
int n, q;
scanf("%d%d%lld", &n, &q, &seed);
for (int i = 0; i < PRE; i++) next();
for (int i = 0; i < n; i++) {
ui ai = next();
ui ab = ai >> BN;
acs[ab + 1]++;
as[ab].push_back(ai);
}
for (int ab = 0; ab < BITS; ab++) {
acs[ab + 1] += acs[ab];
sort(as[ab].begin(), as[ab].end());
}
ull sum = 0;
for (int i = 0; i < q; i++) {
ui x = next();
ui xb = x >> BN;
int cnt =
acs[xb] +
(lower_bound(as[xb].begin(), as[xb].end(), x) - as[xb].begin());
sum ^= (ull)cnt * i;
}
printf("%llu\n", sum);
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0