output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; const int N = 100010; struct node { int first, second, z; bool operator<(const node &a) const { return first - second < a.first - a.second || (first - second == a.first - a.second && first < a.first); } } a[N], b[N]; pair<int, int> ans[N]; int main() { ...
### Prompt Construct a Cpp code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> using namespace std; const int N = 100010; pair<int, int> fim[N]; map<int, vector<pair<int, int> > > grupos[2]; int ans[N]; int n, w, h; void calc_fim(int tipo, int first, int i) { if (tipo == 0) { fim[i] = make_pair(first, h); } else { fim[i] = make_pair(w, first); } } int main()...
### Prompt Your challenge is to write a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; pair<int, int> P[100010]; map<int, vector<int>> m1, m2; struct Vertical { int x, t, id; bool operator<(const Vertical& rhs) const { return x < rhs.x; } }; struct Horizon { int x, t, id; bool operator<(const Horizon& rhs) const { return t < rhs.t; } }; vector<Vertica...
### Prompt Your task is to create a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen t...
#include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << "=" << h << "\n"; } template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != ',') cerr << *sdbg++; cerr << "=" << h << ","; _dbg(sdbg + 1, a...); } int test;...
### Prompt Your task is to create a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen t...
#include <bits/stdc++.h> #pragma comment(linker, "/stack:16777216") using namespace std; const int INF = 1000000000; const int BASE = 1000000007; const int MAX = 100007; const int MAX2 = 10007; const int MAXE = 100000; const int ADD = 1000000; const int MOD = 1000000007; const int CNT = 0; pair<int, int> res[MAX]; int ...
### Prompt In CPP, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100; pair<int, int> gl[maxn], ans[maxn]; vector<int> g[3][2 * maxn + 100]; pair<pair<int, int>, pair<int, int> > in[maxn]; int main() { ios_base::sync_with_stdio(false); int n, w, h; int pos = 1e5; cin >> n >> w >> h; for (int i = 1; i <= n;...
### Prompt Please create a solution in Cpp to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; pair<int, int> ans[100005]; vector<pair<int, pair<int, int> > > v[2]; int main() { int n, w, h; scanf("%d%d%d", &n, &w, &h); for (int i = 0; i < n; i++) { int aa, bb, cc; scanf("%d%d%d", &aa, &bb, &cc); aa--; v[aa].push_back({bb - cc, {bb, i}}); } ...
### Prompt Develop a solution in cpp to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; template <typename T> void read(T &a) { T x = 0, f = 1; char ch = getchar(); while (ch < '0' || c...
### Prompt Your challenge is to write a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, x, y; cin >> n >> x >> y; map<int, vector<pair<int, int>>> g1; map<int, vector<pair<int, int>>> g2; for (int i = 0; i < n; i++) { int g, p, t; cin >> g >> p >> t; if (g == 1) { ...
### Prompt Develop a solution in cpp to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; struct Node { int x, y; int val; int g; } node[MAXN], res[MAXN]; int p[MAXN]; bool cmp(int a, int b) { if (node[a].val == node[b].val) { if (node[a].x == node[b].x) return node[a].y > node[b].y; return node[a].x < node[b].x; } ...
### Prompt Construct a CPP code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> using namespace std; int pos[200005][2], flip[200005]; vector<pair<int, int> > V[200005], H[200005]; int main() { int N, w, h; scanf("%d %d %d", &N, &w, &h); for (int i = 1; i <= N; i++) { int g, p, t; scanf("%d %d %d", &g, &p, &t); flip[i] = i; if (g == 1) { pos[i][...
### Prompt In Cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; struct P { int g, p, t, id, c; void input(int i) { scanf("%d%d%d", &g, &p, &t); id = i; c = p - t; } bool operator<(const P& b) const { if (c != b.c) return c < b.c; if (g != b.g) return g < b.g; if (g == 1) return p < b.p; return p > b.p...
### Prompt Your challenge is to write a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; map<int, deque<int>> mp; int n, w, h, ansx[N], ansy[N], temp[N]; struct node { int g, p, t, id; bool operator<(const node& a) const { return p < a.p; } } q[N]; void cal(int a, int b) { for (int i = 1; i <= n; i++) if (q[i].g == a) mp[q[i].t...
### Prompt Your challenge is to write a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:102400000,102400000") template <class T> inline void gmax(T &a, T b) { if (b > a) a = b; } template <class T> inline void gmin(T &a, T b) { if (b < a) a = b; } using namespace std; const int N = 1e5 + 10, M = 2e6 + 10, Z = 1e9 + 7, maxint = 2147483647, ...
### Prompt Generate a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int n, w, h, g[N], lis1[N], c1, lis2[N], c2, body[N]; struct ray { bool ver; int p, t; pair<int, int> direct() { if (ver) return pair<int, int>(p, h); else return pair<int, int>(w, p); } } a[N]; list<int> que[N]; pair<int,...
### Prompt Please provide a Cpp coded solution to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const int INF = 1 << 30; int MAXN = 1e7 + 2; const double eps = 1e-13; map<int, vector<pair<int, int> > > di; map<pair<int, int>, int> ptoi; pair<int, int> p[100009]; pair<int, int> ans[100009]; int main() { int n, w, h; scanf("%d%d%d", &n...
### Prompt Your challenge is to write a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 88; struct _dance { int x, t, no; }; struct _point { int x, y; }; int readint() { int cur; scanf("%d", &cur); return cur; } bool cmp(_dance i, _dance j) { return i.x < j.x; } queue<int> q[2 * maxn], pos[2 * maxn]; vector<_dance> x, y; _point...
### Prompt Please provide a cpp coded solution to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; int n, w, h; struct node { int tag, l, t, id; } rec[105000]; int x[105000], y[105000]; int id[105000]; int pp[105000]; bool cmp(node a, node b) { if (a.l - a.t == b.l - b.t) { if (a.tag == b.tag) { return a.l < b.l; } return a.tag < b.tag; } return...
### Prompt In cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; int g[100100], p[100100], t[100100], id[100100]; bool cmp(int u, int v) { if (t[u] != t[v]) return t[u] < t[v]; if (g[u] != g[v]) return g[u] > g[v]; if (g[u] == 2) return p[u] > p[v]; return p[u] < p[v]; } pair<int, int> ans[100100]; vector<int> adj; int main() { ...
### Prompt Your challenge is to write a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long M = 1e5 + 7; long long p[M], g[M], t[M]; map<long long, vector<long long> > mpx, mpy; bool cmp(long long a, long long b) { return p[a] < p[b]; } pair<long long, long long> kq[M]; int main() { long long n, w, h; cin >> n >> ...
### Prompt Generate a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> const int maxn = 1e5 + 5; using namespace std; int n, h, w, cnt0, cnt1; struct node { int x, num, tim; node() {} node(int _x, int _tim, int _num) { x = _x; num = _num; tim = _tim; } bool operator<(const node &a) const { if (tim != a.tim) return tim < a.tim; e...
### Prompt Generate a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> using namespace std; const int M = 1e9 + 7; const int N = 100000 + 10; const int NN = 100000; struct Node { int id, x, y; Node() {} Node(int id, int x, int y) : id(id), x(x), y(y) {} }; vector<Node> pa[N * 2], a[N * 2], b[N * 2]; int n, W, H; Node ans[N * 2]; bool cmp_a(Node a, Node b) { ...
### Prompt In CPP, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int N, w, h; struct Dancer { int group, p, t, id; } D[maxn]; vector<Dancer> coll[maxn << 1]; bool cmp1(const Dancer &a, const Dancer &b) { if (a.group != b.group) return a.group < b.group; if (a.group == 1) return a.p < b.p; else ret...
### Prompt Your task is to create a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen t...
#include <bits/stdc++.h> using namespace std; int n, w, h; unordered_map<int, vector<pair<int, int>>> starts; unordered_map<int, vector<pair<int, pair<int, int>>>> endss; pair<int, int> results[100001]; int main() { cin >> n >> w >> h; for (int i = 0; i < n; i++) { int g, p, t; cin >> g >> p >> t; if (g...
### Prompt Please create a solution in CPP to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; struct node { int x, y, id; bool operator<(const node& e) const { if (x == e.x) return y > e.y; return x < e.x; } }; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, w, h; cin >> n >> w >> h; vector<vector<node>> a(200005); for (int i = 0; ...
### Prompt Please create a solution in CPP to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const int MAXN = 1e5 + 7; const double EPS = 1e-8; const int LOGN = 30; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, w, h; cin >> n >> w >> h; vector<vector<pair<int, int> > > points1(2 * MAXN), points2(2 * ...
### Prompt Please formulate a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; namespace ioput { template <typename T> T read() { T x = 0, f = 1; char c = getchar_unlocked(); while ((c < '0') || (c > '9')) { if (c == '-') f = -1; c = getchar_unlocked(); } while ((c >= '0') && (c <= '9')) x = (x << 1) + (x << 3) + (c ^ 48), c = ge...
### Prompt Please provide a Cpp coded solution to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const int MOD2 = 1007681537; const int INF = (int)1e9; const long long LINF = (long long)1e18; const long double PI = acos((long double)-1); const long double EPS = 1e-9; inline long long gcd(long long a, long long b) { long long r; while (...
### Prompt Please create a solution in CPP to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; int n, w, h, g[100005], pos[100005], t[100005]; pair<int, int> sol[100005]; map<int, vector<int> > m; bool Comp(int a, int b) { return pos[a] < pos[b]; } pair<int, int> getSol(int idx) { if (g[idx] == 1) return make_pair(pos[idx], h); return make_pair(w, pos[idx]); } vo...
### Prompt Please formulate a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; struct node { int id, g, p, t; bool operator<(const node &rhs) const { return p - t < rhs.p - rhs.t; } void read(int id_) { scanf("%d%d%d", &g, &p, &t); id = id_; } } per[(100000 + 5)], g1[(100000 + 5)], g2[(100000 + 5)]; bool cmp(node a, node b) { return a....
### Prompt Please create a solution in Cpp to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const int N = 100006; int g[N], p[N], t[N]; int x[N], y[N]; vector<int> v[2 * N]; pair<int, int> ans[N]; int main() { int q, h, w; scanf("%d %d %d", &q, &h, &w); for (int i = 1; q >= i; i++) { scanf("%d %d %d", &g[i], &p[i], &t[i]); if (g[i] == 1) { x[i]...
### Prompt Please create a solution in CPP to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 1; int n, w, h; pair<int, int> ans[N]; vector<pair<int, int> > d[N][2]; void input() { cin >> n >> w >> h; for (int i = 0; i < n; ++i) { int p; cin >> p; int x; cin >> x; int t; cin >> t; d[t - x + (N >> 1)][p == 1].push_b...
### Prompt Generate a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> int main() { int n, w, h; scanf("%d%d%d", &n, &w, &h); std::map<int, std::vector<std::pair<int, int>>> map[2]; std::set<int> keys; for (int i = 0; i < n; ++i) { int g, p, t; scanf("%d%d%d", &g, &p, &t); map[g - 1][p - t].emplace_back(p, i); keys.emplace(p - t); } s...
### Prompt Develop a solution in Cpp to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, w, h, g, t, p; struct Node { int g, t, p, id; Node() {} Node(int id, int g, int p, int t) : id(id), g(g), t(t), p(p) {} int ord() const { return p - t; } pair<int, int> getEnd() { if (g == 1) { return {p, h}; } else { ...
### Prompt Please create a solution in cpp to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using db = double; int n, w, h; struct Obj { int g, p, t, id; }; const int mxn = 100006; int x[mxn]; int y[mxn]; unordered_map<int, vector<Obj>> s; int main() { cin >> n >> w >> h; for (int i = 0; i < n; ++i) { int g, ...
### Prompt In cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; const int NR = 1e5 + 10; void Min(int& x, int y) { x = min(x, y); } void Max(int& x, int y) { x = max(x, y); } int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && c...
### Prompt Construct a cpp code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> using namespace std; int Y[] = {-1, 1, 0, 0, -1, -1, 1, 1}; int X[] = {0, 0, -1, 1, -1, 1, -1, 1}; int directions = 4; long long power(long long a, long long n) { if (a == 0) return 0; if (a == 1 || n == 0) return 1; if (n == 1) return a % 1000000007; long long t = power(a, n / 2); t ...
### Prompt Construct a cpp code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> using namespace std; vector<vector<long long> > mul(vector<vector<long long> > a, vector<vector<long long> > b) { vector<vector<long long> > c; c.resize(a.size()); for (int i = 0; i < c.size(); i++) c[i].resize(b[0].size(), 0); for (int i = 0; i < c.size()...
### Prompt Your challenge is to write a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const int INF = 0x3f3f3f3f; const int N = 1e5 + 9; const int shift = 1e5 + 9; const double Eps = 1e-9; struct node { int dir, p, t; } a[N]; int n, w, h; vector<int> v[N + shift], gx, gy; pair<int, int> ans[N]; bool cmp(int u, int v) { if (a...
### Prompt Your challenge is to write a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int typ[N], x[N], t[N], v[N], id[N]; pair<int, int> ans[N], p[N]; int pn; int main() { int n, w, h; scanf("%d %d %d", &n, &w, &h); for (int i = 0; i < n; i++) { scanf("%d %d %d", typ + i, x + i, t + i); v[i] = x[i] - t[i]; id[i] = i...
### Prompt Please formulate a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; int main(int argc, char **argv) { int n, w, h; cin >> n >> w >> h; vector<vector<pair<int, pair<int, int>>>> finish(400000); vector<vector<pair<int, int>>> start(400000); vector<pair<int, int>> result(n); for (int i = 0; i < n; ++i) { int g, p, t, start_x, e...
### Prompt Develop a solution in cpp to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:256000000") using namespace std; const long double PI = 3.14159265358979323846; const long double eps = 1e-5; const int INF = numeric_limits<int>::max(); const long long LINF = numeric_limits<long long>::max(); const long long mod = 1000 * 1000 * 1000 + 7; void s...
### Prompt Please provide a CPP coded solution to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; long long gcd(long long n1, long long n2) { if (n2 == 0) return n1; if (n1 % n2 == 0) return n2; return gcd(n2, n1 % n2); } long long powmod(long long base, long long exponent) { long long ans = 1; while (exponent) { if (exponent & 1) ans = (ans * base) % 1000...
### Prompt Create a solution in CPP for the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no colli...
#include <bits/stdc++.h> using namespace std; bool fuckingGoodComp(pair<int, pair<int, int> > first, pair<int, pair<int, int> > second) { return first.second.first < second.second.first; } void solve(vector<pair<int, pair<int, int> > > group, int sol[][2], const int width, const int he...
### Prompt Develop a solution in cpp to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; map<int, pair<vector<pair<int, int> >, vector<pair<int, int> > > > mapp; int g[100010], p[100010], t[100010]; pair<int, int> ans[100010]; int main() { int n, w, h, i, j; scanf("%d", &n); scanf("%d", &w); scanf("%d", &h); for (i = 0; i < n; i++) { scanf("%d", &...
### Prompt Generate a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using db = double; const int N = 2e5L + 11; int g[N], p[N], t[N]; map<int, vi> mp[3]; int x[N], y[N]; bool cmp(int i, int j) { return p[i] < p[j]; } using pii = pair<int, int>; bool cmp2(pii a, pii b) { if (a.second == b.secon...
### Prompt Develop a solution in cpp to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const int MAXT = 100000; const int MAXN = 200005; int g[MAXN], p[MAXN], t[MAXN]; vector<int> x[MAXN], y[MAXN]; int ansx[MAXN], ansy[MAXN]; bool comp(int x, int y) { return p[x] < p[y]; } int main() { int n, w, h; scanf("%d%d%d", &n, &w, &h); for (int i = 1; i <= n; i+...
### Prompt Create a solution in CPP for the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no colli...
#include <bits/stdc++.h> const int maxn = 100010; int n, w, h, ans[maxn]; struct pos { int x, y; } Pos[maxn]; struct lr { int i, p, t, ty, x; bool operator<(const lr &a) const { return ty != a.ty ? ty < a.ty : p < a.p; } } a[maxn], b[maxn], x[maxn], tmp[maxn]; int main() { scanf("%d%d%d", &n, &w, &h); for (in...
### Prompt Construct a Cpp code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> using namespace std; const int maxn = 100005, inf = 0x3f3f3f3f; const long long llinf = 0x3f3f3f3f3f3f3f3f; const long double pi = acos(-1.0L); int x[maxn], y[maxn], b[maxn], c[maxn]; struct Dancer { int g, p, t, id; }; Dancer a[maxn]; bool cmp(Dancer a, Dancer b) { return a.t - a.p < b.t -...
### Prompt Your task is to create a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen t...
#include <bits/stdc++.h> using namespace std; const int N = 200000 + 20; struct node { int id, y; friend bool operator<(const node& a, const node& b) { return a.y < b.y; } } no; int n, w, h; pair<int, int> ans[N]; int p[N]; set<node> a[N], s[N]; set<node>::iterator ita, its; set<int> y[N]; set<int>::iterator it; in...
### Prompt Please create a solution in CPP to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const int M = 400010, mod = 1000000007; map<int, vector<pair<int, pair<int, int> > > > mep; vector<pair<int, int> > first, second; vector<pair<int, int> > a, b; pair<int, int> ans[M]; int n, w, h; void solve_for(vector<pair<int, pair<int, int> > > A) { int i, j, k; firs...
### Prompt Please formulate a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; pair<int, int> endpos[100000]; vector<pair<pair<int, int>, int> > vs[200020]; int _harr[200020]; int poschg[100000]; int func(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) { if (a.first.first != b.first.first) { return a.first.first > b.first.first; } ...
### Prompt Please create a solution in CPP to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const long double PI = 3.14159265359; const long long MOD = (long long)998244353ll; const long long MAXN = (long long)1e5 + 10; const long long INF = (long long)9223372036854775; const long double EPS = (long double)1e-8; vector<long long> dan[2 * MAXN]; vector<pair<long lo...
### Prompt Construct a cpp code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> using namespace std; stringstream output; inline void eOP(); int main() { int n, w, h; cin >> n >> w >> h; map<int, map<int, int>> data; for (int i = 0; i < n; ++i) { int g, p, t; cin >> g >> p >> t; int x, y; switch (g) { case 1: x = p; y = -t; ...
### Prompt In cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 5; int N, W, H, p[MAX], q[MAX], ans[MAX][2], who[MAX]; vector<pair<int, int> > xx, yy; vector<int> X[MAX * 2], Y[MAX * 2]; int main() { scanf("%d%d%d", &N, &W, &H); for (int i = 0; i < N; ++i) { int g; scanf("%d%d%d", &g, &p[i], &q[i]); ...
### Prompt Construct a CPP code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; bool B[N]; int A[N], n, X, Y, t, tmp, tmp2; vector<int> D[2 * (N + 10)]; pair<int, int> ans[N]; inline bool cmp(int a, int b) { if (B[a] != B[b]) return (B[a]); return (B[a] ? A[a] < A[b] : A[a] > A[b]); } int main() { scanf("%d %d %d", &n, &X, ...
### Prompt Please create a solution in Cpp to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const int off = 1e5; queue<int> p[200005], v[200005]; int g, c, t; int ax[100005], ay[100005]; int n, w, h; vector<pair<int, pair<int, int> > > a, b; int main() { scanf("%d %d %d", &n, &w, &h); for (int i = 0; i < n; i++) { scanf("%d %d %d", &g, &c, &t); if (g =...
### Prompt Please provide a Cpp coded solution to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; int n, w, h; vector<pair<pair<int, int>, int>> dancers; map<int, vector<pair<pair<int, int>, int>>> groups; bool comp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) { return (a.first).second < (b.first).second; } vector<pair<int, int>> f() { vector<pair<int, ...
### Prompt Please formulate a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; int n, w, h; int g[200001], p[200001], t[200001]; int a[200001]; int b[200001]; int x[200001], y[200001]; void qsort(int l, int r) { int i = l, j = r, q; int k = i + rand() % (j - i + 1); int m1 = g[k], m2 = p[k]; int m0 = a[k]; while (i <= j) { while (a[i] < ...
### Prompt Generate a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> using namespace std; struct Dancer { int x, y, idx, g; Dancer() { x = y = idx = g = 0; } Dancer(int _x, int _y, int _g, int _idx) { x = _x, y = _y, g = _g, idx = _idx; } }; vector<Dancer> bucket[100010]; map<int, int> buck; pair<int, int> rez[100010]; int k = 0; bool cmp(Dancer a, D...
### Prompt In cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } int h, w, n, R[131072 *...
### Prompt Create a solution in CPP for the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no colli...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const int mx = 1e5; int n, w, h, g, p, t, x[N], y[N]; int read() { int x = 0, f = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); } while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; ...
### Prompt Generate a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, w, h, g[N], x[N], t[N], idx[N]; map<int, vector<int> > hs; void solve() { scanf("%d%d%d", &n, &w, &h); for (int i = 0; i < n; i++) { scanf("%d%d%d", &g[i], &x[i], &t[i]); hs[x[i] - t[i]].push_back(i); } for (auto vec : hs) { ...
### Prompt Create a solution in CPP for the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no colli...
#include <bits/stdc++.h> using namespace std; int n, w, h, an[3][100005], now[100005], cnt = 1, cnt1 = 1, cnt2 = 1, lol[100005]; pair<pair<int, int>, pair<int, int> > pr[100005]; map<int, int> mp[3]; vector<int> vt[3][100005], v; void process(int ex, int wye) { int tmp, siz1 =...
### Prompt Construct a cpp code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> using namespace std; struct dancer { int g; int p; int t; int id; }; int n, xs, ys; map<int, vector<dancer>> groups; map<int, pair<int, int>> finalPos; bool s1(dancer a, dancer b) { if (a.g != b.g) return a.g > b.g; if (a.g == 1) return a.p < b.p; else return a.p > b.p; } ...
### Prompt In Cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 1e5 + 10; void file(string s) { freopen((s + ".in").c_str(), "r", stdin), freopen((s + ".out").c_str(), "w", stdout); } long long read() { long long f = 1, a = 0; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f =...
### Prompt Your challenge is to write a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const long long MAX = 1000005; long long n; long long g[MAX], p[MAX], t[MAX], b[MAX]; basic_string<long long> a[2][2 * MAX]; long long w, h; bool cmp(long long i, long long j) { return p[i] < p[j]; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(...
### Prompt Your task is to create a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen t...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 1; int n, h, w, g[N], p[N], t[N], ansx[N], ansy[N]; vector<int> v[3 * N]; int main() { scanf("%d%d%d", &n, &w, &h); for (int i = 0; i < n; i++) { scanf("%d%d%d", g + i, p + i, t + i); v[p[i] - t[i] + N].push_back(i); } fill(ansx, ansx + N...
### Prompt Develop a solution in cpp to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; int n, w, h; struct ed1 { int x, y, clas, id, ANSx, ANSy; } p[100099]; struct ed2 { int x, y, clas; } ans[100099]; bool cmp1(const ed1 &A, const ed1 &B) { if (A.clas != B.clas) return A.clas < B.clas; return A.x < B.x; } bool cmp2(const ed2 &A, const ed2 &B) { if ...
### Prompt Develop a solution in cpp to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int sum[maxn], g[maxn], p[maxn], t[maxn], ans[maxn][2]; vector<int> type[maxn << 1]; struct node { int x, y, id; }; struct node tmpans[maxn]; struct node tmpst[maxn]; bool cmp(node t1, node t2) { return t1.y == t2.y ? t1.x > t2.x : t1.y < t2.y; ...
### Prompt Create a solution in Cpp for the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no colli...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; vector<int> pt[2][maxn + maxn]; int g[maxn], p[maxn], t[maxn], anid[maxn]; pair<int, int> ans[maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, w, h; cin >> n >> w >> h; for (int i = 0; i < n; ++i) { cin >> g[i...
### Prompt Create a solution in CPP for the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no colli...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > arr1[200100][2]; int arr[100009][3]; int ans[100009][2]; int main() { int n, w, h; cin >> n >> w >> h; int a, b, c; for (int f = 0; f < n; f++) { cin >> a >> b >> c; arr1[c - b + 100000][a - 1].push_back({b, f}); arr[f][0] = a; ...
### Prompt Construct a Cpp code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } using namespace std; const int maxn = 1e5 + ...
### Prompt Please provide a CPP coded solution to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; template <class A, class B> A cvt(B x) { stringstream ss; ss << x; A y; ss >> y; return y; } int n, w, h; int main() { scanf("%d %d %d", &n, &w, &h); map<int, vector<pair<int, int> > > diag, exits; for (int i = 0; i < (int)(n); i++) { int g, p, t; sc...
### Prompt Develop a solution in Cpp to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; } template <typename T1, typename T2> inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; } inline int readChar(); template <class T = int> inline T readInt(); template <class T> inl...
### Prompt In cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef pair<set<pii>, set<pii> > line; map<int, line> lines; int n, w, h; void insert_dancer(int type, int pos, int t, int i) { int line_number = pos - t; if (type == 1) lines[line_number].first.insert(pii(pos, i)); else if (type == 2)...
### Prompt In cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9 + 7; const int N = 2e5 + 10; map<int, vector<tuple<int, int, int>>> mc[3]; pair<int, int> ans[N]; vector<tuple<int, int, int>> check(const vector<tuple<int, int, int>>& vp1, const vector<tuple<int, int, int>>& vp2...
### Prompt Please formulate a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; vector<int> arr[N][2]; vector<pair<int, int>> mp[2 * N]; vector<array<int, 3>> v; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, w, h; cin >> n >> w >> h; for (int i = 0; i < n; i++) { int g, p, t;...
### Prompt Your challenge is to write a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const int OO = 1e9; const long long INF = 1e18; const int irand(int lo, int hi) { return ((double)rand() / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo; } const long long lrand(long long lo, long long hi) { return ((double)rand() / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo; } te...
### Prompt Generate a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> static const int MAXN = 100004; static const int MAXW = 100003; static const int MAXT = 100002; int n, w, h; int g[MAXN], p[MAXN], t[MAXN]; std::vector<int> s[MAXW + MAXT]; int ans_x[MAXN], ans_y[MAXN]; int main() { scanf("%d%d%d", &n, &w, &h); for (int i = 0; i < n; ++i) { scanf("%d%d%...
### Prompt Your challenge is to write a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int read() { int s = 0; char c = getchar(), lc = '+'; while (c < '0' || '9' < c) lc = c, c = getchar(); while ('0' <= c && c <= '9') s = s * 10 + c - '0', c = getchar(); return lc == '-' ? -s : s; } void write(int x) { if (x < 0) putchar('...
### Prompt In cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; struct person { int id, pos; person(int a, int b) : id(a), pos(b) {} bool operator<(const person &o) const { return pos < o.pos; } }; int main() { unordered_map<int, vector<person>> a; int n, w, h; cin >> n >> w >> h; for (int i = 0; i < n; i++) { int g, p...
### Prompt Generate a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> using namespace std; const int maxn = 100210, A = 100100; int n, w, h; vector<int> ver[maxn], hor[maxn]; vector<int> vid[maxn], hid[maxn]; deque<int> mp[maxn << 1]; vector<int> mpy[maxn << 1]; pair<int, int> ans[maxn]; int main() { cin >> n >> w >> h; for (register int i = 1; i <= n; ++i) {...
### Prompt Construct a CPP code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> using namespace std; vector<vector<int> > x(400000); int main(void) { int k; int N; int M; scanf("%i %i %i", &k, &M, &N); int a[k][3]; int i; for (i = 0; i < k; i++) { scanf("%i %i %i", &a[i][0], &a[i][1], &a[i][2]); a[i][2] += 150000; x[a[i][2] - a[i][1]].push_back(i)...
### Prompt Your task is to create a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen t...
#include <bits/stdc++.h> using namespace std; bool comp(const pair<pair<long long, long long>, long long>& a, const pair<pair<long long, long long>, long long>& b) { if (a.first.first == b.first.first) return a.first.second < b.first.second; else return a.first.first < b.first.first; } int main() ...
### Prompt Please formulate a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; ifstream in("file.in"); ofstream out("file.out"); struct om { int p, t, id; } a[100005], b[100005]; int n, w, h, cnt1[200005], cnt2[200005], ans[100005], v[200005], k, m, first, nibab[100005]; pair<int, int> fk[100005]; queue<int> q[200005]; bool comp(om a, om b) { re...
### Prompt In cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > f[3][200100]; pair<int, int> ans[100100], res[100100]; int g[100100], p[100100], t[100100]; int n, h, w; void work(vector<pair<int, int> > &f, vector<pair<int, int> > &g) { int n = f.size(), m = g.size(); for (int i = 0; i < n; ++i) { if (m >...
### Prompt Please provide a Cpp coded solution to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const int maxn = 100000 + 100; const int maxm = 100000 + 10; const int mod = (int)1e9 + 7; const int INF = 0x3f3f3f3f; const long long LINF = (1LL << 60); const double PI = acos(-1.0); struct node { int x, y, id; node() {} bool operator<(const node &r) const { return ...
### Prompt Generate a cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> using namespace std; const int geta = 100000; int p[100010], x[100010], y[100010]; vector<int> hoge[2][200010]; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, w, h; cin >> n >> w >> h; for (int i = 0; i < n; i++) { int g, t; cin >> g >> p[i] >> t; g--; ho...
### Prompt Please formulate a Cpp solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; vector<vector<int> > vec1(312345), vec2(312346); int g[123456], p[123456], t[123456]; int cons; int h, w; int computeup(int i) { int val1, val; vector<int>::iterator it; val1 = t[i] - p[i] + cons; it = upper_bound(vec1[val1].begin(), vec1[val1].end(), p[i]); val =...
### Prompt Please formulate a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; const double pi = 3.141592653589793; vector<pair<int, int> > vec[111111][2]; map<int, int> mm; int c; int ara[111111][2]; int ans[111111]; pair<int, int> point[111111]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, w, h; cin >> n >> w >> h; int a, x...
### Prompt Please provide a cpp coded solution to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be se...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100100; struct kk { int g, x, t, id; int z; kk() {} kk(int gg, int xx, int tt, int idd) { g = gg; x = xx; t = tt; id = idd; z = x - t; } }; bool menor(const kk &a, const kk &b) { if (a.z == b.z) { return a.x < b.x; } ...
### Prompt Create a solution in Cpp for the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no colli...
#include <bits/stdc++.h> using namespace std; const int d = 150000; const int N = 400000; const int M = 102; unsigned long long cs = 1; struct T { int g, p, t, i; T() {} bool operator<(const T &other) const { return make_pair(p, make_pair(g, t)) < make_pair(other.p, make_pair(other.g, other.t)); ...
### Prompt Create a solution in CPP for the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no colli...
#include <bits/stdc++.h> using namespace std; int n, w, h; struct rec { int g, p, t, id; } x[111116], y[111116]; bool cmp_x(rec x, rec y) { if (x.p - x.t != y.p - y.t) return x.p - x.t < y.p - y.t; return (2 * x.g - 3) * x.p < (2 * y.g - 3) * y.p; } bool cmp_y(rec x, rec y) { return x.id < y.id; } int read() { ...
### Prompt Generate a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisi...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 7, M = 2e6; const long long mod = 1e9 + 7; inline int read() { int ret = 0; char ch = getchar(); bool f = 1; for (; !isdigit(ch); ch = getchar()) f ^= !(ch ^ '-'); for (; isdigit(ch); ch = getchar()) ret = (ret << 1) + (ret << 3) + ch - 48; r...
### Prompt Your task is to create a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen t...
#include <bits/stdc++.h> using namespace std; struct point { int x, y, x_end, y_end, id; point() {} point(int a, int b, int c, int d, int e) { x = a; y = b; x_end = c; y_end = d; id = e; } } number[100005], temp[100005]; void cp(point &a, point &b) { a = point(b.x, b.y, b.x_end, b.y_end, b.i...
### Prompt In Cpp, your task is to solve the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no coll...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g = 10.0, eps = 1e-7; const int N = 200000 + 10, maxn = 60000 + 10, inf = 0x3f3f3f; int gg[N], p[N], t[N], x[N]; vector<int> vx[N], vy[N]; pair<int, int> ans[N]; bool comp(int x, int y) { return p[x] < p[y...
### Prompt Please formulate a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; int n, w, h; vector<int> ansx(100000), ansy(100000), g(100000), p(100000), t(100000), x, y; int main() { map<int, vector<int>> s; x.clear(); y.clear(); s.clear(); cin >> n >> w >> h; for (int i = 0; i < n; i++) { cin >> g[i] >> p[i] >> t[i]; s[p[i] - t[i...
### Prompt Develop a solution in CPP to the problem described below: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > vec[2][200005]; pair<int, int> ans[200005]; int main() { int i, j, n, w, h, opt, p, t, sz1, sz2; cin >> n >> w >> h; for (i = 1; i <= n; i++) { cin >> opt >> p >> t; vec[opt - 1][p - t + 100000].push_back(make_pair(p, i)); } for (i ...
### Prompt Construct a cpp code solution to the problem outlined: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no co...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ios::failbit); int n, w, h; cin >> n >> w >> h; map<int, pair<vector<pair<int, int>>, vector<pair<int, int>>>> a; for (auto i = 0; i < n; ++i) { int g, p, t; cin >> g >> p >> t; ...
### Prompt Please formulate a CPP solution to the following problem: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no...