提交记录 19079
提交时间 |
评测时间 |
2023-02-06 04:55:59 |
2023-02-06 04:56:01 |
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#include <cstring>
#include <algorithm>
struct E { int x, id; };
static bool cmp_e(const E &a, const E &b) {
return a.x < b.x;
}
void count_3d(int n, const unsigned *x, const unsigned *y, const unsigned *z, unsigned *out) {
const unsigned *x_in[3] = {x, y, z};
E *e = new E[n];
for (int i = 0; i < n; i++) {
e[i].x = x_in[0][i];
e[i].id = i;
}
std::sort(e, e + n, cmp_e);
unsigned *xx[3];
for (int i = 1; i < 3; i++) {
xx[i] = new unsigned[n];
for (int j = 0; j < n; j++) {
xx[i][j] = x_in[i][e[j].id];
}
}
int *max_j = new int[n];
int tmp_j = 0;
for (int i = 0; i < n; i++) {
while (e[tmp_j].x < e[i].x) tmp_j++;
max_j[i] = tmp_j;
}
unsigned *tmp_out = new unsigned[n];
memset(tmp_out, 0, n * sizeof(unsigned));
const int bi = 1024, bj = 1024;
for (int ii = 0; ii < n; ii += bi) {
int is = ii, ie = std::min(ii + bi, n);
for (int jj = 0; jj < n; jj += bj) {
int js = jj, je = std::min(jj + bj, n);
for (int i = is; i < ie; i++) {
int jee = std::min(je, max_j[i]);
int oi = tmp_out[i];
#pragma GCC unroll(8)
for (int j = js; j < jee; j++) {
oi += xx[1][i] > xx[1][j] & xx[2][i] > xx[2][j];
}
tmp_out[i] = oi;
}
}
}
for (int i = 0; i < n; i++) {
out[e[i].id] = tmp_out[i];
}
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 575.312 ms | 2 MB + 704 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:27:38 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠