#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
#define int long long
using namespace std;
typedef pair<int,int> pii;
signed main(){
AquA;
int n,k,q;
cin >> n >> k >> q;
vector<pair<pii,pii> > vp(n);
vector<pair<int,pii> > g;
for(int i=0;i<n;i++){
cin >> vp[i].fs.fs >> vp[i].fs.sc >> vp[i].sc.fs >> vp[i].sc.sc;
vp[i].fs.sc--;
g.push_back({vp[i].sc.fs,vp[i].fs});
g.push_back({vp[i].sc.sc+1,{vp[i].fs.fs,-vp[i].fs.sc}});
}
vector<multiset<int> > s(k);
for(int i=0;i<k;i++){
s[i].insert(-2e9);
s[i].insert(2e9);
}
for(int i=0;i<q;i++){
int l,y;
cin >> l >> y;
g.push_back({l,{-1,y}});
}
sort(g.begin(),g.end());
for(auto h:g){
if(h.sc.fs<0){
int ans=0;
for(int i=0;i<k;i++){
auto y=s[i].lower_bound(h.sc.sc);
auto z=prev(y);
ans=max(ans,min((*y)-h.sc.sc,h.sc.sc-(*z)));
}
cout << ans << "\n";
}
else if(h.sc.sc<0){
s[-h.sc.sc].erase(s[-h.sc.sc].find(h.sc.fs));
}
else{
s[h.sc.sc].insert(h.sc.fs);
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5096 ms |
57084 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5008 ms |
49928 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |