提交记录 19013
提交时间 |
评测时间 |
2023-02-04 20:27:40 |
2023-02-04 20:27:41 |
#include <algorithm>
struct foo { unsigned x, y, i; bool operator<(foo& o) {return x<o.x;}} r[10000007];
unsigned z[10000007];
void count_2d(int n, const unsigned *x, const unsigned *y, unsigned *out) {
for (int i=0; i<n; ++i) r[i].x=x[i], r[i].y=y[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].x] = cnt; }
// set
{
int j=r[i].y+1;
for (; j<n; j+=j&-j) z[j]+=1;
}
}
Compilation | N/A | N/A | Compile Error | Score: N/A | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2025-09-16 06:49:56 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠