| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 126868 | MohamedAhmed04 | Examination (JOI19_examination) | C++14 | 2471 ms | 66096 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int , int> , null_type, less<pair<int , int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 100005;
ordered_set bit[N];
void update(int x, int y)
{
for(int i = x; i < N; i += i & -i)
bit[i].insert({y, x});
}
int query(int x, int y)
{
int ans = 0;
for(int i = x; i > 0; i -= i & -i)
{
ans += bit[i].order_of_key({y+1, 0});
}
return ans;
}
/*int query(int x , int y)
{
int ans = 0 ;
while(x > 0)
{
int y1 = y ;
while(y1 > 0)
{
ans += bit[{x , y1}] ;
y1 -= (y1 & -y1) ;
}
x -= (x & -x) ;
}
return ans ;
}*/
int a[N], b[N] ;
int q2(int x1 , int y1 , int x2 , int y2)
{
int x = query(x2, y2) - query(x2 , y1 - 1) - query(x1-1 , y2) + query(x1 - 1 , y1 - 1) ;
}
int main()
{
int n , q ;
scanf("%d %d" , &n, &q) ;
for(int i = 0 ; i < n ; ++i)
{
cin>>a[i]>>b[i] ;
a[i] += 2;
b[i] += 2;
}
for(int i = 0 ; i < n ; ++i)
update(a[i] , b[i]) ;
while(q--)
{
int x , y , z ;
cin>>x>>y>>z ;
x += 2 ;
y += 2 ;
z += 2 ;
cout<<q2(x , y , N-1 , N-1)<<"\n" ;
}
return 0 ;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
