Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-8;
inline void II(int &n) {
char ch = getchar();
n = 0;
bool t = 0;
for (; ch < '0'; ch = getchar())
if (ch == '-') t = 1;
f... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long sh = 100500 + 5;
long long int n, m, k, q, x, y, f, val, t = 1, i, j;
long long int ind = -1, cnt, sz, sm, mx = -1;
long long int a[300004], X, Y, grp, pos;
map<pair<pair<long long int, long long int>, long long int>, long long int>
map_ind;
vector<pair<... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Comparator;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author @Sandip_Jana
*/
public class Main {
pub... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
void getint(int &v) {
char ch, fu = 0;
for (ch = '*'; (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
;
if (ch == '-') fu = 1, ch = getchar();
for (v = 0; ch >= '0' && ch <= '9'; ch = getchar()) v = v * 10 + ch - '0';
if (fu) v = -v;
}
map<int, deque<int>... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, w, h;
int que[100050], tot, tow;
struct Node {
int g, p, t, id;
} s[100050];
int x[100050], y[100050];
inline bool operator<(const Node &a, const Node &b) {
if ((a.p - a.t) != (b.p - b.t)) return (a.p - a.t) < (b.p - b.t);
if (a.g != b.g) return a.g < b.g;
re... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
if (a < b) a = b;
}
template <typename T>
inline void getint(T &first) {
char c, sg = 0;
while (c = getchar(), (c > '9... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
const long long off = 1e5;
long long n, w, h;
vector<pair<long long, pair<long long, long long> > > g[N];
pair<long long, long long> ans[N];
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
cin >> n >> w >> h;
for... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | import java.util.*;
import java.io.*;
public class d {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int w = in.nextInt();
int h = in.nextInt();
TreeMap<Integer, ArrayList<Dancer>> mapV = new TreeMap<>();
TreeMap<... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | from collections import defaultdict
n, w, h = map(int, raw_input().split())
ending = [None] * n
dancers = [map(int, raw_input().split()) for i in range(n)]
for i in range(n):
g, p, t = dancers[i]
if g == 1:
ending[i] = (p, h)
else:
ending[i] = (w, p)
final = ending[:]
horizontal = defau... | PYTHON |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Random;
import java.util.ArrayList;
import java.util.Map;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.util.Collection;
import java.io.IOException;
import java.ut... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
vector<pair<pair<int, int>, int>> dancers[300005];
vector<pair<int, int>> end_positions[300005];
pair<int, int> result[111111];
int main() {
int N, W, H;
scanf("%d%d%d", &N, &W, &H);
for (int i = 0; i < (N); ++i) {
int g, p, t;
scan... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int n, w, h;
int G[MAXN], P[MAXN], T[MAXN];
void load() {
scanf("%d%d%d", &n, &w, &h);
for (int i = 0; i < n; i++) scanf("%d%d%d", G + i, P + i, T + i);
}
vector<int> V[3 * MAXN];
vector<pair<int, int> > Ps[3 * MAXN];
bool cmp1(int a, int b) {
... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, -1, 0, 1};
template <class T>
void inputVector(vector<T> &v, int n) {
v.resize(n);
for (int i = 0; i < v.size(); i++) cin >> v[i];
}
int n, w, h;
class Person {
public:
int x, y, g, id;
int gx, gy;
Person() {}
Person(i... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
vector<pair<pair<int, int>, int>> vert[500000], hori[500000];
void solve() {
int n, w, h;
cin >> n >> w >> h;
for (int i = 0; i < n; i++) {
int g, p, t;
cin >> g >> p >> t;
if (g == 1) {
vert[p - t + 200000].push_back(make_pair(make_pair(p, -t), i));... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
char getc() {
char c = getchar();
while ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9'))
c = getchar();
return c;
}
int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); }
int read() {
int x = 0, f = 1;
char c = getchar();
while (c... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct node {
int pos;
int id;
friend bool operator<(const node &a, const node &b) { return a.pos < b.pos; }
} ans[100005];
int n, w, h;
vector<node> v[2][200005];
int main() {
ios::sync_with_stdio(false);
cin >> n >> w >> h;
for (int i = 1, p, g, t; i <= n; i++... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Comparator;
import java.util.Collect... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
const int maxn = 2e5 + 5;
struct node {
int idx, p;
bool operator<(const node &b) const { return p < b.p; }
} ver[100005], hor[100005];
int vcnt, hcnt;
vector<node> V1[maxn], V2[maxn];
int tempx[100005], tempy[100005];
int ansx[100005], a... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v);
template <typename U, typename V>
ostream& operator<<(ostream& out, const map<U, V>& v);
template <typename U, typename V>
ostream& operator<<(ostream& out, const pair<U... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 202000;
const int mm = 101000;
int n, ans[maxn];
int W, H;
vector<int> g[maxn], g2[maxn];
struct Node {
int first, second, w, id;
} a[maxn];
bool cmp1(const Node a, const Node b) {
return a.first < b.first || (a.first == b.first && a.second < b.second);... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | //package codeforces.constructive_algorithms.cf_848_B_rooster_song;
/**
* Created by nafee on 2/14/18.
*/
import java.io.*;
import java.util.*;
public class Main {
static void redirectIO() throws IOException
{
System.setIn(new FileInputStream("input.txt"));
System.setOut(new PrintStream("... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int g[maxn], p[maxn], t[maxn], ax[maxn], ay[maxn];
vector<int> dif[maxn * 2];
bool cmp(const int &a, const int &b) {
if (g[a] != g[b])
return g[a] > g[b];
else if (g[a] == 1)
return p[a] < p[b];
else
return p[a] > p[b];
}
int main... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
template <typename T>
T gcd(T a, T b) {
return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T LCM(T a, T b) {
return a * (b / gcd(a, b));
}
template <typename T>
T expo(T base, T e, T mod) {
T res = 1;
while (e > 0) {
if (e ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, w, h;
vector<pair<int, int> > xs[200007], ys[200007];
pair<int, int> ans[200007];
int main() {
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);
if (g == 1)
ys[p - t + 100 * 1000].push_back({p,... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #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%... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
struct Node {
int x, t, id;
Node(int x = 0, int t = 0, int id = 0) : x(x), t(t), id(id) {}
bool operator<(const Node &A) const { return t < A.t; }
} X[N], Y[N];
struct Point {
int x, y;
Point(int x = 0, int y = 0) : x(x), y(y) {}
} ans[N];
... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > px[200010], py[200010];
const int N = 1e5 + 1;
pair<int, int> ans[200010], P[200010];
int main() {
int n, w, h;
cin >> n >> w >> h;
int mx = 0;
for (int i = 1; i <= n; i++) {
int g, p, t;
scanf("%d %d %d", &g, &p, &t);
if (g == 1)... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct node {
int org, g, p, t, sub, id, to;
} d[100005];
int to[100005] = {0};
int tox[100005] = {0};
int toy[100005] = {0};
int bp[100005] = {0}, bpc = 0;
int fr;
bool cmpsub(node x, node y) {
if (x.sub == y.sub) {
if (x.g == y.g) {
if (x.g == 2) return x.p ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 101000;
const int zero = 110000;
struct edge {
int x, y, index;
edge(){};
edge(int xx, int yy, int zz) {
x = xx;
y = yy;
index = zz;
}
};
struct node {
int x, y;
} b[N];
vector<edge> v[N * 3];
vector<int> t;
int e[N];
bool cmp1(const edge... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct P {
int i;
int p;
bool operator<(const P& o) const { return p < o.p; }
};
int main() {
ios::sync_with_stdio(false);
unordered_map<int, vector<P>> groups;
int n, w, h;
cin >> n >> w >> h;
vector<int> at(n);
for (int i = 0; i < n; ++i) {
int g, p,... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxN = 100005;
int n, w, h;
int g[maxN], p[maxN], t[maxN];
int u[maxN], v[maxN];
int ans[maxN];
int res[maxN];
vector<int> U;
vector<int> V;
bool compare(const int& x, const int& y) {
if (p[x] - t[x] < p[y] - t[y]) return true;
if (p[x] - t[x] > p[y] - t[y]) r... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 5;
struct dancer {
int g, p, t, no;
} D[MAXN];
int n, w, h, k;
int fp[MAXN][2];
bool comp(dancer a, dancer b) {
if ((a.p - a.t) < (b.p - b.t))
return true;
else if ((a.p - a.t) > (b.p - b.t))
return false;
else {
if (a.g != b.g)... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long MAXN = 201 * 1001, k = 1e5 + 10;
vector<pair<pair<long long, long long>, long long>> vx[MAXN], vy[MAXN];
pair<long long, long long> ans[MAXN];
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
long long n, w, h;
cin >> n >> w >> h;
for (long lo... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Set;
import java.util.HashMap;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
impor... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, h, w, tp[N], pos[N], t[N], x[N];
vector<int> vx[N], vy[N];
pair<int, int> ans[N];
bool cmp(int x, int y) { return pos[x] < pos[y]; }
int main() {
scanf("%d%d%d", &n, &w, &h);
for (int i = 1; i <= n; i++) {
scanf("%d%d%d", &tp[i], &pos[... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, w, h;
int gi[100003];
int pi[100003];
int ti[100003];
int di[100003];
map<int, vector<int> > collision;
bool cmp(int k1, int k2) {
return (gi[k1] > gi[k2] || (gi[k1] == 1 && gi[k2] == 1 && pi[k1] > pi[k2]) ||
(gi[k1] == 2 && gi[k2] == 2 && pi[k1] < pi[k2]... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline void qread(T& x) {
char c;
bool f = 0;
while ((c = getchar()) < '0' || '9' < c) f |= (c == '-');
for (x = (c ^ 48); '0' <= (c = getchar()) && c <= '9';
x = (x << 1) + (x << 3) + (c ^ 48))
;
if (f) x = -x;
}
inline int qread() {... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct pp {
long long first, second, t, k, id, fx, fy;
} vet[101010];
int n, w, h, ansx[101010], ansy[101010];
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> w >> h;
for (int(i) = (0); (i) < (n); (i)++) {
long long tp, p;
cin >> tp >> p >> vet[i]... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, w, h, i, j, x, y, z;
pair<int, int> res[233333];
vector<pair<pair<int, int>, int> > s[233333], t[233333];
int main() {
ios::sync_with_stdio(false);
;
cin >> n >> w >> h;
for (i = 1; i <= n; i++) {
cin >> x >> y >> z;
if (x == 2) {
s[y - z + 1000... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3f;
template <int MOD>
struct ModInt {
long long x;
ModInt(long long n = 0) {
n %= MOD;
if (n < 0) n += MOD;
x = n;
}
int get() const { return (int)x; }
... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | # http://codeforces.com/problemset/problem/848/B
from collections import defaultdict
def get_dest(start, w, h):
if start[0] == 1:
return (str(start[1]), str(h))
else:
return (str(w), str(start[1]))
n, w, h = [int(x) for x in input().split()]
dancers = []
groups = defaultdict(list)
destinatio... | PYTHON3 |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 5;
int w, h;
int g[maxn], p[maxn], t[maxn];
int n;
const int maxt = 4 * 100000 + 5;
vector<int> can[maxt];
const int rol = 100000;
bool cmp(int A, int B) {
if (g[A] != g[B]) return g[A] == 2;
return g[A] == 2 ? p[A] > p[B] : p[A] < p[B];
}
pair... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int big = 1e9 + 10;
const long double pai = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;
template <class T, class U>
void mineq(T& a, U b) {
if (a > b) {
a = b;
}
}
template <class T, class U>
void maxeq(... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct data {
int g, p, t, id;
} a[100100];
int n, w, h, ans[100100][2], q[100100];
int I() {
int x = 0, f = 1;
char ch = getchar();
for (; ch < '0' || ch > '9'; ch = getchar())
if (ch == '-') f = -1;
for (; ch >= '0' && ch <= '9';
x = (x << 3) + (x << ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9,
inf = 1e9 + 7;
const long long infll = 1e18 + 7;
int n, w, h;
pair<int, int> ans[N];
map<int, vector<pair<pair<int, int>, int>>> mpp;
bool cmp(pair<pair<int, int>, int> x, pair<pair<int, int>,... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, W, H, pos[N], ti[N], gi[N], idx;
pair<int, int> ans[N];
map<int, int> id;
deque<int> dq[N];
vector<int> va[N], vb;
bool cmp(int x, int y) {
if (pos[x] != pos[y]) return pos[x] < pos[y];
return ti[x] < ti[y];
}
int main() {
scanf("%d%d%d", ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputSt... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, w, h;
struct node {
int id;
int p;
bool operator<(const node& temp) const { return p < temp.p; }
};
map<int, vector<node> > group;
int ans[N];
int main() {
cin >> n >> w >> h;
for (int i = 1; i <= n; i++) {
int g, p, t;
scanf(... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, w, h, g[maxn], p[maxn], t[maxn];
pair<int, int> ans[maxn];
vector<int> xv, yv, res, v[2 * maxn];
bool cmp(const int u, int v) {
if (g[u] != g[v])
return g[u] == 2;
else
return g[u] == 2 ? p[u] > p[v] : p[u] < p[v];
}
int main() ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, w, h;
struct dancer {
int x, y, t, it;
dancer() {}
dancer(int x, int y, int t, int it) : x(x), y(y), t(t), it(it) {}
};
vector<dancer> hor, ver, alld;
deque<int> ho[250000];
vector<int> hoinit[250000];
int add = 125000;
bool cmp(const dancer &lhs, const dancer ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, w, h;
struct node {
int p, t, dir, key, endx0, endx1, endy0, endy1, id;
} a[100005];
int cmp_id(node a, node b) { return a.id < b.id; }
int cmp(node a, node b) {
return ((a.key != b.key)
? (a.key < b.key)
: ((a.dir != b.dir) ? (a.dir <... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const double PI = acos(-1.0);
const int oo = 0x3f3f3f3f;
long long read() {
long long d, f = 1;
char c;
while (!isdigit(c = getchar()))
if (c == '-') f = -1;
d = c ^ '0';
while (isdigit(c = getchar())) d = (d * 10) + (c ^ '0');
retur... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int n, w, h, g[100005], p[100005], t, st1[100005], st2[100005];
pair<int, int> ans[100005];
inline pair<int, int> cal(int x) {
if (g[x] == 1) return {p[x], h};
return {w, p[x]};
}
vector<int> v[100005 << 1];
bool cmp1(int x, int y) {
return g[x] == g[y] ? g[x] == 1 ? ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pii = pair<int, int>;
using pll = pair<lint, lint>;
template <typename T>
using vc = vector<T>;
template <typename T>
using vvc = vector<vector<T>>;
template <typename T>
inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
int n, w, h, g[100005], p[100005], t[100005];
std::pair<int, int> s[100005], e[100005];
std::vector<int> l[200005];
bool cmp1(int x, int y) {
if (s[x].first > 0 && s[y].first > 0) return s[x].second > s[y].second;
if (s[x].first > 0 || s[y].first > 0) return s[y].first > 0;
return s[x].fi... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int inf = 1000000005;
const int sz = 100000 + 5;
int x[sz], y[sz];
int n;
map<int, vector<int> > group;
int ansx[sz], ansy[sz];
struct sortx {
bool operator()(const int a, const int b) const {
if (x[a] == x[b]) throw 2;
return x[a] < x[b];
}
};
int w, h;
v... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename S, typename T>
void xmin(S &a, T const &b) {
if (b < a) a = b;
}
template <typename S, typename T>
void xmax(S &a, T const &b) {
if (b > a) a = b;
}
signed main() {
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(false);... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, w, h;
bool vis[N];
struct node {
int op, p, t, res;
} a[N];
map<int, vector<int> > mp;
bool cmp1(int x, int y) {
if (a[x].op != a[y].op) return a[x].op < a[y].op;
if (a[x].op == 1)
return a[x].p > a[y].p;
else
return a[x].p < a... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct D {
int l, t, id;
};
unordered_map<int, vector<D>> H, V;
unordered_map<int, int> id_shift;
pair<int, int> ans[(int)1e5];
int main() {
ios::sync_with_stdio(0);
int n, w, h;
cin >> n >> w >> h;
for (int i = 0; i < int(n); i++) {
int a, b, c;
cin >> a ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
const int N = 100000;
int n, w, h;
int p[MAXN], t[MAXN];
vector<int> pos[MAXN << 1][2];
pair<int, int> ans[MAXN];
inline bool cmp(int x, int y) {
return p[x] ^ p[y] ? p[x] < p[y] : t[x] < t[y];
}
int main() {
scanf("%d%d%d", &n, &w, &h);
int m... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const int MAX = 1e5 + 5;
const int MAX_N = MAX;
const long long MOD = 998244353;
const long double pi = acos(-1.0);
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
int main() {
int n, dim[2];
std::cin >> n >> dim[0] >> dim[1];
int fin[n][2];
std::vector<std::pair<int, std::pair<int, int> > > cat[300000];
std::vector<std::vector<int> > len(300000, std::vector<int>(2, 0));
for (int i = 0; i < n; i++) {
int g, p, t;
std::cin >> g >> p >> ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | /*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, Iβm sorry, but shit, I have no fcking inter... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
const int mod = 1000000007;
const int inf = 1 << 29;
int n, w, h;
void work() {
char str[303];
int ck[303][303];
int dp[303][303][303];
int idx, icase = 0;
scanf("%d", &idx);
while (idx--) {
scanf("%s", str);
int n = strlen(str);... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T>
inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
const double EPS = 1e-10;
const double... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
int n, w, h;
cin >> n >> w >> h;
vector<pair<pair<int, int>, pair<int, int> > > a;
for (int i = 0; i < n; i++) {
int first, second, z;
cin >> first >> second >> z;
z -= second;
a.push_back(make_pa... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > m[200200];
vector<pair<int, int> > finish[200200];
pair<int, int> ans[100100];
bool cmp(pair<int, int> a, pair<int, int> b) {
return a.first - a.second < b.first - b.second;
}
int main() {
int n, w, h;
cin >> n >> w >> h;
for (int i = 0; i < ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | n,w,h = map(int,input().split())
D = []
original = []
for i in range(n):
g,p,t = map(int,input().split())
a = p-t
p = p if g == 1 else -p
original.append(())
D.append((a,p,i))
D.sort()
from bisect import bisect
res = [None]*n
i = 0
while i < len(D):
a = D[i][0]
j = bisect(D, (a+1,-n,0), lo=i)
... | PYTHON3 |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, w, h;
cin >> n >> w >> h;
map<int, vector<vector<int>>> mp;
vector<int> g(n), p(n), t(n);
vector<pair<int, int>> final(n);
for (int i = 0; i < n; ++i) {
cin >> g[i] >> p[i] >> t[i];
mp[p[i] - t... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;
int a, b, c, d, n, m, k, w, h;
pair<int, int> orig[100002], en[100002];
vector<pair<pair<int, int>, int>> tx, ty;
pair<int, int> ans[100002];
int rp[100002];
int main() {
scanf("%d%d%... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 9;
int N, w, h, p[maxn], g[maxn], Id[maxn], t[maxn];
pair<int, int> ans[maxn];
int main() {
cin >> N >> w >> h;
for (int i = 0; i < N; i++) {
scanf("%d%d%d", g + i, p + i, t + i);
Id[i] = i;
}
sort(Id, Id + N,
[](const int &l... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct dancer {
int p, t, ind;
bool operator<(const dancer& x) const {
return t < x.t || t == x.t && p < x.p;
}
};
int main() {
ios_base::sync_with_stdio(false);
int n, w, h;
cin >> n >> w >> h;
int maxT = (int)1e5;
vector<vector<dancer>> x[2];
for (in... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7, tot = 3 * maxn, disp = 1e5 + 1;
vector<pair<int, int> > mv[tot], mh[tot];
int ans[maxn], polarity[maxn], n, w, h, g, p, t;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
cin >> n >> w >> h;
for (int i = ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
const int M = 1000000007;
const double PI = atan(1) * 4;
const int oo = 1000000000;
int n, w, h, ans[N], gt[N];
pair<int, int> an[N];
vector<int> dif[2][2 * N], pt[2][2 * N];
vector<pair<pair<int, int>, int> > v[2];
int main() {
cin >> n >> w >>... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.Map.Entry;
import java.io.BufferedReader;
impo... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1000000007;
template <typename T, typename U>
std::istream& operator>>(std::istream& i, pair<T, U>& p) {
i >> p.first >> p.second;
return i;
}
template <typename T>
std::istream& operator>>(std::istream& i, vector<T>& t) {
for (auto& v : t) {
i... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
struct node {
int x, y, id;
} a[N], b[N], ans[N];
inline int cmp(node A, node B) {
return (A.x + A.y == B.x + B.y) ? (A.x < B.x) : (A.x + A.y < B.x + B.y);
}
inline int cmp2(node A, node B) {
return (A.x == B.x) ? (A.y > B.y) : (A.x < B.x);
}
in... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
pair<int, int> ans[maxn];
int main() {
unordered_map<int, vector<pair<int, int>>> mpx, mpy;
int n, w, h;
cin >> n >> w >> h;
for (int i = 1; i <= n; i++) {
int g, p, t;
cin >> g >> p >> t;
if (g == 1) {
mpx[p - t].push_back... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, w, h;
struct Node {
int g, p, t, _id;
bool operator<(const Node &n) const { return p < n.p; }
} a[maxn];
map<int, deque<int> > mp;
int idx[maxn], ax[maxn], ay[maxn];
void doit(int g1, int g2) {
mp.clear();
for (int i = 1; i <= n; i+... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, w, h, to[N], cnt = 0;
struct people {
int x, y, id, op;
};
struct answer {
int x, y;
} ans[N];
vector<people> a, b;
bool cmp1(people p1, people p2) { return p1.y < p2.y; }
bool cmp2(people p1, people p2) { return p1.x < p2.x; }
namespace su... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.LinkedList;
import java.util.Collections;
import java.util.ArrayList;
import java.io.InputStrea... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
struct dancer {
int type;
int t;
int x;
int num;
dancer(int type = 0, int t = 0, int x = 0, int num = 0)
: type(type), t(t), x(x), num(num) {}
};
deque<int> deqs[MAXN * 2];
vector<int> ansy[MAXN * 2];
vector<pair<int, int> > ans;
ve... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXD = 200000;
const int MAXN = 100000;
vector<pair<int, int> > vecX[MAXD + 10], vecY[MAXD + 10];
int respx[MAXN + 10], respy[MAXN + 10], w, h;
int p[MAXN + 10], g[MAXN + 10], t[MAXN + 10], n;
int main() {
scanf("%d%d%d", &n, &w, &h);
for (int i = 1; i <= n; i... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
if (a == 0) return b;
return gcd(b % a, a);
}
template <typename T>
T pow(T a, T b, long long m) {
T ans = 1;
while (b > 0) {
if (b % 2 == 1) ans = ((ans % m) * (a % m)) % m;
b /= 2;
a = ((a % m) * (a % m)) % m;
... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
#pragma GCC optimize(2)
const int maxn = 1e5 + 5;
std::map<int, std::vector<int> > Reading;
struct Walk {
int p, t, dir;
int id;
} M[maxn];
int n, w, h;
int ansx[maxn], ansy[maxn];
inline bool Comp(int Alpha, int Beta) { return M[Alpha].p > M[Beta].p; }
int main() {
scanf("%d%d%d", &n, &w... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
int g[100010], p[100010], t[100010], finalPoint[100010];
map<int, vector<pii>> points;
void addPoint(int x, int y, int id) { points[x + y].emplace_back(x, id); }
int main() {
int n, w, h, i, mid, diff, sgn;
cin >> n >> w... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int A[100001][3];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
int w, h;
cin >> n >> w >> h;
unordered_map<int, vector<int>> left, right;
for (int i = 1; i <= n; ++i) {
cin >> A[i][0] >> A[i][1] >> A[i][2];
if (A[i][0] == 1)
righ... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
queue<int> q[200005], qs[200005];
int ans[100005][2];
int cnt1 = 0, cnt2 = 0, n, h, w;
struct node {
int pos, t, id;
} a[100005], b[100005];
inline int read() {
int x = 0;
char c = getchar();
while (c < '0' || c > '9') c = getchar();
while (c >= '0' && c <= '9') x... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;
import java.util.StringTokenizer;
p... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, w, h;
int g[N], p[N], t[N];
pair<int, int> ans[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> w >> h;
map<int, vector<int> > ma;
for (int i = (0); i < (n); i++) {
cin >> g[i] >> p[i] >> t[i];
ma[p[i] - t... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:32000000")
const int nil = -1;
using namespace std;
inline bool read(int& val) { return scanf("%d", &val) != -1; }
inline bool read(long long& val) { return scanf("%I64d", &val) != -1; }
inline bool read(double& val) { return scanf("%lf", &val) != -1; }
inline bo... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, h, w, tp[N], pos[N], t[N], x[N];
vector<int> vx[N], vy[N];
pair<int, int> ans[N];
bool cmp(int x, int y) { return pos[x] < pos[y]; }
int main() {
scanf("%d%d%d", &n, &w, &h);
for (int i = 1; i <= n; i++) {
scanf("%d%d%d", &tp[i], &pos[... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import... | JAVA |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct Dancer {
int coord;
int t;
int id;
bool operator<(const Dancer& d) const { return coord < d.coord; }
};
int n, w, h;
vector<Dancer> vers;
vector<Dancer> hors;
bool read() {
if (scanf("%d%d%d", &n, &w, &h) < 3) {
return 0;
}
vers.clear();
hors.clea... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int n, w, h;
struct Node {
int id, pos, ti;
int ansx, ansy;
} x[MAXN], y[MAXN];
int tx, ty;
struct Node2 {
int x, y;
} ans[MAXN];
bool cmp1(Node a, Node b) { return a.pos < b.pos; }
bool cmp2(Node a, Node b) { return a.pos > b.pos; }
map<int,... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
class UnionFind {
private:
vector<int> p, rank;
public:
UnionFind(int N) {
rank.assign(N + 1, 0);
p.assign(N + 1, 0);
for (int i = 0; i <= N; i++) p[i] = i;
}
int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
bool isSameSet(int... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
static inline void canhazfast() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
template <typename T>
T gcd(T a, T b) {
return b ? gcd(b, a % b) : a;
}
template <typename T>
T extgcd(T a, T b, T &x, T &y) {
T x0 = 1, y0 = 0, x1 = 0, y1 =... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
struct dancer {
int p, t, ind;
dancer() = default;
bool operator<(const dancer& x) const {
return t < x.t || t == x.t && p < x.p;
}
};
int main() {
ios_base::sync_with_stdio(false);
int n, w, h;
cin >> n >> w >> h;
vector<dancer> ver, hor;
ver.reserve(... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 100;
vector<int> ver[MAXN];
int g[MAXN], p[MAXN], t[MAXN];
pair<int, int> res[MAXN], ans[MAXN];
bool cmp1(int a, int b) {
if (g[a] != g[b]) return g[a] > g[b];
return (p[a] < p[b]) ^ (g[a] == 1);
}
bool cmp2(int a, int b) {
if (g[a] != g[b]) ret... | CPP |
848_B. Rooter's Song | 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 collisions will happen before one enters the stage.
On the sides of t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 10;
int g[MAXN], p[MAXN], t[MAXN];
map<int, int> mp;
vector<int> gg[MAXN];
pair<int, int> ans[MAXN];
int n, w, h;
int cmp(int a, int b) {
if (g[a] < g[b]) return 1;
if (g[a] > g[b]) return 0;
if (g[a] == 1) return p[a] < p[b];
return p[a] >... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.