提交记录 22018


用户 题目 状态 得分 用时 内存 语言 代码长度
bykem 1008. 测测你的二维数点 Wrong Answer 0 3.381 s 101380 KB C++17 725 B
提交时间 评测时间
2024-07-29 19:44:03 2024-07-29 19:44:09
#include <vector>
#include <algorithm>

using namespace std;

constexpr unsigned mask(unsigned x) { return x | x >> 10; }
constexpr unsigned kN = 1e7;

unsigned d[kN];
unsigned f[mask(kN) + 1];

void add(unsigned n, unsigned x) {
  for (++x; x <= n; x += x & -x) {
    ++f[mask(x)];
  }
}
unsigned sum(unsigned x) {
  unsigned s = 0;
  for (; x; x &= x - 1) {
    s += f[mask(x)];
  }
  return s;
}
void count_2d(int n, const unsigned *x, const unsigned *y, unsigned *out) {
  for (unsigned i = 0; i < n; ++i) {
    d[i] = i;
  }
  sort(d, d + n, [x, y](int i, int j) {
    return x[i] < x[j] || x[i] == x[j] && y[i] > y[j];
  });
  for (unsigned i = 0; i < n; ++i) {
    out[d[i]] = sum(y[d[i]]);
    add(n, y[d[i]]);
  }
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #13.381 s99 MB + 4 KBWrong AnswerScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2025-07-15 15:41:25 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠