prompt string | response string |
|---|---|
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n, m, c, c0;
cin >> n >> m >> c >> c0;
vector<tuple<int, int, int>> ppl(n);
for (auto& [t, a, b] : ppl) {
cin >> t >> a >> b;
}
sort(ppl.begin(), ppl.end());
ppl.emplace_back(m, 0, 1e9);
multiset<pair<int, int>> c... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int MX = 6e5;
int q;
long long n, m, cmax, c;
long long t[MX], a[MX], b[MX], T[MX], A[MX], B[MX], SA[MX];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> q;
while (q--) {
cin >> n >> m >> cmax >> c;
for (int i = int(0); i < int(n);... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = (int)5e5 + 7;
int n;
long long m, c, c0;
struct Friend {
long long t, a, b;
void read() { scanf("%lld%lld%lld", &t, &a, &b); }
bool operator<(const Friend &rhs) const { return t < rhs.t; }
} f[N];
long long go() {
long long cost = 0;
long long have =... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int inf = 2147483647;
const int N = 5e5 + 1;
int _max(int x, int y) { return x > y ? x : y; }
int _min(int x, int y) { return x < y ? x : y; }
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
int q;
int n, m, c, c0;
struct node {
int t, a, b;
} f[500100];
int cmp(const node& c, const node& d) { return c.t < d.t; }
int main() {
scanf("%d", &q);
while (q--) {
scanf("%d%d%d%d", &n, &m, &c, &c0);
for (int i = 0; i < n; i++) {
scanf("%d %d %d", &f... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
struct node {
long long a, b;
bool operator<(const node& y) const {
return a < y.a || (a == y.a && b < y.b);
}
} h;
struct stu {
long long t, a, b;
} s[500005];
long long q, _, tv, n, i, m, c, sum = 0, mr, c0, kc, ans = 0;
multiset<node> st;
multiset<node>::iter... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
long long st[4 * 500005];
long long base[500005];
long long lazy[4 * 500005];
long long get(int node) { return lazy[node] + st[node]; }
void push(int node) {
lazy[(node + node)] += lazy[node];
lazy[(node + node + 1)] += lazy[node];
lazy[node] = 0;
}
void stc(int node,... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
const int N = 500005;
int n, m, c, c0, ret[N], w[N], cap[N];
struct data {
int t, x, y;
} a[N];
std::priority_queue<std::pair<int, int> > que;
struct tree {
int mn, tag;
} t[N * 4];
bool cmp(data a, data b) { return a.t < b.t; }
void updata(int d) { t[d].mn = std::min(t[d << 1].mn, t[d << 1... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
char buffer[100000], *p1, *p2;
template <class T>
void read(T& x) {
char ch = ((p1 == p2 &&
(p2 = (p1 = buffer) + fread(buffer, 1, 100000, stdin), p1 == p2))
? EOF
: *p1++);
x = 0;
bool f = 1;
while (!('0' <= ch && ch ... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
using LL = int64_t;
constexpr int INF = 1e9;
constexpr LL INFLL = 1e18;
struct Node {
int mx, lazy;
};
Node t[1 << 20];
vector<int> v;
void pushDown(int p) {
t[2 * p].mx += t[p].lazy;
t[2 * p].lazy += t[p].lazy;
t[2 * p + 1].mx += t[p].lazy;
t[2 * p + 1].lazy += t... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
struct data {
int pos, c, cnt;
} p[550000];
struct data1 {
int cnt, c;
} m1, mid;
bool operator<(data1 a, data1 b) { return a.c < b.c; }
multiset<data1> q;
int tt, n, m, c, res, x, m2, flag;
long long ans;
int cmp(data a, data b) { return a.pos < b.pos; }
int main() {
... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | // https://codeforces.com/contest/1238/submission/62151468 (rainboy)
import java.io.*;
import java.util.*;
public class CF1238G extends PrintWriter {
CF1238G() { super(System.out); }
static class Scanner {
Scanner(InputStream in) { this.in = in; } InputStream in;
int k, l; byte[] bb = new byte[1 << 15];
byte g... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | import java.io.*;
import java.util.*;
public class G implements Runnable {
public static void main (String[] args) {new Thread(null, new G(), "_cf", 1 << 28).start();}
public void run() {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
System.err.println("");
int T = fs.n... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
const long long mod = (long long)1e9 + 7;
const double eps = (double)1e-9;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 500500;
struct node {
int t, a, b;
} a[N];
b... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
template <typename T>
inline T read() {
T ans = 0, flag = 1;
char c = getchar();
while (!isdigit(c)) {
if (c == '-') flag = -1;
c = getchar();
}
while (isdigit(c)) {
ans = ans * 10 + c - 48;
c = getchar();
}
return an... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const long long N = 5e5 + 5;
long long a[N], b[N], t[N], p[N], inv[N], ans, lst, val, n, m, C;
vector<long long> Time, vec[N];
struct Node {
long long Cnt, Lazy, Sum;
} seg[N << 2];
void InitSeg(long long L = 0, long long R = n + 1, long long id = 1) {
seg[id].Cnt = 0, ... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
class myfriend {
public:
long long t, a, b;
};
bool cmp(myfriend& a, myfriend& b) { return a.t < b.t; }
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
long long n, m, c, c0;
cin >> n >> m >> c >> c0;
vector<myfr... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18 + 1;
struct Line {
ll len;
ll a;
};
bool operator<(const Line& lhs, const Line& rhs) {
return lhs.a < rhs.a || lhs.a == rhs.a && lhs.len < rhs.len;
};
struct Friend {
ll t;
ll a, b;
};
bool operator<(const Friend& lhs, con... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int arr = 2e5 + 10;
const int ar = 2e3 + 10;
const long double pi = acos(-1);
const long double eps = 1e-10;
const long long md = 1e9 + 7;
int t[(int)(2e6 + 10)];
int a[(int)(2e6 + 10)];
int b[(int)(2e6 + 10)];
vector<int> vh[(int)(2e6 + 10)];
int tt[(int)(2e6 + 10)];... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
long long solve() {
int n, m, c, c0;
cin >> n >> m >> c >> c0;
vector<pair<int, pair<int, int>>> P;
for (int i = 0; i < n; i++) {
int t, a, b;
cin >> t >> a >> b;
P.emplace_back(t, make_pair(b, a));
}
P.emplace_back(m, make_pair(0, 0));
sort(P.begi... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
template <typename C>
void clr(C& q, C& dq) {
while (!dq.empty() && dq.top() == q.top()) {
q.pop();
dq.pop();
}
}
void solve() {
int n, m, c, c0;
scanf("%d%d%d%d", &n, &m, &c, &c0);
long long ans = 0;
priority_queue<pair<int, int>> q, dq;
priority_queu... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(0);
std::cin.tie(0);
int ntest;
std::cin >> ntest;
struct Friend {
int time, amt, cost;
};
std::vector<Friend> frs;
while (ntest--) {
int n, n_min, c0, c;
std::cin >> n >> n_min >> c >> c0;
frs.reserve(n + 1);
frs.resize... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n, m, c, c0;
cin >> n >> m >> c >> c0;
multiset<pair<int, int> > st;
st.insert({0, c0});
int cp = c0;
vector<vector<int> > v(n + 1)... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 550000;
struct Data {
int t, a, b;
Data(int t = 0, int a = 0, int b = 0) : t(t), a(a), b(b) {}
bool operator<(const Data &d) const { return b < d.b; }
} P[N];
multiset<Data> S;
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int tcas... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int C = 26;
void add(int &x, int y) {
x += y;
while (x >= MOD) x -= MOD;
while (x < 0) x += MOD;
}
int fix(int x) {
while (x >= MOD) x -= MOD;
while (x < 0) x += MOD;
return x;
}
int pw(int a, int b) {
int ret = 1;
while (b) {
... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 500 * 1000 + 13;
int n, m, c, c0;
pair<int, pair<int, int> > a[N];
long long solve() {
scanf("%d%d%d%d", &n, &m, &c, &c0);
for (int i = 0; i < int(n); ++i)
scanf("%d%d%d", &a[i].first, &a[i].second.first, &a[i].second.second);
a[n++] = make_pair(m, m... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
inline int rd() {
int x = 0;
char c = getchar();
bool f = 0;
while (c < '0' && c != '-') c = getchar();
if (c == '-') f = 1, c = getchar();
while (c >= '0') x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
return f ? -x : x;
}
const int SIZE = 5e5 + 100;
int... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
int const N = 500100;
int n, m, c, c0;
vector<int> mp;
priority_queue<pair<int, int> > q;
struct F {
int t, a, b, mp;
F() {}
void sc() { scanf("%d%d%d", &t, &a, &b); }
bool operator<(F const &o) const { return t < o.t; }
} fr[N + 1];
struct S {
long long mx, z;
... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 500005;
int n, m, c, w, t, a, b, q, cur;
struct SNode {
int c;
mutable int w;
SNode(int _c = 0, int _w = 0) : c(_c), w(_w) {}
inline bool operator<(const SNode &oth) const { return c < oth.c; }
};
vector<pair<int, SNode>> ve;
multiset<SNode> second;
lo... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 500 * 1000 + 1;
int n, m, c, c0;
pair<int, pair<int, int> > a[N];
long long solve() {
scanf("%d%d%d%d", &n, &m, &c, &c0);
for (int i = 0; i < int(n); ++i)
scanf("%d%d%d", &a[i].first, &a[i].second.first, &a[i].second.second);
a[n++] = make_pair(m, ma... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 500005;
int n, m, c, c0;
int t[N], a[N], b[N];
int id[N];
ll f() {
iota(id, id + n, 0);
sort(id, id + n, [](int i, int j) { return t[i] < t[j]; });
ll sum = 0;
multiset<pair<int, int>> s;
int last = 0;
ll ans = 0;
id[n] = n,... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int NN = 500100;
pair<int, pair<int, int> > p[NN];
multiset<pair<int, int> > st;
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n, m, c, c0;
scanf("%d%d%d%d", &n, &m, &c, &c0);
for (int i = 1; i <= n; i++)
scanf("%d%d%d", &p[i].first, &... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 666666, M = 11111111;
long long MOD = 998244353, inv2 = (MOD + 1) / 2;
long double eps = 1e-8;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
long double pi = acos(-1.0L);
int read() {
int v = 0, f = 1;
char c = getchar();
while (c < 48 || 57 < c)... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 15;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
int n, m, c, c0;
map<long long, long long> ma;
long long tot;
long long ans = 0;
bool f;
void ins(long long liter, long long val) {
long long emp = c - tot;
long long aa = min(emp, liter);
... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
multiset<pair<int, int>> P;
vector<tuple<int, int, int>> F;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
((void)0);
((void)0);
((void)0);
int T, N, M, C0, C, ct;
for (cin >> T; T--;) {
long long ans = ct = 0;
cin >> N >> M... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 500005;
const int INF = 1000000007;
long long q, n, m, c, c0, ofs;
long long t[MAXN], ost[MAXN], p[MAXN], r[MAXN];
long long tr[MAXN * 4], prop[MAXN * 4];
set<pair<long long, int> > st;
vector<pair<int, pair<int, int> > > v;
vector<int> saz;
void propagate(... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
const int N = 500500;
using namespace std;
int n;
int m;
int c;
int c0;
int st[N];
int t[4 * N];
int shit[4 * N];
vector<pair<int, pair<int, int> > > a;
void push(int x) {
if (shit[x]) {
t[x * 2] += shit[x];
shit[x * 2] += shit[x];
t[x * 2 + 1] += shit[x];
shit[x * 2 + 1] += s... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 23;
int n, m, T, ans, c, c1, t;
int st[maxn << 2], add[maxn << 2];
void pushup(int o) { st[o] = max(st[o << 1], st[o << 1 | 1]); }
void puttag(int o, int l, int r, int v) {
add[o] += v;
st[o] += v;
}
void pushdown(int o, int l, int r) {
if (add[... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
struct info {
int t, a, b;
bool operator<(const info& o) const { return t < o.t; }
};
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int q;
cin >> q;
while (q--) {
int n, m, c0, c;
cin >> n >> m >> c >> c0;
vector<info> a(n);
for (auto& i... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
int seg[N << 2], lz[N << 2];
int q, n, m, c, c0, k, t[N];
set<pair<int, int>> s;
vector<int> vec[N];
long long ans;
struct Friend {
int a, b, t;
} f[N];
inline void add(int id, int x) { seg[id] += x, lz[id] += x; }
inline void shift(int id) {
add(... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
struct Val {
int t, a, b;
} v[500010];
bool cmp(Val a, Val b) { return a.t < b.t; }
map<int, int> s;
long long solve() {
s.clear();
int n, m, c, sum;
scanf("%d %d %d %d", &n, &m, &c, &sum);
for (int i = 1; i <= n; i++) scanf("%d %d %d", &v[i].t, &v[i].a, &v[i].b);... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 500 * 1000 + 13;
int n, m, c, c0;
pair<int, pair<int, int> > a[N];
long long solve() {
scanf("%d%d%d%d", &n, &m, &c, &c0);
for (int i = 0; i < int(n); ++i)
scanf("%d%d%d", &a[i].first, &a[i].second.first, &a[i].second.second);
a[n++] = make_pair(m, m... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int q;
cin >> q;
while (q--) {
int n, m, c, c0;
cin >> n >> m >> c >> c0;
map<int, vector<pair<int, int> > > stops;
for (int i = 0; i < n; i++) {
int t;
pair<int, int> ab;
cin ... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
using namespace std;
namespace ywy {
inline int get() {
int n = 0;
char c;
while ((c = getchar()) || 23333)
if (c >= '0' && c <= '9') break;
n = c - '0';
while ((c = getchar()) || 23333) {
if (c >= '... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1110000;
const int inf = int(1e9 + 7);
struct item {
int t, a, b;
} A[maxn];
bool operator<(const item& x, const item& y) { return x.t < y.t; }
int main() {
int T;
scanf("%d", &T);
while (T--) {
int n, m, c, c0;
scanf("%d %d %d %d", &n, &m, ... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
bool ckmin(T& a, const T& b) {
return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epo... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int64_t INF = (1 << 30) - 1;
const long long oo = (1ll << 62) - 1;
const long double PI = 3.1415926535898;
const int64_t N = 5 * 100000 + 5;
int64_t q;
int64_t n, m, c, c0;
pair<int64_t, pair<int64_t, int64_t> > a[N];
multiset<pair<int64_t, int64_t> > ms;
void solve()... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
using ld = long double;
using ll = long long;
template <typename T, typename Z>
inline T power(T base, Z exponent) {
T ret = 1;
for (; exponent > 0; exponent >>= 1, base *= base)
if (exponent & 1) ret *= base;
return ret;
}
template <typename Z>
Z gcd(const Z& a, ... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
template <class TH>
void _dbg(const char *sdbg, TH h) {
cerr << sdbg << '=' << h << endl;
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
while (*sdbg != ',') cerr << *sdbg++;
cerr << '=' << h << ',';
_dbg(sdbg + 1, a...);
}
template ... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
long long solve() {
struct tab {
int t, a, b;
};
int n, m, c, c0;
cin >> n >> m >> c >> c0;
vector<tab> friends(n);
for (int i = 0; i != n; ++i)
cin >> friends[i].t >> friends[i].a >> friends[i].b;
sort(friends.begin(), friends.end(),
[](const t... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
struct black_heart_friend {
long long limit, arr_time, cost;
};
bool operator<(black_heart_friend f1, black_heart_friend f2) {
return f1.arr_time < f2.arr_time;
}
long long n, m, capacity, c0;
black_heart_friend fr[500500];
multiset<pair<long long, long long> > st;
long... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
template <class T>
using v2d = vector<vector<T>>;
template <class T>
bool uin(T &a, T b) {
return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
return a < b ? (a = b, true) : false;
}
mt19937 rng(chrono::system_clock::now().time_since_epoch()... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int sz = 5e5 + 10, inf = 2e9;
struct el {
int t, in, a, b;
};
bool comp(el a, el b) { return a.t < b.t; }
el ar[sz];
bool comp2(int a, int b) { return ar[a].b < ar[b].b; }
int n, m, c, cu, dot[sz * 4], add[sz * 4];
void push(int nu) {
add[nu * 2] += add[nu];
add... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 500005;
struct Man {
int t, a, b;
bool operator<(const Man &m) const { return t < m.t; }
};
int N, M, C0, C;
map<int, int> dp;
Man ms[MAXN];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int T;
cin >> T;
while (T--) {
dp.clear();
... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 5;
struct Node {
int t, a, b;
} p[MAXN];
inline bool cmp(const Node &p, const Node &q) { return p.t < q.t; }
void solve(void) {
int n, m, c, beg;
scanf("%d%d%d%d", &n, &m, &c, &beg);
for (int i = 1; i <= n; ++i) scanf("%d%d%d", &p[i].t, &p[i].... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
struct segment_change {
int to_add;
segment_change(int _to_add = 0) : to_add(_to_add) {}
void reset() { to_add = 0; }
bool has_change() const { return to_add != 0; }
segment_change combine(const segment_change &other) const {
return se... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int arr = 2e5 + 10;
const int ar = 2e3 + 10;
const long double pi = acos(-1);
const long double eps = 1e-10;
const long long md = 1e9 + 7;
int t[(int)(5e5 + 10)];
int a[(int)(5e5 + 10)];
int b[(int)(5e5 + 10)];
vector<int> vh[(int)(5e5 + 10)];
int tt[(int)(5e5 + 10)];... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e18;
const int mod = (int)1e9 + 7;
const int MAXN = (int)5e5 + 5;
long long n, m, c, c0;
struct fr {
long long t, a, b;
bool operator<(fr other) const { return t < other.t; }
} fr[MAXN];
void solve() {
cin >> n >> m >> c >> c0;
for ... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void Read(T &t) {
int c = getchar(), f = 0;
for (; c < '0' || c > '9'; c = getchar()) f = (c == '-');
for (t = 0; c >= '0' && c <= '9'; c = getchar())
t = (t << 3) + (t << 1) + (c ^ 48);
if (f) t = -t;
}
const int N = 5e5 + 5;
int te... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
int t, n, m, c, cur;
long long ans;
struct node {
int t, a, b;
node(int t = 0, int a = 0, int b = 0) : t(t), a(a), b(b) {}
} a[500005];
map<int, int> q;
int read() {
char c = getchar();
int x = 0;
while (!isdigit(c)) c = getchar();
while (isdigit(c)) {
x = (... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
template <typename T>
inline void Read(T &t) {
int c = getchar(), f = 0;
for (; c < '0' || c > '9'; c = getchar()) f = (c == '-');
for (t = 0; c >= '0' && c <= '9'; c = getchar())
t = (t << 3) + (t << 1) + (c ^ 48);
if (f) t = -t;
}
const... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
multiset<pair<int, int> > q;
int n, m, c, c0, T;
struct note {
int t, x, v;
} a[500005];
bool cmp(note x, note y) { return x.t < y.t; }
void work() {
long long ans = 0;
scanf("%d%d%d%d", &n, &m, &c, &c0);
int now = c0;
q.insert(make_pair(0, c0));
for (int i = 1;... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 500005;
int T, N, M, C, OG;
pair<int, pair<int, int>> arr[maxn];
map<int, int> cnt;
map<int, vector<pair<int, int>>> tmp;
long long res;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> T;
while (T--) {
res = 0;
cnt.clear();
tmp.... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 3;
inline char gc() {
static char buf[1 << 21], *S = buf, *T = buf;
return S == T && (T = (S = buf) + fread(buf, 1, 1 << 21, stdin), S == T)
? EOF
: *S++;
}
template <typename T>
inline void Rdn(T& A) {
static char ch;
A... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 500003;
struct Fend {
int t, a, b;
} f[N];
int q, n, m, c, c0;
long long ans, sum;
map<int, long long> tk;
bool cmp(Fend x, Fend y) { return x.t < y.t; }
void Add(long long lit, long long cst) {
tk[cst] += lit;
sum += lit;
while (sum > c) {
long lo... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
template <typename T>
T MAX(T a, T b) {
return (a > b) ? a : b;
}
template <typename T>
T MIN(T a, T b) {
return (a < b) ? a : b;
}
template <typename T>
void UMAX(T &a, T b) {
a = (a > b ? a : b);
}
template <typename T>
void UMIN(T &a, T b) {
a = (a < b ? a : b);
... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
template <class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& p) {
return o << "(" << p.first << "," << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& vc) {
o << "{";
for (const T& v : vc) o << v << ",";
o << "... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long x = 0, f = 1;
char c = getchar();
for (; !isdigit(c); c = getchar())
if (c == '-') f = -1;
for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
return x * f;
}
const long long INF = 2147483600;
const long long MAXN = 5000... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const long long maxn = 500500;
long long n, m, c, c0;
long long t[maxn], a[maxn], b[maxn];
long long I[maxn];
long long ans;
bool cmp(long long i, long long j) { return t[i] < t[j]; }
long long solve() {
cin >> n >> m >> c >> c0;
for (long long i = 0; i < n; i++) cin >>... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 500 * 1000 + 13;
int n, m, c, c0;
pair<int, pair<int, int> > a[N];
long long solve() {
scanf("%d%d%d%d", &n, &m, &c, &c0);
for (int i = 0; i < int(n); ++i)
scanf("%d%d%d", &a[i].first, &a[i].second.first, &a[i].second.second);
a[n++] = make_pair(m, m... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
int TC;
int N, M, C;
struct person {
int t, a, b;
} p[500002];
struct node {
int price, amount;
};
struct smaller {
inline bool operator()(const node &a, const node &b) {
return a.price < b.price || a.price == b.price && a.amount < b.amount;
}
};
struct bigger {
inline bool operat... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int MaxN = 5e5;
const int Inf = 1 << 30;
struct node {
long long v, w, tim;
} P[MaxN + 5];
bool cmp(node A, node B) { return A.tim == B.tim ? A.w < B.w : A.tim < B.tim; }
map<long long, long long> mp;
map<long long, long long>::iterator Head;
map<long long, long lon... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int q;
cin >> q;
while (q--) {
int n, m, c, c0;
cin >> n >> m >> c >> c0;
map<int, int> M;
M[0] = c0;
vector<pair<int, pair<int, int> > > event;
for (int i = 1, t, a, b; i <= n; i++) {
... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
template <class T>
inline bool cmax(T& a, const T& b) {
return a < b ? a = b, 1 : 0;
}
template <class T>
inline bool cmin(T& a, const T& b) {
return a > b ? a = b, 1 : 0;
}
using namespace std;
char ss[1 << 17], *A = ss, *B = ss;
inline char gc() {
return A == B && (B = (A = ss) + fread(... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
int Q;
int N, M, C, C0;
int T[505050], A[505050], B[505050];
void solve() {
int i, j, k, l, r, x, y;
string s;
scanf("%d", &Q);
while (Q--) {
scanf("%d%d%d%d", &N, &M, &C, &C0);
vector<vector<int>> ev;
for (i = 0; i < (N); i++) {
scanf("%d%d%d", &T... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int arr = 2e5 + 10;
const int ar = 2e3 + 10;
const long double pi = acos(-1);
const long double eps = 1e-10;
const long long md = 1e9 + 7;
int t[(int)(2e6 + 10)];
int a[(int)(2e6 + 10)];
int b[(int)(5e5 + 10)];
vector<int> vh[(int)(5e5 + 10)];
int tt[(int)(5e5 + 10)];... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const long long LLINF = 1000000000000000001;
const int maxn = (1 << 19);
long long n, m, c, c0;
struct per {
long long t, a, b;
bool operator<(const per &other) const { return t < other.t; }
};
per fff[maxn];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0)... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 5;
int N, M, C_MX, C_STA;
struct node {
int t;
int a;
int b;
} peo[MAXN];
bool cmp(node x, node y) { return x.t < y.t; }
void solve() {
long long ans = 0;
scanf("%d%d%d%d", &N, &M, &C_MX, &C_STA);
for (int i = 1; i <= N; i++) {
scanf("... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 500010;
struct station {
int t, a, b;
bool operator<(const station &A) const { return t < A.t; }
} sta[N];
int stk[N], r[N];
int n, m, c0, c;
inline void solve() {
scanf("%d%d%d%d", &n, &m, &c, &c0);
for (int i = 1; i <= n; i++) {
scanf("%d%d%d", &... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
int n, m, c, c0;
int t[N], a[N], b[N];
map<int, int> mp;
int main() {
int q;
cin >> q;
while (q--) {
scanf("%d %d %d %d", &n, &m, &c, &c0);
for (int i = 1; i <= n; i++) {
scanf("%d %d %d", &t[i], &a[i], &b[i]);
}
n++;
... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
void _co() { cerr << '\n'; }
template <typename T, typename... Ts>
void _co(const T& value, const Ts&... values) {
cerr << ' ' << value;
_co(values...);
}
template <typename T, typename... Ts>
void co(const T& value, const Ts&... values) {
cerr << "deb: " << value;
... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int64_t INF = (1 << 30) - 1;
const long long oo = (1ll << 62) - 1;
const long double PI = 3.1415926535898;
const int64_t N = 5 * 100000 + 5;
int64_t q;
int64_t n, m, c, c0;
pair<int64_t, pair<int64_t, int64_t> > a[N];
multiset<pair<int64_t, int64_t> > ms;
void solve()... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.AbstractQueue;
import java.io.IOException;
import java.util.AbstractCollection;
import java.io.InputStream;
/**
* Built using CHelp... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
long long q;
long long n;
long long m;
long long c;
long long c_0;
long long t;
long long a;
long long b;
vector<pair<long long, pair<long long, long long> > > zna;
map<long long, long long> M;
bool zly_wynik = 0;
unsigned long long wynik = 0;
long long akt_ilosc;
int main(... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int maxn = 5e5 + 100;
const int maxm = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3;
template <class T>
inline bool scan(T &ret) {
ret = 0;
char c;
int sgn;
T bit = 0.1;
if (c = getchar(), c == EOF) re... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
inline int getint() {
int x = 0, p = 1;
char c = getchar();
while (c <= 32) c = getchar();
if (c == 45) p = -p, c = getchar();
while (c > 32) x = x * 10 + c - 48, c = getchar();
return x * p;
}
using namespace std;
int n, m, now, c;
vector<pair<int, pair<int, int> > > a;
map<int, in... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
inline long long read() {
long long x = 0;
char ch = getchar(), w = 1;
while (ch < '0' || ch > '9') {
if (ch == '-') w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return x * w;
}
void write(long long x) {
if (... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXZ = 500000;
struct Z {
int t, lim, cost;
};
bool operator<(const Z &a, const Z &b) { return a.t < b.t; }
int nz, tmax, cap, shave;
Z z[MAXZ];
multiset<pair<int, int>> avail;
long l... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int MAX = 500010;
int q, n;
long long m, cap, curr;
struct fr {
long long time, amount, cost;
};
bool operator<(const fr& f1, const fr& f2) {
if (f1.time != f2.time) return (f1.time < f2.time);
return (f1.cost < f2.cost);
}
vector<fr> flist(MAX);
map<long long, ... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
int n, m, k, lz[N * 4], tmp, a[N];
int64_t ans;
pair<int, pair<int, int> > f[N];
pair<int, int> it[N * 4];
void build(int k, int l, int r) {
lz[k] = 0;
if (l == r) {
it[k] = make_pair(0, r);
} else {
int m = (l + r) >> 1;
build(((k) ... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 500000;
const int LOG_MAX_N = 18;
const int INF = 1000000009;
int nTest;
int n;
int m;
int k;
int b0;
int a[MAX_N + 9];
int b[MAX_N + 9];
int c[MAX_N + 9];
vector<int> vA;
vector<int> vId[MAX_N + 9];
int it[(1 << LOG_MAX_N + 2) + 9];
int lz[(1 << LOG_MAX_N... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
struct no {
long long t, x, y;
} a[1000010];
long long operator<(no x, no y) { return x.t < y.t; }
long long n, m, c, c0;
void sol() {
long long r = 0;
cin >> n >> m >> c >> c0;
for (long long i = 1; i <= n; i++)
scanf("%I64d%I64d%I64d", &a[i].t, &a[i].x, &a[i].... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
using namespace std;
template <typename U, typename V>
void Min(U &a, const V &b) {
if (a > b) a = b;
}
template <typename U, typename V>
void Max(U &a, const V &b) {
if (a < b) a = b;
}
template <typename U, typename V>
void add(U &a, const V &b) {
a = (a + b) % 998244353;
}
template <ty... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;
template <class T, class U>
using P = pair<T, U>;
using vll = V<ll>;
using vii = V<int>;
using vvll = V<vll>;
using vvii = V<V<int> >;
using PII... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
const long long int MOD = 1e9 + 7;
using namespace std;
template <class T>
inline T Min(const T &a, const T &b) {
return a < b ? a : b;
}
template <class T>
inline T Max(const T &a, const T &b) {
return a < b ? b : a;
}
inline void inc(int &x, int &v, int &mod) {
x += v;
if (x >= mod) x... |
Problem: Adilbek has to water his garden. He is going to do it with the help of a complex watering system: he only has to deliver water to it, and the mechanisms will do all the remaining job.
The watering system consumes one liter of water per minute (if there is no water, it is not working). It can hold no more than... | #include <bits/stdc++.h>
int read() {
register int x = 0;
register char f = 1, ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-') f ^= 1;
for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ '0');
return f ? x : -x;
}
int n, c;
struct node {
int t, a, b;
bool operator<(... |
Problem: Recently Petya walked in the forest and found a magic stick.
Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer:
1. If the chosen number a is even, then the spell will turn it into 3a/2;
... | t=int(input())
s=[]
a=[1,2,3]
for jngg in range(0,t):
x=input()
xx=x.split( )
x=int(xx[0])
y=int(xx[1])
if x==y:
s.append('yes')
elif x in a and y in a and x!=1:
s.append('yes')
elif x in a and y not in a:
s.append('no')
elif x==1:
s.append('no')
else:... |
Problem: Recently Petya walked in the forest and found a magic stick.
Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer:
1. If the chosen number a is even, then the spell will turn it into 3a/2;
... | n=int(input())
for i in range(n):
m,x=map(int,input().split())
if m==1:
if x==1:
print("YES")
else:
print("NO")
elif m==2 or m==3:
if 3>=x:
print("YES")
else:
print("NO")
else:
print("YES")
|
Problem: Recently Petya walked in the forest and found a magic stick.
Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer:
1. If the chosen number a is even, then the spell will turn it into 3a/2;
... | n = int(input())
for i in range(n):
x, y = [int(l) for l in input().split()]
if x < y <= 3:
if x == 1:
print('NO')
else:
print('YES')
elif (x <= 3) and y > x:
print('NO')
else:
print('YES') |
Problem: Recently Petya walked in the forest and found a magic stick.
Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer:
1. If the chosen number a is even, then the spell will turn it into 3a/2;
... | from math import log2
t=int(input())
for _ in range(t):
x,y=list(map(int,input().split(" ")))
if((x==2 or x==3) and (y>3)) or (x==1 and y!=1):
print("NO")
continue
print("YES") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.