#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include<bitset>
#include<stack>
using namespace std;
#define ll long long
#define f first
#define endl "\n"
#define s second
#define pii pair<int,int>
#define pppiiii pair<pii,pii>
#define ppii pair<int,pii>
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#define int long long
const ll mod=998244353,mxn=2e5+5,lg=30,inf=1e9,minf=-1e18,Mxn=100000;
int n,m,szx,szy;
struct rec{
int x1,y1,x2,y2,sz,id;
bool operator<(rec c)const{return sz<c.sz;}
};
vector<rec>v;
vector<pair<pii,int>>point;
vector<int>on[mxn+10];
set<int>ans[mxn+10];
vector<int>add[mxn+10],del[mxn+10];
struct seg{
ll v[4*mxn+10],add[4*mxn+10];
void init(){for(int i=0;i<=4*szx;i++)v[i]=inf,add[i]=-1;}
void push(int l,int r,int pos){
if(add[pos]==-1)return;
v[pos]=add[pos];
if(l!=r)add[pos*2]=add[pos*2+1]=add[pos];
add[pos]=-1;
}
void update(int l,int r,int ql,int qr,int pos,int val){
push(l,r,pos);
if(l>qr||r<ql)return;
if(l>=ql&&r<=qr){
add[pos]=val;
push(l,r,pos);
return;
}
int mid=l+(r-l)/2;
update(l,mid,ql,qr,pos*2,val);
update(mid+1,r,ql,qr,pos*2+1,val);
}
int qry(int l,int r,int ql,int qr,int pos){
push(l,r,pos);
if(l>qr||r<ql)return inf;
if(l>=ql&&r<=qr)return v[pos];
int mid=l+(r-l)/2;
return min(qry(l,mid,ql,qr,pos*2),qry(mid+1,r,ql,qr,pos*2+1));
}
}t2;
ll realans[mxn+10],pa[mxn+10];
//bool cm(pair<pii,int>a,pair<pii,int>b){return a.f.s<b.f.s;}
int32_t main(){
cin>>n>>m;
vector<int>comx,comy;
v.resize(n);
for(int i=0;i<n;i++){
cin>>v[i].x1>>v[i].y1>>v[i].x2>>v[i].y2;
comx.pb(v[i].x1);
comx.pb(v[i].x2);
comy.pb(v[i].y1);
comy.pb(v[i].y2);
v[i].sz=(abs(v[i].x1-v[i].x2)*(abs(v[i].y1-v[i].y2)));
v[i].id=i;
}
sort(all(v));
point.resize(m);
for(int i=0;i<m;i++){
cin>>point[i].f.f>>point[i].f.s>>point[i].s;
comx.pb(point[i].f.f);
comy.pb(point[i].f.s);
}
unique(all(comx));
unique(all(comy));
sort(all(comx));
sort(all(comy));
szx=comx.size();
szy=comy.size();
for(auto &i:v){
i.x1=lb(all(comx),i.x1)-comx.begin();
i.x2=lb(all(comx),i.x2)-comx.begin();
i.y1=lb(all(comy),i.y1)-comy.begin();
i.y2=lb(all(comy),i.y2)-comy.begin();
}
for(auto &i:point){
i.f.f=lb(all(comx),i.f.f)-comx.begin();
i.f.s=lb(all(comy),i.f.s)-comy.begin();
}
for(int i=0;i<n;i++)cout<<realans[i]<<'\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
81 ms |
28404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
92 ms |
28880 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
148 ms |
31624 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
233 ms |
34592 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
237 ms |
34744 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |