임의의 구간 에서 x 보다 작은 수의 개수 (트 리 배열) 를 구하 십시오.
1218 단어 트 리 배열
제목: 임의의 구간 에 정렬 하여 x 번 째 위치 에 있 는 수의 위치 에 변화 가 있 는 지 물 어 봅 니 다.
n ^ 2 이 문 제 를 넘 길 수 있다 는 것 을 알 고 내 마음 은 무 너 졌 다.
#include
#include
#include
#include
using namespace std;
const int maxn=30005;
int aa[maxn],bb[maxn];
int C[maxn],ans[maxn];
int n,m;
int lowbit(int x)
{
return x&(-x);
}
int sum(int x)
{
int ret=0;
while(x>0)
{
ret+=C[x];
x-=lowbit(x);
}
return ret;
}
void add(int x,int d)
{
while(x<=n)
{
C[x]+=d;
x+=lowbit(x);
}
}
struct node
{
int id,num;
bool operator < (const node &other) const
{
return num < other.num;
}
}a[maxn];
struct note
{
int l,r,id,value;
bool operator < (const note &other)const
{
return value
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
HDU 1556 - Color the ball (트 리 배열 - 구간 수정 단점 조회)Color the ball Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.