This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
// @JASPER'S BOILERPLATE
using namespace std;
using ll = long long;
#ifdef JASPER
#include "debug.h"
#else
#define debug(...) 166
#endif
const int N = 3e5 + 5;
struct LazySegmentTree {
vector <int> f, lzy;
int n;
const int NEUTRAL = INT_MIN;
LazySegmentTree(int _n) {
n = _n;
f.resize((n << 2) + 5, NEUTRAL);
lzy.resize((n << 2) + 5, 0);
}
int merge(int x, int y) { return (x + y); }
void push(int x) {
int d = lzy[x];
if (!d) return;
f[x << 1] += d; lzy[x << 1] += d;
f[x << 1 | 1] += d; lzy[x << 1 | 1] += d;
lzy[x] = 0;
}
void upd(int x, int l, int r, int u, int v, int val) {
if (l > v || r < u) return;
if (l <= u && v <= r) {
f[x] += val;
lzy[x] += val;
return;
}
push(x);
int m = (l + r) / 2;
upd(x << 1, l, m, u, v, val);
upd(x << 1 | 1, m + 1, r, u, v, val);
f[x] = merge(f[x << 1], f[x << 1 | 1]);
}
int qry(int x, int l, int r, int u, int v) {
if (l > v || r < u) return NEUTRAL;
if (l <= u && v <= r) return f[x];
push(x);
int m = (l + r) / 2;
int ql = qry(x << 1, l, m, u, v);
int qr = qry(x << 1 | 1, m + 1, r, u, v);
return merge(ql, qr);
}
void upd(int l, int r, int v) { upd(1, 1, n, l, r, v); }
int qry(int l, int r) { return qry(1, 1, n, l, r); }
};
int a[N];
// 1: last position of x, -1: second-last position of x -> sum(l, r) = 0-> non-unique subarray, > 0: unique
signed main() {
cin.tie(0) -> sync_with_stdio(0);
int q; cin >> q;
map <int, int> lst;
vector <int> ans(2);
for (int i = 1; i <= q; ++i) {
int t, x, y;
cin >> t >> x >> y;
int d = (x >= 5);
ans[d] += 100;
if (lst.count(x)) {
if (t - lst[x] <= 10)
ans[d] += 50;
}
lst[x] = t;
}
cout << ans[0] << " " << ans[1] << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |