http://poj.org/problem?id=2352

 #include <cstdio>
#include <cstring>
#define maxn 400000
using namespace std; int c[maxn],leve[maxn],a,b,n; int lowbit(int x)
{
return x&(x^(x-));
} void add(int x,int m)
{
while(x<=maxn)
{
c[x]+=m;
x+=lowbit(x);
}
} int sum(int x)
{
int sum1=;
while(x>)
{
sum1+=c[x];
x-=lowbit(x);
}
return sum1;
}
int main()
{
scanf("%d",&n);
memset(c,,sizeof(c));
for(int k=; k<=n; k++)
{
scanf("%d%d",&a,&b);
a++;
int t=sum(a);
leve[t]++;
add(a,);
}
for(int i=; i<n; i++)
{
printf("%d\n",leve[i]);
}
return ;
}

poj2352 Stars的更多相关文章

  1. POJ-2352 Stars 树状数组

    Stars Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 39186 Accepted: 17027 Description A ...

  2. poj2352 Stars【树状数组】

    Astronomers often examine star maps where stars are represented by points on a plane and each star h ...

  3. POJ2352 Stars 树状数组

    emm,ssy说可以直接CDQ分治...%%%但是注意到y是有序的,所以可以直接求一下前缀和就行了. 题干: Astronomers often examine star maps where sta ...

  4. POJ2352 Stars [树状数组模板]

    题意:输入一n颗星星的x,y坐标,给定判断level的标准,即某颗星星左下边(不高于它,不超过他,相当于以他为基准的第三象限)星星的数目为level, 输出level从0到n的星星个数. //poj2 ...

  5. POJ2352 Stars (静态二叉检索树)

    https://vjudge.net/problem/POJ-2352 分析: 由于是按照y坐标的升序,y坐标向等的按x的升序的顺序给出星星.那么某个星星的等级数就是在他前面x坐标小于等于他的x坐标的 ...

  6. 【二维偏序】【树状数组】【权值分块】【分块】poj2352 Stars

    经典问题:二维偏序.给定平面中的n个点,求每个点左下方的点的个数. 因为 所有点已经以y为第一关键字,x为第二关键字排好序,所以我们按读入顺序处理,仅仅需要计算x坐标小于<=某个点的点有多少个就 ...

  7. [POJ2352] Stars(树状数组)

    传送门 先按照下标x排序,然后依次把y加入树状数组,边加入边统计即可. 注意下标re从零开始,需+1s ——代码 # include <iostream> # include <cs ...

  8. 树状数组 poj2352 Stars

    2019-05-20 22:52:07 加油,坚持,加油,坚持 !!! #include<iostream> #include<cstdio> #include<cstr ...

  9. 【POJ2352】【树状数组】Stars

    Description Astronomers often examine star maps where stars are represented by points on a plane and ...

随机推荐

  1. validate方法配置项

    validate()方法配置项 submitHandler 通过验证后运行的函数,可以加上表单提交的方法 invalidHandler 无效表单提交后运行的函数 ignore 对某些元素不进行验证 r ...

  2. C# 对JS编码/解码进行转换

    public static class Extension { #region [编码/解码统一转换] /// <summary> /// /// </summary> /// ...

  3. Error parsing XML: not well-formed (invalid token) 报错+R文件消失解决的方法

    xml报错: 这个xml文件上右键source ->format 注意:res下的文件名称不能大写 R文件消失: 在攻克了其它问题的情况下(或者其它问题还没解决先凝视掉) 手动删除gen pro ...

  4. [Flux] Component / Views

    The application will dislay a some catalogs, and each catalog has title image, description. Catalog: ...

  5. Ubuntu设置环境变量的几种方法

    1.Linux的变量种类 按变量的生存周期来划分,Linux变量可分为两类: 1.1 永久的:需要修改配置文件,变量永久生效. 1.2 临时的:使用export命令声明即可,变量在关闭shell时失效 ...

  6. 【转】string常用函数

    原文地址:http://hi.baidu.com/baowup/blog/item/3a27465c86d71546faf2c066.html/cmtid/de1ef3f0de7554a0a40f52 ...

  7. HDU 4607 Park Visit(树的直径)

    题目大意:给定一棵树,让求出依次访问k个点的最小花费,每条边的权值都为1. 思路:如果能一直往下走不回来,那么这个路径肯定是最小的,这就取决于给定的k,但是怎么确定这个能一直走的长度呢,其实这个就是树 ...

  8. Linq101-Miscellaneous

    using System; using System.Collections.Generic; using System.Linq; namespace Linq101 { class Miscell ...

  9. Android Studio使用技巧

    1.ctrl+shift+F格式化代码时自动换行: 在settings里面找到Editor>General>Soft Wraps>设置选中Use soft wraps in edit ...

  10. [LeetCode OJ] Reorder List—Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…

    For example,Given {1,2,3,4}, reorder it to {1,4,2,3}. /** * Definition for singly-linked list. * str ...