#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ff first
#define sc second
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define ull unsigned long long
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rngl(chrono::steady_clock::now().time_since_epoch().count());
// #define int long long
// #define int unsigned long long
// #define ordered_set(T) tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
// #define ordered_multiset(T) tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>
void open_file(string filename) {
freopen((filename + ".in").c_str(), "r", stdin);
freopen((filename + ".out").c_str(), "w", stdout);
}
// const ll mod = 1e9 + 7;
// const ll mod = 998244353;
const ll inf = 1e9;
const ll biginf = 1e18;
const int maxN = 8 * 1e4 + 25;
struct node {
int y, l, r, id; bool f;
node(int _y, int _l, int _r, int _id, bool _f) {
y = _y; l = _l; r = _r; id = _id; f = _f;
}
};
bool comp(node a, node b) {
return (a.y == b.y ? a.f < b.f : a.y < b.y);
}
set<int> dp[2 * maxN];
int n, m, A[maxN], B[maxN], C[maxN], D[maxN], X[maxN], Y[maxN], K[maxN];
void solve() {
cin >> n >> m;
vector<int> temp;
for (int i = 1; i <= n; i++) {
cin >> A[i] >> B[i] >> C[i] >> D[i];
temp.pb(A[i]); temp.pb(B[i]); temp.pb(C[i]); temp.pb(D[i]);
} for (int i = 1; i <= m; i++) {
cin >> X[i] >> Y[i] >> K[i];
temp.pb(X[i]); temp.pb(Y[i]);
} sort(all(temp)); temp.resize(unique(all(temp)) - temp.begin());
for (int i = 1; i <= n; i++) {
A[i] = lower_bound(all(temp), A[i]) - temp.begin() + 1;
B[i] = lower_bound(all(temp), B[i]) - temp.begin() + 1;
C[i] = lower_bound(all(temp), C[i]) - temp.begin() + 1;
D[i] = lower_bound(all(temp), D[i]) - temp.begin() + 1;
} for (int i = 1; i <= m; i++) {
X[i] = lower_bound(all(temp), X[i]) - temp.begin() + 1;
Y[i] = lower_bound(all(temp), Y[i]) - temp.begin() + 1;
} for (int i = 1; i <= m; i++)
dp[n + i].insert(K[i]);
vector<node> events;
for (int i = 1; i <= n; i++) {
events.pb(*new node(B[i], A[i], C[i], i, 0));
events.pb(*new node(D[i], A[i], C[i], i, 1));
} for (int i = 1; i <= m; i++) {
events.pb(*new node(Y[i], X[i], X[i], n + i, 0));
events.pb(*new node(Y[i], X[i], X[i], n + i, 1));
}
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int t = 1;
// cin >> t;
while (t--) {
solve();
cout << '\n';
}
return 0;
}
Compilation message (stderr)
plahte.cpp: In function 'void open_file(std::string)':
plahte.cpp:30:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
30 | freopen((filename + ".in").c_str(), "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
plahte.cpp:31:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
31 | freopen((filename + ".out").c_str(), "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |