# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
969430 | AliHasanli | Index (COCI21_index) | C++17 | 2530 ms | 46540 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int a[200005];
vector<int>seg[800005];
void build(int no,int l,int r)
{
//cout<<"B "<<no<<" "<<l<<" "<<r<<endl;
if(l==r){seg[no].push_back(a[l]);return;}
build(2*no,l,(l+r)/2);
build(2*no+1,(l+r)/2+1,r);
seg[no].resize(seg[no*2].size()+seg[no*2+1].size());
merge(seg[2*no+1].begin(), seg[2*no+1].end(), seg[2*no].begin(), seg[2*no].end(), seg[no].begin());
}
int query(int n,int l,int r,int ql,int qr,int h)
{
//cout<<"A "<<n<<endl;
if(l>r || ql>qr || r<ql || qr<l)return 0;
if(ql<=l && r<=qr)
{
if(lower_bound(seg[n].begin(),seg[n].end(),h)==seg[n].end())return 0;
int index=lower_bound(seg[n].begin(),seg[n].end(),h)-seg[n].begin();
return seg[n].size()-index;
}
return query(2*n,l,(l+r)/2,ql,qr,h)+query(2*n+1,(l+r)/2+1,r,ql,qr,h);
}
int ans(int a,int b,int n)
{
int answer=0;
int l=1,r=200000;
int mid;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |