#include <bits/stdc++.h>
#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 100005
#define M ll(998244353)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef short int si;
vector <pair <pair <int, int>, int> > sost;
multiset <int> se[410];
int main()
{
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, k, q;
cin >> n >> k >> q;
int j = -1;
for (int i = 0; i < n; i++)
{
int x, t, l, r;
cin >> x >> t >> l >> r;
sost.pb({{l, x}, t});
sost.pb({{r, x}, -t});
}
vector <pair <pair <int, int>, int> > gr; gr.resize(q);
for (int i = 0; i < q; i++) {cin >> gr[i].F.S >> gr[i].F.F; gr[i].S = i;}
sort(sost.begin(), sost.end());
sort(gr.begin(), gr.end());
int ans[q];
// for (int i = 0; i < q; i++)
// {
// int nm = gr[i].S, x = gr[i].F.S, time = gr[i].F.F;
//
// while (j + 1 < sz(sost) && sost[j + 1].F.F <= time)
// {
// j++;
//
// if (sost[j].S > 0) se[sost[j].S].insert(sost[j].F.S);
// else se[abs(sost[j].S)].erase(se[abs(sost[j].S)].find(sost[j].F.S));
// }
//
// bool f = 1;
//
// int mx = 0;
//
// for (int u = 1; u <= k; u++)
// {
// if (sz(se[u]) == 0) {f = 0; break;}
//
// auto it = se[u].upper_bound(x);
//
// int mn = 1e9;
//
// if (it != se[u].end()) mn = min(mn, abs(*it - x));
//
// if (it != se[u].begin()) {it--; mn = min(mn, abs(*it - x)); }
//
// mx = max(mx, mn);
// }
//
// if (!f) ans[nm] = -1; else ans[nm] = mx;
// }
for (int i = 0; i < q; i++) cout << ans[i] << endl;
}
Compilation message
new_home.cpp: In function 'int main()':
new_home.cpp:29:9: warning: unused variable 'j' [-Wunused-variable]
int j = -1;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
862 ms |
12792 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
848 ms |
12760 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |