#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
const int MAX = 1e5 + 5 ;
const int MAX2 = 1e5 ;
typedef tree<
pair<int , int>,
null_type,
less< pair<int , int> >,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
ordered_set bit[MAX] ;
void update(int x , int y)
{
///debugging
if(x >= MAX || y >= MAX)
assert(0) ;
for(int i = x ; i < MAX ; 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(make_pair(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 main()
{
ios::sync_with_stdio(0) ;
cin.tie(0) ;
int n , q ;
cin>>n>>q ;
int a[n] , b[n] ;
for(int i = 0 ; i < n ; ++i)
{
cin>>a[i]>>b[i] ;
update(a[i] , b[i]) ;
}
const int N = 1e5 ;
while(q--)
{
int x , y , z ;
scanf("%d %d %d" , &x , &y , &z) ;
//debugging
cout<<3213412<<"\n";
//cout<<query(N , N) - query(x-1 , N) - query(N , y-1) + query(x-1 , y-1)<<"\n";
}
return 0 ;
}
Compilation message
examination.cpp: In function 'int main()':
examination.cpp:64:15: warning: unused variable 'N' [-Wunused-variable]
const int N = 1e5 ;
^
examination.cpp:68:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d %d" , &x , &y , &z) ;
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
9720 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3093 ms |
53816 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3093 ms |
53816 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
9720 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |