- [CQOI2006] 简单题
标题
- 2025-3-16 13:46:04 @
内容
14 条评论
-
-
#include <bits/stdc++.h> using namespace std; struct node { int x, y; }p[15010]; int c[32010], s[32010]; int n, m = 32010; int lowbit(int x) { return x & -x; } void add(int x, int y) { while(x <= m) { c[x] += y; x += lowbit(x); } } int sum(int x) { int ans = 0; while(x > 0) { ans += c[x]; x -= lowbit(x); } return ans; } int main(){ cin >> n ; for(int i = 1; i <= n; i++) cin >> p[i].x >> p[i].y ; for(int i = 1; i <= n; i++) { int u = p[i].x + 1; add(u, 1); int v = sum(u); s[v]++; } for(int i = 1; i <= n; i++) cout << s[i] << endl; return 0; }
- 1
信息
- ID
- 1344
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 4
- 标签
- (无)
- 递交数
- 39
- 已通过
- 15
- 上传者