记录详情

Compile Error

/in/foo.cc: In function 'void pop()':
/in/foo.cc:22:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     int tmpmx = zkw[(M + x >> ((x & 0xffff) ? __ffs[(x & 0xffff)]
                      ~~^~~
/tmp/ccaHqV6n.o: In function `rnd()':
foo.cc:(.text+0x2): relocation truncated to fit: R_X86_64_PC32 against symbol `seed' defined in .bss section in /tmp/ccaHqV6n.o
foo.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `seed' defined in .bss section in /tmp/ccaHqV6n.o
/tmp/ccaHqV6n.o: In function `main':
foo.cc:(.text.startup+0x7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccaHqV6n.o
foo.cc:(.text.startup+0x24): relocation truncated to fit: R_X86_64_PC32 against symbol `seed' defined in .bss section in /tmp/ccaHqV6n.o
foo.cc:(.text.startup+0x7c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccaHqV6n.o
foo.cc:(.text.startup+0xaa): relocation truncated to fit: R_X86_64_PC32 against symbol `seed' defined in .bss section in /tmp/ccaHqV6n.o
foo.cc:(.text.startup+0x362): relocation truncated to fit: R_X86_64_PC32 against symbol `seed' defined in .bss section in /tmp/ccaHqV6n.o
/tmp/ccaHqV6n.o: In function `_GLOBAL__sub_I_seed':
foo.cc:(.text.startup+0x3f3): relocation truncated to fit: R_X86_64_PC32 against `.bss'
foo.cc:(.text.startup+0x411): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: error: ld returned 1 exit status

代码

#include <bits/stdc++.h>
using namespace std;
int seed, n;
int rnd() { return seed = (seed * 19260817ll + 20230853) & INT_MAX; }
const int N = 1e8 + 9, M = 1 << 27;
int a[1<<28], zkw[1 << 28];
int __ffs[1 << 19];
int tot, mx;
inline void push(int x) {
  a[++tot] = x;
  zkw[M + tot] = tot;
  for (int pos = M + tot; pos & 1; pos >>= 1)
    zkw[pos >> 1] = a[zkw[pos]] < a[zkw[pos ^ 1]] ? zkw[pos] : zkw[pos ^ 1];
  if (a[mx] > x) mx = tot;
}
inline int top() { return a[mx]; }
inline void pop() {
  a[mx] = INT_MAX;
  for (int pos = M + mx; zkw[pos >> 1]; pos >>= 1)
    zkw[pos >> 1] = a[zkw[pos]] < a[zkw[pos ^ 1]] ? zkw[pos] : zkw[pos ^ 1];
  for (int x = tot + 1; x; x &= x - 1) {
    int tmpmx = zkw[(M + x >> ((x & 0xffff) ? __ffs[(x & 0xffff)]
                                            : __ffs[x >> 16] + 16)) -
                    1];
    if (a[mx] > a[tmpmx]) mx = tmpmx;
  }
}
int main() {
  cin >> n >> seed;
  int ans = 0;
  a[0] = INT_MAX;
  for (int i = 1; i < (1 << 16); ++i)
    __ffs[i] = (i & 1) ? 0 : (__ffs[i >> 1] + 1);
  for (int i = 1; i <= (n >> 1); ++i) push(rnd());

  for (int i = 1; i <= (n >> 1); ++i) {
    switch (rnd() % 3) {
      case 0:
        push(rnd());
        break;
      case 1:
        pop();
        break;
      default:
        ans ^= top();
    }
  }
  cout << ans << endl;
  return 0;
}

信息

递交者
类型
递交
题目
P1004 Heaptester
语言
C++
递交时间
2020-12-19 23:07:18
评测时间
2020-12-19 23:07:28
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes