提交记录 19020


用户 题目 状态 得分 用时 内存 语言 代码长度
user1 1008. 测测你的二维数点 Accepted 100 4.202 s 117196 KB C++ 600 B
提交时间 评测时间
2023-02-04 21:00:14 2023-02-04 21:00:21
#include <algorithm>
#include <stdlib.h>
const unsigned *globalX, *globalY;
struct foo { unsigned i; unsigned x(){return globalX[i]; }unsigned y(){return globalY[i]; }bool operator<(foo& o) {return x()!=o.x()?x()<o.x():y()>o.y();}} r[10000007];
unsigned z[10000007];
void count_2d(int n, const unsigned *x, const unsigned *y, unsigned *out) {
globalX=x, globalY=y;
for (int i=0; i<n; ++i) r[i].i=i;
std::sort(r, r+n);
for (int i=0; i<n; ++i) {
// get
{
int j=r[i].y();
int cnt = 0;
if(j) for (; cnt+=z[j], j&=j-1; );
out[r[i].i] = cnt; }
// set
{
int j=r[i].y()+1;
for (; j<n; j+=j&-j) z[j]+=1;
}
}
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #14.202 s114 MB + 460 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2025-09-16 06:50:26 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠