记录详情

Runtime 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)]
                      ~~^~~
/in/foo.cc: In function 'int main()':
/in/foo.cc:30:7: warning: unused variable 'ans' [-Wunused-variable]
   int ans = 0;
       ^~~
# 状态 耗时 内存占用
#1 Wrong Answer 8ms 20.555 MiB
#2 Wrong Answer 8ms 20.551 MiB
#3 Wrong Answer 8ms 20.551 MiB
#4 Wrong Answer 10ms 26.555 MiB
#5 Wrong Answer 8ms 20.555 MiB
#6 Wrong Answer 11ms 22.23 MiB
#7 Wrong Answer 13ms 26.57 MiB
#8 Wrong Answer 15ms 28.453 MiB
#9 Wrong Answer 16ms 30.574 MiB
#10 Wrong Answer 14ms 24.57 MiB
#11 Wrong Answer 61ms 78.582 MiB
#12 Wrong Answer 55ms 67.004 MiB
#13 Wrong Answer 57ms 72.172 MiB
#14 Wrong Answer 61ms 82.0 MiB
#15 Wrong Answer 63ms 73.234 MiB
#16 Wrong Answer 278ms 256.883 MiB
#17 Wrong Answer 298ms 291.938 MiB
#18 Runtime Error 0ms 128.0 KiB
#19 Runtime Error 0ms 128.0 KiB
#20 Runtime Error 0ms 128.0 KiB

代码

#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[N], zkw[1 << 28];
int __ffs[1 << 16];
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());
  return 0;
}

信息

递交者
类型
递交
题目
P1004 Heaptester
语言
C++
递交时间
2020-12-19 23:06:15
评测时间
2020-12-19 23:06:15
评测机
分数
0
总耗时
995ms
峰值内存
291.938 MiB