# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
126822 | MohamedAhmed04 | Examination (JOI19_examination) | C++14 | 3026 ms | 198620 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
const int MAX = 1e5 + 5 ;
struct chash {
int operator()(pair<int , int> x) const { return x.first* 31 + x.second; }
};
gp_hash_table<pair<int , int> , int, chash> bit;
void update(int x , int y , int val)
{
while(x < MAX)
{
int y1 = y ;
while(y1 < MAX)
{
bit[{x , y1}] += val ;
y1 += (y1 & -y1) ;
}
x += (x & -x) ;
}
return ;
}
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 main()
{
int n , q ;
scanf("%d %d" , &n , &q) ;
int a[n] , b[n] ;
for(int i = 0 ; i < n ; ++i)
{
scanf("%d %d" , &a[i] , &b[i]) ;
update(a[i] , b[i] , 1) ;
}
const int N = 1e5 ;
int cur = query(N , N) ;
while(q--)
{
int x , y , z ;
scanf("%d %d %d" , &x , &y , &z) ;
printf("%d\n" , cur - query(x-1 , N) - query(N , y-1) + query(x-1 , y-1)) ;
}
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... |