提交记录 22026


用户 题目 状态 得分 用时 内存 语言 代码长度
bykem 1008. 测测你的二维数点 Accepted 100 3.34 s 549316 KB C++17 737 B
提交时间 评测时间
2024-07-29 19:58:07 2024-07-29 19:58:13
#include <vector>
#include <algorithm>

using namespace std;

constexpr int mask(int x) { return x + (x >> 10); }
constexpr int kN = 1e7;

int c[kN];
vector<int> p[kN];
int f[mask(kN) + 1];

void count_2d(int n, const unsigned *x, const unsigned *y, unsigned *out) {
  for (int i = 0; i < n; ++i) {
    ++c[x[i]];
  }
  for (int i = 0; i < n; ++i) {
    p[i].reserve(c[i]);
  }
  for (int i = 0; i < n; ++i) {
    p[x[i]].push_back(i);
  }
  for (int i = 0; i < n; ++i) {
    for (int j : p[i]) {
      unsigned s = 0;
      for (int x = y[j]; x; x &= x - 1) {
        s += f[mask(x)];
      }
      out[j] = s;
    }
    for (int j : p[i]) {
      for (int x = y[j] + 1; x <= n; x += x & -x) {
        ++f[mask(x)];
      }
    }
  }
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #13.34 s536 MB + 452 KBAcceptedScore: 100


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