提交记录 18998


用户 题目 状态 得分 用时 内存 语言 代码长度
Saisyc 1008. 测测你的二维数点 Accepted 100 2.476 s 156260 KB C++11 637 B
提交时间 评测时间
2023-02-04 19:22:49 2023-02-04 19:22:54
const int N = 10000000;
int head[N];
int next[N];
int tree[N];
void count_2d(int n, const unsigned int * x, const unsigned int * y, unsigned int * out) {
	for (int i = 0; i < n; ++i) {
		head[i] = -1;
	}
	for (int i = 0; i < n; ++i) {
		next[i] = head[x[i]];
		head[x[i]] = i;
	}
	for (int i = 0; i < n; ++i) {
		for (int j = head[i]; j >= 0; j = next[j]) {
			int answer;
			answer = 0;
			for (int k = y[j]; k > 0; k = k - (k & -k)) {
				answer = answer + tree[k];
			}
			out[j] = answer;
		}
		for (int j = head[i]; j >= 0; j = next[j]) {
			for (int k = y[j] + 1; k < n; k = k + (k & -k)) {
				tree[k] = tree[k] + 1;
			}
		}
	}
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.476 s152 MB + 612 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2024-10-05 10:39:38 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用