QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#383252 | #3093. IOI Fever | Ecec243 | 100 ✓ | 1183ms | 438464kb | C++23 | 9.7kb | 2024-04-09 07:45:26 | 2024-04-09 07:45:26 |
Judging History
answer
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cassert>
using namespace std;
#define LOG(f...) fprintf(stderr, f)
#define all(cont) begin(cont), end(cont)
using ll = long long;
const int N = 100005;
const ll IINF = 2e9;
const ll INF = 1e17;
struct pt { int x, y; };
struct discretizer {
vector<int> v;
void clear() { v.clear(); }
void add(int x) { v.push_back(x); }
void init() { sort(all(v)); v.erase(unique(all(v)), end(v)); }
int operator()(int x) const { return lower_bound(all(v), x) - begin(v); }
};
struct min_seg_tree {
static const int LEN = 1 << 21;
pair<int, pair<int, int>> t[LEN * 2];
void init() { memset((void *)t, 0x3f, sizeof(t)); }
min_seg_tree() { init(); }
void update(int p, ll v, int id) {
if (v > 0x3f3f3f3f) return;
p += LEN;
if (t[p].first <= v) return;
t[p].first = v; t[p].second = {p - LEN, id};
for (p >>= 1; p; p >>= 1)
t[p] = t[p << 1].first < t[p << 1 | 1].first ? t[p << 1] : t[p << 1 | 1];
}
void assign(int p, ll v, int id) {
if (v > 0x3f3f3f3f) return;
p += LEN;
if (t[p].first == v && t[p].second.second == id) return;
t[p].first = v; t[p].second = {p - LEN, id};
for (p >>= 1; p; p >>= 1)
t[p] = t[p << 1].first < t[p << 1 | 1].first ? t[p << 1] : t[p << 1 | 1];
}
void erase(int p) {
p |= LEN; t[p].first = 0x3f3f3f3f;
for (p >>= 1; p; p >>= 1)
t[p] = t[p << 1].first < t[p << 1 | 1].first ? t[p << 1] : t[p << 1 | 1];
}
pair<int, pair<int, int>> top() const { return t[1]; }
};
struct seg_node {
ll b;
pair<ll, int> mn;
int pos, pos_id;
int lc, rc;
} t[N * 32 * 3];
int nc = 0;
int n;
pt p[N];
discretizer dx, dy, d0, d1;
min_seg_tree H;
int idx[N], idy[N], id0[N], id1[N];
int rtx[N][4], rty[N][4], rt0[N][4], rt1[N][4];
template<int k>
struct seg_op {
static const ll pos_init = k < 0 ? -IINF : IINF;
static ll pos_v(int x) { return x ? t[x].pos : pos_init; }
static int new_node() {
++nc;
t[nc].mn = {INF, 0}; t[nc].b = INF; t[nc].pos = pos_init; t[nc].lc = t[nc].rc = 0;
return nc;
}
static void up(int x) {
auto &u = t[x], &lc = t[t[x].lc], &rc = t[t[x].rc];
t[x].mn = min(lc.mn, rc.mn);
if (k > 0) {
if (pos_v(t[x].lc) < pos_v(t[x].rc)) u.pos = pos_v(t[x].lc), u.pos_id = lc.pos_id;
else u.pos = pos_v(t[x].rc), u.pos_id = rc.pos_id;
}
else {
if (pos_v(t[x].lc) > pos_v(t[x].rc)) u.pos = pos_v(t[x].lc), u.pos_id = lc.pos_id;
else u.pos = pos_v(t[x].rc), u.pos_id = rc.pos_id;
}
t[x].mn = min(t[x].mn, make_pair((ll)k * t[x].pos + t[x].b, t[x].pos_id));
}
static void insert(int &x, int l, int r, int p, ll mn, int id) {
if (!x) x = new_node();
if ((k > 0 && p < t[x].pos) || (k < 0 && p > t[x].pos))
t[x].pos = p, t[x].pos_id = id;
t[x].mn = min(t[x].mn, make_pair(mn, id));
if (l == r) return;
int mid = (l + r) >> 1;
p <= mid ? insert(t[x].lc, l, mid, p, mn, id) : insert(t[x].rc, mid + 1, r, p, mn, id);
}
static void erase(int &x, int l, int r, int p) {
if (l == r) { x = 0; return; }
int mid = (l + r) >> 1;
p <= mid ? erase(t[x].lc, l, mid, p) : erase(t[x].rc, mid + 1, r, p);
if (!t[x].lc && !t[x].rc) x = 0;
else up(x);
}
static void update(int &x, int l, int r, int ql, int qr, ll b) {
if (!x || ql > qr) return;
if (ql <= l && r <= qr) {
t[x].b = min(t[x].b, b);
if (t[x].pos != pos_init) t[x].mn = min(t[x].mn, make_pair(t[x].b + t[x].pos * k, t[x].pos_id));
return;
}
int mid = (l + r) >> 1;
if (ql <= mid) update(t[x].lc, l, mid, ql, qr, b);
if (qr > mid) update(t[x].rc, mid + 1, r, ql, qr, b);
up(x);
}
};
int min_x, max_x, min_y, max_y;
int dir[N];
// rt0 : -2 -2 2 2
// rt1 : -2 2 2 -2
void insert_pt(int i) {
int D = dir[i];
ll V = i == 0 ? 0 : INF;
D & 2 ? seg_op<2>::insert(rt0[id0[i]][D], min_x, max_x, p[i].x, V, i)
: seg_op<-2>::insert(rt0[id0[i]][D], min_x, max_x, p[i].x, V, i);
D == 1 || D == 2 ? seg_op<2>::insert(rt1[id1[i]][D], min_x, max_x, p[i].x, V, i)
: seg_op<-2>::insert(rt1[id1[i]][D], min_x, max_x, p[i].x, V, i);
if (D == 0) seg_op<-1>::insert(rty[idy[i]][D], min_x, max_x, p[i].x, V, i);
else if (D == 2) seg_op<1>::insert(rty[idy[i]][D], min_x, max_x, p[i].x, V, i);
else if (D == 1) seg_op<-1>::insert(rtx[idx[i]][D], min_y, max_y, p[i].y, V, i);
else if (D == 3) seg_op<1>::insert(rtx[idx[i]][D], min_y, max_y, p[i].y, V, i);
}
void heap_up(int id, int tid) {
H.update(id, t[tid].mn.first, t[tid].mn.second);
}
void heap_assign(int id, int tid) {
H.assign(id, t[tid].mn.first, t[tid].mn.second);
}
void erase_pt(int i) {
int D = dir[i];
D & 2 ? seg_op<2>::erase(rt0[id0[i]][D], min_x, max_x, p[i].x)
: seg_op<-2>::erase(rt0[id0[i]][D], min_x, max_x, p[i].x);
heap_assign(id0[i] << 4 | 8 | D, rt0[id0[i]][D]);
D == 1 || D == 2 ? seg_op<2>::erase(rt1[id1[i]][D], min_x, max_x, p[i].x)
: seg_op<-2>::erase(rt1[id1[i]][D], min_x, max_x, p[i].x);
heap_assign(id1[i] << 4 | 12 | D, rt1[id1[i]][D]);
if (D == 0) seg_op<-1>::erase(rty[idy[i]][D], min_x, max_x, p[i].x);
else if (D == 2) seg_op<1>::erase(rty[idy[i]][D], min_x, max_x, p[i].x);
else if (D == 1) seg_op<-1>::erase(rtx[idx[i]][D], min_y, max_y, p[i].y);
else if (D == 3) seg_op<1>::erase(rtx[idx[i]][D], min_y, max_y, p[i].y);
if (D == 0 || D == 2)
heap_assign(idy[i] << 4 | 4 | D, rty[idy[i]][D]);
else
heap_assign(idx[i] << 4 | 0 | D, rtx[idx[i]][D]);
}
void update_pt(int i, int dis) {
int slen = (dis + 1) / 2, slen_v = slen * 2;
switch (dir[i]) {
case 0:
seg_op<2>::update(rt0[id0[i]][3], min_x, max_x, p[i].x + slen, max_x, slen_v - 2LL * (p[i].x + slen));
heap_up(id0[i] << 4 | 8 | 3, rt0[id0[i]][3]);
seg_op<2>::update(rt1[id1[i]][1], min_x, max_x, p[i].x + slen, max_x, slen_v - 2LL * (p[i].x + slen));
heap_up(id1[i] << 4 | 12 | 1, rt1[id1[i]][1]);
seg_op<1>::update(rty[idy[i]][2], min_x, max_x, p[i].x + dis, max_x, dis - (p[i].x + dis));
heap_up(idy[i] << 4 | 4 | 2, rty[idy[i]][2]);
break;
case 1:
seg_op<2>::update(rt0[id0[i]][2], min_x, max_x, p[i].x + slen, max_x, slen_v - 2LL * (p[i].x + slen));
heap_up(id0[i] << 4 | 8 | 2, rt0[id0[i]][2]);
seg_op<-2>::update(rt1[id1[i]][0], min_x, max_x, min_x, p[i].x - slen, slen_v + 2LL * (p[i].x - slen));
heap_up(id1[i] << 4 | 12 | 0, rt1[id1[i]][0]);
seg_op<1>::update(rtx[idx[i]][3], min_y, max_y, p[i].y + dis, max_y, dis - (p[i].y + dis));
heap_up(idx[i] << 4 | 0 | 3, rtx[idx[i]][3]);
break;
case 2:
seg_op<-2>::update(rt0[id0[i]][1], min_x, max_x, min_x, p[i].x - slen, slen_v + 2LL * (p[i].x - slen));
heap_up(id0[i] << 4 | 8 | 1, rt0[id0[i]][1]);
seg_op<-2>::update(rt1[id1[i]][3], min_x, max_x, min_x, p[i].x - slen, slen_v + 2LL * (p[i].x - slen));
heap_up(id1[i] << 4 | 12 | 3, rt1[id1[i]][3]);
seg_op<-1>::update(rty[idy[i]][0], min_x, max_x, min_x, p[i].x - dis, dis + (p[i].x - dis));
heap_up(idy[i] << 4 | 4 | 0, rty[idy[i]][0]);
break;
case 3:
seg_op<-2>::update(rt0[id0[i]][0], min_x, max_x, min_x, p[i].x - slen, slen_v + 2LL * (p[i].x - slen));
heap_up(id0[i] << 4 | 8 | 0, rt0[id0[i]][0]);
seg_op<2>::update(rt1[id1[i]][2], min_x, max_x, p[i].x + slen, max_x, slen_v - 2LL * (p[i].x + slen));
heap_up(id1[i] << 4 | 12 | 2, rt1[id1[i]][2]);
seg_op<-1>::update(rtx[idx[i]][1], min_y, max_y, min_y, p[i].y - dis, dis + (p[i].y - dis));
heap_up(idx[i] << 4 | 0 | 1, rtx[idx[i]][1]);
break;
}
}
bool vis[N];
int solve() {
dir[0] = 0;
for (int i = 1; i < n; ++i) {
if (abs(p[i].x) == abs(p[i].y))
dir[i] = p[i].x < 0 ? 0 : (p[i].y > 0 ? 3 : 1);
else if (abs(p[i].x) > abs(p[i].y))
dir[i] = p[i].x > 0 ? 2 : 0;
else
dir[i] = p[i].y > 0 ? 3 : 1;
}
dx.clear(); dy.clear(); d0.clear(); d1.clear();
for (int i = 0; i < n; ++i)
dx.add(p[i].x), dy.add(p[i].y), d0.add(p[i].x - p[i].y), d1.add(p[i].x + p[i].y);
dx.init(); dy.init(); d0.init(); d1.init();
for (int i = 0; i < n; ++i)
tie(idx[i], idy[i], id0[i], id1[i]) = make_tuple(dx(p[i].x), dy(p[i].y), d0(p[i].x - p[i].y), d1(p[i].x + p[i].y));
min_x = IINF; max_x = -IINF;
for (int i = 0; i < n; ++i) {
min_x = min(min_x, p[i].x), max_x = max(max_x, p[i].x);
min_y = min(min_y, p[i].y), max_y = max(max_y, p[i].y);
}
nc = 0;
memset(rtx, 0, sizeof(rtx)); memset(rty, 0, sizeof(rty)); memset(rt0, 0, sizeof(rt0)); memset(rt1, 0, sizeof(rt1));
for (int i = 0; i < n; ++i)
insert_pt(i);
H.update(idy[0] << 4 | 4 | 0, 0, 0);
H.update(id0[0] << 4 | 8 | dir[0], 0, 0);
H.update(id1[0] << 4 | 12 | dir[0], 0, 0);
fill(vis, vis + n, false);
int res = 0;
while (H.top().first != 0x3f3f3f3f) {
int val = H.top().first;
int id = H.top().second.first;
int x = H.top().second.second;
H.erase(id);
if (vis[x]) continue;
erase_pt(x);
vis[x] = true;
++res;
update_pt(x, val);
}
return res;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
scanf("%d", &n);
for (int i = 0; i < n; ++i)
scanf("%d%d", &p[i].x, &p[i].y);
for (int i = 1; i < n; ++i)
p[i].x -= p[0].x, p[i].y -= p[0].y;
p[0].x = 0; p[0].y = 0;
t[0].mn = {INF, 0};
int res = 0;
for (int i = 0; i < 4; ++i) {
res = max(res, solve());
transform(p, p + n, p, [](const pt &p) ->pt { return {-p.y, p.x}; });
}
printf("%d\n", res);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 12ms
memory: 435064kb
input:
1 0 0
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 7ms
memory: 435452kb
input:
2 0 95 13 70
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 27ms
memory: 434288kb
input:
2 0 0 1 1
output:
2
result:
ok single line: '2'
Test #4:
score: 0
Accepted
time: 16ms
memory: 435096kb
input:
3 0 0 2 2 1 1
output:
3
result:
ok single line: '3'
Test #5:
score: 0
Accepted
time: 19ms
memory: 435060kb
input:
3 1 2 0 1 2 0
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 19ms
memory: 435060kb
input:
3 16 33 18 38 72 83
output:
1
result:
ok single line: '1'
Test #7:
score: 0
Accepted
time: 15ms
memory: 435212kb
input:
4 0 0 2 2 3 3 1 1
output:
4
result:
ok single line: '4'
Test #8:
score: 0
Accepted
time: 31ms
memory: 434380kb
input:
4 0 1 1 3 2 2 3 0
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 27ms
memory: 435092kb
input:
4 93 86 57 59 69 56 30 24
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 12ms
memory: 434648kb
input:
5 0 0 3 4 2 1 4 2 1 3
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 15ms
memory: 435056kb
input:
5 2 4 1 2 3 3 4 0 0 1
output:
2
result:
ok single line: '2'
Test #12:
score: 0
Accepted
time: 28ms
memory: 435068kb
input:
5 32 48 65 100 45 39 4 14 59 6
output:
1
result:
ok single line: '1'
Test #13:
score: 0
Accepted
time: 15ms
memory: 435212kb
input:
6 0 0 3 5 5 1 4 2 1 4 2 3
output:
1
result:
ok single line: '1'
Test #14:
score: 0
Accepted
time: 20ms
memory: 435024kb
input:
6 4 5 1 4 2 0 3 3 5 2 0 1
output:
2
result:
ok single line: '2'
Test #15:
score: 0
Accepted
time: 24ms
memory: 435204kb
input:
6 55 86 9 99 97 28 47 45 34 78 69 64
output:
1
result:
ok single line: '1'
Test #16:
score: 0
Accepted
time: 32ms
memory: 435060kb
input:
7 0 0 2 2 6 5 5 3 1 6 4 4 3 1
output:
3
result:
ok single line: '3'
Test #17:
score: 0
Accepted
time: 11ms
memory: 435060kb
input:
7 0 0 5 6 2 2 3 1 6 5 1 3 4 4
output:
3
result:
ok single line: '3'
Test #18:
score: 0
Accepted
time: 8ms
memory: 434868kb
input:
7 2 3 5 2 0 4 3 1 4 6 6 5 1 0
output:
1
result:
ok single line: '1'
Test #19:
score: 0
Accepted
time: 19ms
memory: 434716kb
input:
7 4 5 2 0 3 1 0 2 6 4 5 3 1 6
output:
1
result:
ok single line: '1'
Test #20:
score: 0
Accepted
time: 4ms
memory: 435208kb
input:
7 0 0 88 8 85 42 41 32 18 73 63 95 93 64
output:
1
result:
ok single line: '1'
Test #21:
score: 0
Accepted
time: 27ms
memory: 434608kb
input:
7 77 37 0 23 8 65 86 63 48 9 69 11 53 89
output:
1
result:
ok single line: '1'
Test #22:
score: 0
Accepted
time: 23ms
memory: 435124kb
input:
7 0 0 259048843 298788799 429755476 1736261 406155419 391345419 318502804 208133880 409667562 478993877 179296965 346372186
output:
1
result:
ok single line: '1'
Test #23:
score: 0
Accepted
time: 28ms
memory: 434788kb
input:
7 462374518 230995522 443589342 318094440 402452643 402369279 423425407 473619129 174105781 207207103 369462410 193114330 110454274 358691995
output:
1
result:
ok single line: '1'
Test #24:
score: 0
Accepted
time: 23ms
memory: 435060kb
input:
7 0 0 2 2 3 3 4 4 6 6 1 1 5 5
output:
7
result:
ok single line: '7'
Test #25:
score: 0
Accepted
time: 43ms
memory: 434428kb
input:
7 0 0 1 1 2 2 5 5 6 6 3 3 4 4
output:
7
result:
ok single line: '7'
Test #26:
score: 0
Accepted
time: 11ms
memory: 434592kb
input:
7 45 25 42 22 47 27 44 24 51 31 59 39 41 21
output:
7
result:
ok single line: '7'
Test #27:
score: 0
Accepted
time: 27ms
memory: 435204kb
input:
7 204039898 226809229 173138751 257710376 170846507 260002620 183756401 247092726 195034613 235814514 181098978 249750149 131458912 299390215
output:
7
result:
ok single line: '7'
Test #28:
score: 0
Accepted
time: 39ms
memory: 435024kb
input:
7 241730306 209352789 232470450 218612645 375096013 399999653 74905790 13662376 187544554 263538541 166992768 284090327 264368958 250511153
output:
5
result:
ok single line: '5'
Test #29:
score: 0
Accepted
time: 16ms
memory: 435056kb
input:
7 250000000 250000000 249998419 250000777 250000796 250000796 249999617 250001975 250000175 250003261 250002397 250001039 250000277 249998919
output:
7
result:
ok single line: '7'
Test #30:
score: 0
Accepted
time: 12ms
memory: 434760kb
input:
2 0 0 500000000 500000000
output:
2
result:
ok single line: '2'
Test #31:
score: 0
Accepted
time: 15ms
memory: 435012kb
input:
7 0 0 500000000 500000000 1 1 499999999 499999999 2 2 499999998 499999998 3 3
output:
7
result:
ok single line: '7'
Test #32:
score: 0
Accepted
time: 15ms
memory: 435092kb
input:
7 64 52 68 56 65 53 62 62 44 44 60 60 59 59
output:
7
result:
ok single line: '7'
Subtask #2:
score: 8
Accepted
Dependency #1:
100%
Accepted
Test #33:
score: 8
Accepted
time: 19ms
memory: 435088kb
input:
15 14 8 2 4 3 11 5 9 0 2 8 0 1 1 12 6 13 7 4 13 7 5 9 14 6 12 10 10 11 3
output:
5
result:
ok single line: '5'
Test #34:
score: 0
Accepted
time: 7ms
memory: 435000kb
input:
15 3 2 8 14 13 5 11 9 10 7 7 4 0 6 14 1 4 11 1 10 6 12 2 0 12 13 5 3 9 8
output:
2
result:
ok single line: '2'
Test #35:
score: 0
Accepted
time: 3ms
memory: 435124kb
input:
15 50 24 18 5 37 8 5 26 8 25 85 36 67 99 69 15 56 60 29 29 0 11 73 6 44 48 35 68 46 93
output:
1
result:
ok single line: '1'
Test #36:
score: 0
Accepted
time: 23ms
memory: 434388kb
input:
15 427929068 268232535 465863378 130205389 251811405 318340143 58648264 95405602 402717421 471011833 73745981 209206123 226475999 152827673 361862201 439961214 380268516 283628731 134795488 70980260 3421105 489115879 311722907 458453874 434308654 63890072 365469754 209198508 439807068 285253650
output:
1
result:
ok single line: '1'
Test #37:
score: 0
Accepted
time: 11ms
memory: 434716kb
input:
15 0 0 7 7 14 14 5 5 6 6 11 11 3 3 1 1 8 8 9 9 13 13 2 2 10 10 4 4 12 12
output:
15
result:
ok single line: '15'
Test #38:
score: 0
Accepted
time: 20ms
memory: 435016kb
input:
15 59 40 62 43 55 36 47 28 48 29 57 38 64 45 51 32 50 31 56 37 52 33 61 42 65 46 66 47 58 39
output:
15
result:
ok single line: '15'
Test #39:
score: 0
Accepted
time: 11ms
memory: 435000kb
input:
15 204325661 246095862 147782571 189552772 119466297 161236498 129599045 171369246 200406522 242176723 210503489 252273690 139284305 181054506 131607631 173377832 213151981 254922182 189588132 231358333 144412165 186182366 125446139 167216340 179559325 221329526 152185222 193955423 169748933 211519134
output:
15
result:
ok single line: '15'
Test #40:
score: 0
Accepted
time: 3ms
memory: 435212kb
input:
15 298422959 271237942 188322497 36294928 294865547 98424657 71596668 126081293 320003209 478974437 324923614 310710717 371627190 357414293 204955270 317539056 283457632 269244735 352781338 338568441 365460830 351247933 446288414 396515779 246818253 232605356 291936899 277724002 36802016 55888694
output:
8
result:
ok single line: '8'
Test #41:
score: 0
Accepted
time: 27ms
memory: 435124kb
input:
15 238263322 292747953 270609184 250176380 255802385 275208890 215139304 370238941 243218595 287792680 481230581 435958737 264138538 266872737 159441200 269014899 284551738 246459537 266245937 202017490 334779106 196232169 369705908 136942395 333128876 197882399 178527854 249928245 233274150 195181949
output:
10
result:
ok single line: '10'
Test #42:
score: 0
Accepted
time: 16ms
memory: 435064kb
input:
15 250000000 250000000 250000910 250007348 250000546 249998036 250004054 250001544 250000912 250000912 250000509 250005089 400790683 146376887 250001095 249996429 249997979 250000603 249994973 250001411 433044670 34666579 250001303 249995081 249996472 250001052 250006462 250001796 249999600 250002224
output:
13
result:
ok single line: '13'
Test #43:
score: 0
Accepted
time: 31ms
memory: 434544kb
input:
15 250000000 250000000 249999693 249997163 250002895 250000365 249994366 249999680 249999188 249994858 249999106 250002266 250000080 249993044 250000686 250000686 249992986 250000138 250004897 250000567 249998973 250004287 249996848 250000008 249999145 250008925 249999156 250006308 250007553 250000517
output:
15
result:
ok single line: '15'
Test #44:
score: 0
Accepted
time: 12ms
memory: 434892kb
input:
15 0 0 500000000 500000000 1 1 499999999 499999999 2 2 499999998 499999998 3 3 499999997 499999997 4 4 499999996 499999996 5 5 499999995 499999995 6 6 499999994 499999994 7 7
output:
15
result:
ok single line: '15'
Test #45:
score: 0
Accepted
time: 11ms
memory: 435208kb
input:
15 107 139 114 146 105 137 88 120 130 130 112 148 123 123 93 93 128 128 113 113 106 140 99 147 146 100 108 142 115 135
output:
13
result:
ok single line: '13'
Subtask #3:
score: 6
Accepted
Test #46:
score: 6
Accepted
time: 27ms
memory: 434668kb
input:
100 0 0 78 78 8 50 68 87 64 97 10 62 1 64 95 91 59 85 36 16 35 13 20 28 84 92 99 80 44 24 26 23 80 8 32 1 21 21 13 99 39 12 14 44 93 48 53 58 63 67 30 66 23 70 28 57 12 34 61 59 33 9 90 69 2 42 47 35 29 45 9 83 79 71 72 18 4 82 67 52 81 38 91 98 51 81 74 39 58 14 18 93 6 77 92 73 46 54 75 53 40 30 6...
output:
3
result:
ok single line: '3'
Test #47:
score: 0
Accepted
time: 24ms
memory: 435036kb
input:
100 0 0 61 86 31 58 65 5 38 27 13 28 63 72 47 35 43 26 49 71 7 85 32 92 4 95 96 83 90 4 6 23 11 44 22 31 44 14 67 10 71 63 57 94 83 13 76 3 75 29 66 66 46 77 48 56 25 20 20 69 1 98 62 76 58 96 55 39 94 12 70 68 45 57 53 74 9 79 60 91 50 15 27 46 8 52 33 24 37 73 59 36 54 43 30 37 21 30 72 41 88 47 8...
output:
2
result:
ok single line: '2'
Test #48:
score: 0
Accepted
time: 28ms
memory: 435096kb
input:
100 0 0 91 9 54 75 31 55 42 34 60 51 34 97 97 80 23 82 70 35 53 19 41 93 81 37 79 26 80 99 2 66 84 91 44 21 89 83 45 17 96 76 94 72 95 90 57 74 88 30 4 36 87 96 64 65 12 18 56 23 76 5 16 47 6 7 92 16 25 10 40 31 98 78 49 92 73 56 22 87 50 24 69 61 67 22 43 62 39 68 46 1 62 3 78 64 51 53 19 40 68 13 ...
output:
1
result:
ok single line: '1'
Test #49:
score: 0
Accepted
time: 8ms
memory: 435128kb
input:
100 0 0 22 24 16 63 43 41 11 97 84 25 62 73 25 22 63 10 70 65 48 74 75 38 12 55 88 88 24 5 34 60 7 6 55 56 21 76 45 49 10 90 41 3 74 17 5 77 40 87 99 54 6 29 19 37 37 40 95 81 14 82 85 96 27 72 78 43 67 21 79 42 66 61 96 50 33 69 59 70 47 66 38 33 17 12 73 23 87 68 81 31 50 1 15 67 80 92 77 30 98 86...
output:
2
result:
ok single line: '2'
Test #50:
score: 0
Accepted
time: 27ms
memory: 435140kb
input:
100 0 0 462839348 273638268 274299271 198120223 196450946 186718881 114625280 337767325 211028860 119520004 306019485 228537344 179299977 49330649 125489833 418628239 369813444 266607943 226492599 325028844 69881569 49748009 247578390 9670701 335172110 137871660 425053812 474564177 352545903 4398829...
output:
1
result:
ok single line: '1'
Test #51:
score: 0
Accepted
time: 24ms
memory: 435092kb
input:
100 0 0 54 54 4 4 38 38 9 9 40 40 95 95 79 79 23 23 90 90 74 74 55 55 34 34 22 22 44 44 48 48 63 63 56 56 50 50 6 6 62 62 49 49 91 91 20 20 67 67 25 25 11 11 97 97 87 87 46 46 99 99 59 59 2 2 92 92 15 15 33 33 30 30 96 96 42 42 88 88 66 66 12 12 76 76 32 32 37 37 64 64 39 39 41 41 35 35 31 31 19 19 ...
output:
100
result:
ok single line: '100'
Test #52:
score: 0
Accepted
time: 27ms
memory: 435128kb
input:
100 0 0 62993685 62993685 96319004 96319004 48847179 48847179 39353768 39353768 65362463 65362463 50416862 50416862 82355959 82355959 33918868 33918868 91145665 91145665 2060820 2060820 47738390 47738390 27835163 27835163 3393242 3393242 63068287 63068287 27652691 27652691 89350261 89350261 44184704...
output:
100
result:
ok single line: '100'
Test #53:
score: 0
Accepted
time: 20ms
memory: 435000kb
input:
100 0 0 500000000 500000000 1 1 499999999 499999999 2 2 499999998 499999998 3 3 499999997 499999997 4 4 499999996 499999996 5 5 499999995 499999995 6 6 499999994 499999994 7 7 499999993 499999993 8 8 499999992 499999992 9 9 499999991 499999991 10 10 499999990 499999990 11 11 499999989 499999989 12 1...
output:
100
result:
ok single line: '100'
Subtask #4:
score: 6
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #54:
score: 6
Accepted
time: 20ms
memory: 435016kb
input:
100 32 87 82 30 30 90 92 54 37 56 38 74 58 81 90 35 95 83 19 17 73 23 13 4 47 76 63 68 65 62 75 71 96 0 49 12 59 32 69 80 29 61 79 50 21 19 9 79 61 63 76 67 44 94 80 78 1 51 71 86 40 49 77 29 88 55 45 52 48 85 98 22 24 48 87 10 54 13 2 8 33 72 39 26 16 6 70 58 78 25 89 15 8 99 74 88 6 91 68 93 4 66 ...
output:
1
result:
ok single line: '1'
Test #55:
score: 0
Accepted
time: 24ms
memory: 435092kb
input:
100 37 35 83 16 46 56 18 0 95 64 10 34 56 66 88 80 26 59 49 19 82 72 1 57 58 84 20 32 51 9 27 6 70 40 16 38 73 67 53 10 69 88 93 3 48 49 79 8 0 75 33 58 4 95 3 70 96 22 40 60 86 44 25 30 50 50 5 94 81 65 99 85 75 83 17 86 29 39 44 31 54 14 32 98 87 52 21 61 63 47 90 63 57 4 80 37 9 92 55 11 92 55 34...
output:
2
result:
ok single line: '2'
Test #56:
score: 0
Accepted
time: 7ms
memory: 435092kb
input:
100 118923925 480217061 126937003 78747450 162598385 203593894 428483309 56775954 299200342 70887142 385382496 389344431 472097658 494827716 32434470 313726277 380991511 437058542 35830674 211858230 44281768 298020872 119246347 337329406 188903857 133858618 466843968 213026783 467748379 18997094 402...
output:
1
result:
ok single line: '1'
Test #57:
score: 0
Accepted
time: 12ms
memory: 435128kb
input:
100 395121167 416427914 17076286 152437963 39324540 49880487 463607843 312559233 2673000 97282089 304490345 146239978 301696596 69259632 163345181 258408765 171174028 210459753 4728204 395190825 198762931 207462889 115163869 3798512 154611737 371131536 177977911 23929555 264216153 272613244 42699614...
output:
1
result:
ok single line: '1'
Test #58:
score: 0
Accepted
time: 23ms
memory: 435212kb
input:
100 332061729 124194621 289865717 81998609 310404665 102537557 295611828 87744720 264093099 56225991 346015858 138148750 285605420 77738312 328349493 120482385 326320441 118453333 331984804 124117696 329295676 121428568 262827156 54960048 286707725 78840617 328611450 120744342 305493856 97626748 341...
output:
100
result:
ok single line: '100'
Test #59:
score: 0
Accepted
time: 19ms
memory: 435136kb
input:
100 529 576 405 700 420 685 621 484 453 652 607 498 520 561 283 957 324 3 969 727 439 838 424 681 861 212 532 573 641 464 556 525 545 536 534 533 566 515 565 249 471 610 591 632 91 997 472 513 912 825 536 531 79 626 553 528 839 813 849 41 421 684 295 982 373 230 6 972 493 612 592 489 502 543 507 548...
output:
56
result:
ok single line: '56'
Test #60:
score: 0
Accepted
time: 20ms
memory: 434996kb
input:
100 283538536 302535327 319387875 232356928 275465831 276278972 387783116 455611790 230764956 320979847 62056299 448545171 286650805 283190096 316307118 312846409 284260700 327353671 295688303 256056500 162820634 303014202 218306765 333438038 46950402 306439951 301839216 249905587 317095209 31363450...
output:
13
result:
ok single line: '13'
Test #61:
score: 0
Accepted
time: 23ms
memory: 435060kb
input:
100 394 351 342 299 450 365 245 154 149 734 232 141 261 170 306 263 41 783 298 255 320 15 499 316 309 266 301 258 364 321 329 286 322 279 368 325 187 82 323 540 228 919 367 324 180 369 114 406 456 359 351 308 277 234 460 355 441 769 311 528 348 305 509 306 175 374 473 342 511 304 241 150 631 683 296...
output:
77
result:
ok single line: '77'
Test #62:
score: 0
Accepted
time: 20ms
memory: 434924kb
input:
100 198490215 269830286 192195151 276125350 162295506 306024995 210050226 386977979 85803294 292954787 447764475 30193109 183846921 284473580 271794845 275007758 94160881 284597200 259897005 286905598 272665416 274137187 154474269 313846232 308167093 275858478 180728709 182200480 245339040 301463563...
output:
84
result:
ok single line: '84'
Test #63:
score: 0
Accepted
time: 20ms
memory: 434716kb
input:
100 50000 50000 29224 48092 47223 49769 50471 50471 40669 13972 93849 17496 81809 89909 72436 4492 8689 64563 36753 48859 50105 33365 84698 58003 23076 1882 49484 59844 93485 19263 52184 49834 99725 43903 69503 59913 50024 64250 34622 48848 4132 76162 55727 81230 49666 36822 46780 49464 60036 49292 ...
output:
45
result:
ok single line: '45'
Test #64:
score: 0
Accepted
time: 16ms
memory: 434996kb
input:
100 250000000 250000000 249981719 250002119 250020683 250002911 249988141 250000655 488495572 98917141 249996312 250000574 316618872 308627140 250011913 250001239 141353179 174110284 249999944 249985612 246980472 471734476 249999766 250001850 250000253 249996633 130548064 128126506 290299338 1648577...
output:
52
result:
ok single line: '52'
Test #65:
score: 0
Accepted
time: 20ms
memory: 434316kb
input:
100 1256 1826 1213 1783 1321 1891 1292 1862 1234 1804 1186 1756 1276 1936 1210 2002 1286 1926 1263 1949 1455 1757 1264 1948 1188 2024 1242 1970 1265 1947 1266 1568 1503 1805 1250 1552 1274 1576 1347 1649 1298 1600 1402 1704 1155 1457 1504 1806 1200 1502 1612 1914 1642 1944 1157 1459 1694 1996 1473 1...
output:
60
result:
ok single line: '60'
Subtask #5:
score: 12
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #66:
score: 12
Accepted
time: 27ms
memory: 435148kb
input:
3000 2325 2978 1316 1718 480 764 552 1180 1291 2567 2668 2237 2947 1930 2121 2204 1094 478 2417 1101 2403 1590 2732 1127 524 612 255 1502 569 1805 1470 1583 823 1243 955 1875 2140 489 701 1335 1942 2797 715 2633 699 1159 2675 2210 1081 1252 2441 2953 1473 2476 2728 640 2889 414 2305 1592 137 1880 25...
output:
1
result:
ok single line: '1'
Test #67:
score: 0
Accepted
time: 28ms
memory: 434528kb
input:
3000 2874 1315 2132 1657 607 12 1209 835 627 995 982 1339 1559 223 1463 960 2559 2195 2643 2080 2701 1147 1211 724 2050 1603 2586 200 1540 2212 2336 1143 1400 1078 941 2859 863 745 2158 1905 710 2701 823 1832 1653 2559 2287 406 2775 2695 1785 371 2173 2348 1471 2951 84 1881 1399 820 869 349 2831 202...
output:
1
result:
ok single line: '1'
Test #68:
score: 0
Accepted
time: 24ms
memory: 435144kb
input:
3000 189526843 230748761 91341263 23349167 368710132 344981171 270294054 5929265 460938622 367155381 123206792 291207274 14137992 296089498 480257375 404746115 122279942 437739084 348218666 291981058 8844769 20110133 77812641 34766332 379551430 208727389 326278643 415779677 273618774 367070034 26160...
output:
1
result:
ok single line: '1'
Test #69:
score: 0
Accepted
time: 48ms
memory: 435280kb
input:
3000 50 23 8 21 90 51 22 75 49 43 27 4 79 91 65 83 84 13 32 2 29 32 75 51 30 50 93 94 31 30 72 51 5 91 87 3 53 23 23 35 49 56 6 16 83 68 58 12 96 82 30 67 53 97 54 36 53 93 24 28 54 9 0 28 52 99 17 38 34 66 54 98 65 20 46 26 75 81 14 40 64 88 62 88 91 41 36 69 19 63 26 23 18 32 27 43 82 47 55 53 89 ...
output:
3000
result:
ok single line: '3000'
Test #70:
score: 0
Accepted
time: 50ms
memory: 435356kb
input:
3000 24 154 12 7 29 114 245 64 112 170 174 207 259 45 186 8 129 267 132 46 115 28 215 144 258 50 237 81 176 227 189 163 224 5 0 156 162 8 225 294 120 242 150 290 119 77 67 259 43 81 29 18 257 205 225 18 73 98 166 288 257 182 210 284 142 265 215 173 13 128 74 200 153 262 255 102 40 114 103 197 73 213...
output:
2400
result:
ok single line: '2400'
Test #71:
score: 0
Accepted
time: 24ms
memory: 435280kb
input:
3000 375 461 224 470 242 433 317 48 68 235 369 382 328 97 208 334 27 107 314 423 306 40 139 104 87 155 3 229 279 194 318 111 90 464 408 363 126 336 143 425 478 153 446 137 452 129 106 249 85 120 308 307 281 90 57 313 185 408 135 331 342 490 320 279 477 98 116 355 229 296 432 468 349 235 70 230 408 3...
output:
448
result:
ok single line: '448'
Test #72:
score: 0
Accepted
time: 27ms
memory: 435168kb
input:
3000 2093 640 1214 1221 3 2843 2944 2819 650 730 1612 2703 1486 2719 1639 735 2611 815 767 1762 2774 2165 339 2733 1885 2931 2143 2700 1445 51 2986 2844 2729 1962 582 108 1425 50 1762 58 1418 1822 190 1838 545 1813 257 398 1996 1973 2643 2763 855 2252 1263 754 1511 44 921 917 752 994 2264 2767 769 2...
output:
7
result:
ok single line: '7'
Test #73:
score: 0
Accepted
time: 23ms
memory: 434628kb
input:
3000 155831412 215438868 299506013 210903276 358472242 247796912 310167047 26041146 469077259 125823555 411365072 14636302 227497955 301367836 316394881 453875080 220537252 172765076 12488488 79888725 339029119 235733981 6023730 244380903 376312203 266380159 279080896 417616364 39666461 410812223 29...
output:
1
result:
ok single line: '1'
Test #74:
score: 0
Accepted
time: 37ms
memory: 435168kb
input:
3000 0 0 880 880 1798 1798 1942 1942 91 91 2010 2010 1724 1724 354 354 2246 2246 1089 1089 1582 1582 1381 1381 727 727 2282 2282 2632 2632 1604 1604 2844 2844 2069 2069 248 248 483 483 2804 2804 2267 2267 688 688 1608 1608 2295 2295 2019 2019 565 565 50 50 1974 1974 2047 2047 2293 2293 2973 2973 134...
output:
3000
result:
ok single line: '3000'
Test #75:
score: 0
Accepted
time: 50ms
memory: 435360kb
input:
3000 332708301 451341806 278218555 396852060 277232748 395866253 294047073 412680578 248465158 367098663 294092138 412725643 333010695 451644200 310414074 429047579 323190714 441824219 284075010 402708515 327331932 445965437 286948140 405581645 241717035 360350540 286324647 404958152 261304171 37993...
output:
3000
result:
ok single line: '3000'
Test #76:
score: 0
Accepted
time: 28ms
memory: 435360kb
input:
3000 131956 120969 96846 148023 124823 119108 136976 124787 61267 183798 132203 126488 130861 125146 95613 112586 131031 130732 140012 130619 135668 126095 111646 157207 141793 91417 143499 179223 145789 47622 45439 121279 144038 67108 6294 151579 142114 132721 135132 125739 176623 28438 122697 1169...
output:
473
result:
ok single line: '473'
Test #77:
score: 0
Accepted
time: 24ms
memory: 435120kb
input:
3000 197736318 180280028 178700497 155442621 212787101 181962145 189208173 167662533 98072832 177664926 202962704 139638526 181146366 175241008 191322231 151278999 204208448 143547890 208473595 185215719 196035996 174490356 182103307 158845431 186397977 155573021 178452671 169303667 192477149 149557...
output:
276
result:
ok single line: '276'
Test #78:
score: 0
Accepted
time: 36ms
memory: 435244kb
input:
3000 103573 102831 197811 54227 109852 94256 113087 23764 150279 45971 92705 103365 66571 134985 110920 151197 119978 104178 78607 105501 98059 96749 141539 181094 95003 141192 101835 100525 100937 83993 122442 101714 80292 103816 146433 79145 101116 122718 142582 116163 158407 192695 168079 50683 1...
output:
1227
result:
ok single line: '1227'
Test #79:
score: 0
Accepted
time: 47ms
memory: 435172kb
input:
3000 193797516 260436794 190974448 263259862 222394723 255618095 219966427 161429093 417762215 292545524 115523087 410915678 262729599 357585932 475940780 463152669 194539485 225903831 117626558 262313340 153118755 265297889 419928484 5191422 195440288 206621684 188911493 200092889 146830877 2715857...
output:
1420
result:
ok single line: '1420'
Test #80:
score: 0
Accepted
time: 41ms
memory: 435176kb
input:
3000 5000000 5000000 5387146 1578340 4567108 7997645 6639874 6441562 13728 7065720 3802497 6430870 1183398 6780695 2681702 8307175 4552388 1202749 2833498 448137 4336163 2517789 4136845 8771169 1136543 6624726 3609327 230290 5003075 4913183 1880597 313758 1031541 2593466 4563408 4396495 1758049 4978...
output:
219
result:
ok single line: '219'
Test #81:
score: 0
Accepted
time: 39ms
memory: 435276kb
input:
3000 250000000 250000000 379922586 101284093 421368361 285540618 160024834 163574530 410822696 111467857 249926449 250000727 474730273 116225463 249640021 250000297 250099769 249999905 307655418 111754272 466001331 39152300 278901634 80528412 250126278 249999246 138840764 41005293 340443129 38480021...
output:
1455
result:
ok single line: '1455'
Test #82:
score: 0
Accepted
time: 44ms
memory: 435276kb
input:
3000 9228929 485785125 9228929 395682053 9228929 358472899 9228929 431668216 9228929 216256604 9228929 6879232 9228929 315622299 9228929 374203162 9228929 289304448 9228929 131000293 9228929 137680041 9228929 21572347 9228929 79529645 9228929 145908170 9228929 443835012 9228929 1878388 9228929 13568...
output:
3000
result:
ok single line: '3000'
Test #83:
score: 0
Accepted
time: 36ms
memory: 435108kb
input:
3000 88487675 255907968 87190710 255907968 377350974 255907968 335538091 255907968 479513079 255907968 471709072 255907968 158868977 255907968 109963522 255907968 223617504 255907968 131254778 255907968 92718857 255907968 219132812 255907968 496111812 255907968 229883943 255907968 217944728 25590796...
output:
3000
result:
ok single line: '3000'
Test #84:
score: 0
Accepted
time: 27ms
memory: 435276kb
input:
3000 0 0 0 296422 296422 0 296422 296422 592844 0 592844 296422 889266 0 889266 296422 1185688 0 1185688 296422 1482110 0 1482110 296422 1778532 0 1778532 296422 2074954 0 2074954 296422 2371376 0 2371376 296422 2667798 0 2667798 296422 2964220 0 2964220 296422 3260642 0 3260642 296422 3557064 0 355...
output:
1502
result:
ok single line: '1502'
Test #85:
score: 0
Accepted
time: 28ms
memory: 434748kb
input:
3000 0 0 0 638119 0 1276238 0 1914357 0 2552476 0 3190595 0 3828714 0 4466833 0 5104952 0 5743071 0 6381190 0 7019309 638119 0 638119 638119 638119 1276238 638119 1914357 638119 2552476 638119 3190595 638119 3828714 638119 4466833 638119 5104952 638119 5743071 638119 6381190 638119 7019309 1276238 0...
output:
327
result:
ok single line: '327'
Test #86:
score: 0
Accepted
time: 48ms
memory: 434932kb
input:
3000 0 0 0 2038837 0 4077674 0 6116511 0 8155348 0 10194185 0 12233022 0 14271859 0 16310696 0 18349533 0 20388370 0 22427207 0 24466044 0 26504881 0 28543718 0 30582555 0 32621392 0 34660229 0 36699066 0 38737903 0 40776740 0 42815577 0 44854414 0 46893251 0 48932088 0 50970925 0 53009762 0 5504859...
output:
975
result:
ok single line: '975'
Test #87:
score: 0
Accepted
time: 43ms
memory: 435284kb
input:
3000 0 0 0 233716 0 467432 0 701148 0 934864 0 1168580 0 1402296 0 1636012 0 1869728 0 2103444 0 2337160 0 2570876 0 2804592 0 3038308 0 3272024 0 3505740 0 3739456 0 3973172 0 4206888 0 4440604 0 4674320 0 4908036 0 5141752 0 5375468 0 5609184 0 5842900 0 6076616 0 6310332 0 6544048 0 6777764 0 701...
output:
737
result:
ok single line: '737'
Test #88:
score: 0
Accepted
time: 28ms
memory: 435208kb
input:
3000 0 0 500000000 500000000 1 1 499999999 499999999 2 2 499999998 499999998 3 3 499999997 499999997 4 4 499999996 499999996 5 5 499999995 499999995 6 6 499999994 499999994 7 7 499999993 499999993 8 8 499999992 499999992 9 9 499999991 499999991 10 10 499999990 499999990 11 11 499999989 499999989 12 ...
output:
3000
result:
ok single line: '3000'
Test #89:
score: 0
Accepted
time: 19ms
memory: 434948kb
input:
3000 250000000 250000000 249792139 250002575 250739671 250004307 249999267 250913445 248999621 250000311 250677159 250002109 249999131 249794863 250003592 249406584 249984289 250000149 250931061 250003173 250950953 250002451 249998586 249626026 251107612 250004410 248882044 250003074 250919555 25000...
output:
3000
result:
ok single line: '3000'
Test #90:
score: 0
Accepted
time: 24ms
memory: 434588kb
input:
3000 250000000 250000000 250000247 250078691 248812835 249999527 250009715 251188681 250008881 251053815 250400560 249990186 248743370 250003884 250009340 251046326 250860326 249998692 248815654 249999364 249142748 249998646 249890301 250000381 250415113 249990649 250002648 249393576 251515178 25000...
output:
3000
result:
ok single line: '3000'
Subtask #6:
score: 32
Accepted
Dependency #4:
100%
Accepted
Test #91:
score: 32
Accepted
time: 432ms
memory: 437344kb
input:
80000 39772 49797 42645 21752 3750 24714 56063 16086 45464 78490 22234 62651 7443 32012 78851 67 29641 18065 11087 6428 22716 23076 37606 60239 57926 65155 17749 25395 69043 15440 30029 69615 17976 62881 62073 29508 35832 17380 2647 3371 45336 56741 8853 26846 8443 65043 59761 38058 55740 39480 1207...
output:
2
result:
ok single line: '2'
Test #92:
score: 0
Accepted
time: 572ms
memory: 438060kb
input:
100000 17065 16991 94459 9457 26695 31071 15348 5283 64423 49940 9789 66388 78402 73367 17007 9061 4540 6292 21196 51704 43068 60860 64881 12244 33306 5124 9613 37724 62464 10286 76731 33868 9570 39549 62945 8940 54232 37056 14685 43699 14564 74569 37849 30716 49160 95385 4838 94073 64532 59289 8661...
output:
4
result:
ok single line: '4'
Test #93:
score: 0
Accepted
time: 645ms
memory: 438436kb
input:
100000 326458701 442904716 475834957 1961024 81040647 127107571 381329854 150874351 346676903 410891314 373239333 182095804 2226832 30036753 275677918 156281242 244051354 468974213 158487637 137251404 65307618 209289322 84553125 295370673 222118671 215183185 319648033 158778391 8846396 36350366 3953...
output:
1
result:
ok single line: '1'
Test #94:
score: 0
Accepted
time: 667ms
memory: 438216kb
input:
100000 0 0 88601 88601 27203 27203 62934 62934 42163 42163 80298 80298 8381 8381 68235 68235 93820 93820 20078 20078 48491 48491 2303 2303 88301 88301 5416 5416 80629 80629 70477 70477 53917 53917 9941 9941 50091 50091 60595 60595 35088 35088 9842 9842 92057 92057 98358 98358 61214 61214 61322 61322...
output:
100000
result:
ok single line: '100000'
Test #95:
score: 0
Accepted
time: 1183ms
memory: 438144kb
input:
100000 331948893 260664790 367538071 296253968 314574097 243289994 378412834 307128731 372363563 301079460 386273001 314988898 386876497 315592394 309851486 238567383 350017540 278733437 370876739 299592636 338768905 267484802 341714354 270430251 315496548 244212445 354041052 282756949 364641298 293...
output:
100000
result:
ok single line: '100000'
Test #96:
score: 0
Accepted
time: 640ms
memory: 438344kb
input:
100000 212890360 175270154 317561766 137646949 448707451 284706141 65830273 132068187 391030904 333126300 28173848 59277105 212029346 266727124 96606335 269749815 284195868 394689853 77482562 86866970 322301158 453182399 183473161 210942356 244906206 277880488 336629988 15793938 150145024 240221735 ...
output:
117
result:
ok single line: '117'
Test #97:
score: 0
Accepted
time: 565ms
memory: 438136kb
input:
100000 3154537 2951963 3983837 1845159 1441403 4306260 1824688 2611588 1889076 2755910 452714 512084 2631836 2043766 2777275 1138201 374686 3990907 4727286 3125843 4677920 4008973 3814790 4324394 3351745 969758 3241114 4686203 3337209 2773808 3290405 65915 4498087 3588129 1398682 3719082 3434716 345...
output:
1697
result:
ok single line: '1697'
Test #98:
score: 0
Accepted
time: 676ms
memory: 438200kb
input:
100000 201858288 221086680 214999664 218546778 197384854 215890382 216183402 230327498 204563300 211300194 205924188 226760586 217792634 215047736 209847158 218848004 209438319 237072581 200354062 218859590 214325503 220703891 208115648 214852542 217380621 227718653 221147762 218696056 213057252 217...
output:
7706
result:
ok single line: '7706'
Test #99:
score: 0
Accepted
time: 640ms
memory: 438348kb
input:
100000 309446559 195907276 217670986 313371020 446526343 207772416 311533149 196502748 246525077 414785511 489494008 388784623 44618859 47929209 468901780 73338469 263138948 201165630 59858514 69439304 22528957 86035942 424727474 399557451 455701250 210078412 90431931 412432924 445026012 499185115 1...
output:
165
result:
ok single line: '165'
Test #100:
score: 0
Accepted
time: 640ms
memory: 438312kb
input:
100000 277900242 258684917 147360274 317639685 205709205 154527497 477655324 383702712 491422414 53464445 154744495 115151122 180545252 71071941 7830243 450424877 142000450 277091565 119245828 424565890 349224110 174602176 229972884 497387407 135685812 303521813 345850196 9854509 358594213 392992156...
output:
7260
result:
ok single line: '7260'
Test #101:
score: 0
Accepted
time: 799ms
memory: 438332kb
input:
100000 180930344 328904850 162407361 207952441 264875950 323051786 215109969 333238259 180882803 296728479 60031545 337467467 162176348 207721428 119460018 331289288 174836312 288592120 264575294 330594004 66049814 331449198 157757405 450281559 66591957 330907055 63540940 333958072 214754035 3335941...
output:
100000
result:
ok single line: '100000'
Test #102:
score: 0
Accepted
time: 641ms
memory: 438192kb
input:
100000 250000000 250000000 33019480 185475400 36525317 499545610 17187381 387467366 375014400 236978429 423339258 409701166 152886846 173144632 174287479 320329730 392427972 77402892 48770590 416999727 497005571 384686480 478955448 340280654 330097189 136087642 237749180 197949052 498005469 65112625...
output:
180
result:
ok single line: '180'
Test #103:
score: 0
Accepted
time: 765ms
memory: 438464kb
input:
100000 250000000 250000000 249972817 275879879 203571700 250081440 246077453 250007327 296072628 250081956 250038678 235713562 250014232 209791340 249994331 205006303 279543843 250028777 249996621 292920147 250017870 210061680 249978464 217879932 250000401 216473653 250004655 248329237 271720067 250...
output:
100000
result:
ok single line: '100000'
Test #104:
score: 0
Accepted
time: 780ms
memory: 438368kb
input:
100000 250000000 250000000 238448374 249980290 249989854 248463418 275784621 249886027 215057150 249860630 221299189 249862015 284752666 249853228 265895510 249927054 250039916 292898142 250025319 224945617 250058628 293962348 250015935 282019223 261905936 249977136 247994720 249989586 250042404 289...
output:
100000
result:
ok single line: '100000'
Subtask #7:
score: 31
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Test #105:
score: 31
Accepted
time: 431ms
memory: 437772kb
input:
80000 84 272 262 78 277 19 149 14 4 232 123 132 86 233 24 214 52 160 67 124 215 293 226 155 181 290 246 115 91 77 207 233 226 109 242 221 74 271 131 105 139 157 85 244 190 174 55 209 10 168 163 228 94 51 93 179 208 221 3 132 176 105 122 292 138 215 258 202 87 42 222 234 52 233 64 8 200 133 62 159 20...
output:
77338
result:
ok single line: '77338'
Test #106:
score: 0
Accepted
time: 570ms
memory: 438256kb
input:
100000 371 88 2 274 7 99 44 249 337 298 326 305 231 299 256 156 72 59 92 48 250 61 230 135 7 292 17 68 22 332 264 220 68 148 105 205 167 258 290 99 225 369 166 160 31 131 334 255 311 113 141 256 241 219 267 35 353 113 82 173 10 88 315 50 264 22 188 182 160 140 81 226 397 9 308 95 365 219 156 383 291...
output:
91226
result:
ok single line: '91226'
Test #107:
score: 0
Accepted
time: 788ms
memory: 438196kb
input:
100000 324 358 567 404 684 32 429 494 4 450 235 52 174 230 178 76 584 148 501 124 247 22 17 450 317 459 37 305 617 463 668 318 268 523 522 307 692 652 335 352 461 258 208 653 363 588 675 555 696 540 119 285 153 229 462 327 515 493 253 345 134 580 410 185 94 124 371 172 53 188 676 219 410 167 667 219...
output:
100000
result:
ok single line: '100000'
Test #108:
score: 0
Accepted
time: 839ms
memory: 438072kb
input:
100000 1305 186 685 1386 904 1409 448 180 1269 25 1313 1209 506 1507 659 654 1141 710 1417 271 398 829 423 1250 790 60 1211 972 731 907 1560 569 898 773 0 1211 837 952 976 1507 1439 658 304 199 564 945 585 424 1014 664 807 1033 331 573 531 279 1422 428 1541 408 625 1144 623 1343 1373 1058 1 700 710 ...
output:
88536
result:
ok single line: '88536'
Test #109:
score: 0
Accepted
time: 499ms
memory: 438260kb
input:
100000 1938 1424 4159 5137 8299 6506 119 6366 4534 7841 1356 1668 2957 6016 7677 7010 5491 7523 1078 7330 1816 9406 831 5623 2319 6422 7388 7458 3436 4611 5923 4358 9630 2276 8691 5040 553 8557 3189 6871 547 154 6571 6363 8322 4726 9912 1801 4191 614 5283 5529 4084 404 5554 500 2876 7380 3316 1651 3...
output:
4483
result:
ok single line: '4483'
Test #110:
score: 0
Accepted
time: 546ms
memory: 438216kb
input:
100000 7940 76156 84405 21435 73550 61174 75035 7861 21554 98187 8723 61827 12600 80140 8583 21682 23268 51958 22622 52128 26950 18916 72070 62844 47592 8735 2821 10717 12603 11258 67590 46563 85387 21302 80755 4037 7309 9203 13115 74431 65565 64115 22393 93627 83597 13171 68244 67388 56975 22986 18...
output:
8
result:
ok single line: '8'
Test #111:
score: 0
Accepted
time: 636ms
memory: 438400kb
input:
100000 468102859 489063317 99393206 393549931 139093135 496664654 194350609 65492645 241482645 411989455 67607174 390614821 383842651 250555281 57549590 403385504 353943704 220261712 277569240 64323727 41515877 353878710 108706351 285300953 15927313 418063613 376096522 171239478 123605645 392023098 ...
output:
1
result:
ok single line: '1'
Test #112:
score: 0
Accepted
time: 530ms
memory: 438300kb
input:
100000 286972 317485 69546 172887 470637 407110 310020 435590 215863 375504 92295 60012 39232 12140 240411 428129 376122 14688 473394 469364 37178 399087 373451 134682 448546 62215 237051 133684 183890 22110 25208 221226 195648 436874 92092 414108 423200 336159 490942 442826 95428 40579 81161 332809...
output:
188
result:
ok single line: '188'
Test #113:
score: 0
Accepted
time: 537ms
memory: 438240kb
input:
100000 236415 215990 181487 390742 350760 290363 134862 202074 295489 474011 128142 383267 404722 386809 399577 116342 103699 265693 15408 542 275596 337737 197218 110430 306168 83786 199122 171146 192931 305777 141560 408242 330133 108758 333238 182072 221137 187562 8908 371176 213823 272170 62461 ...
output:
1711
result:
ok single line: '1711'
Test #114:
score: 0
Accepted
time: 958ms
memory: 438204kb
input:
100000 433933 531457 465898 509756 445870 518914 442178 547792 419091 536097 456997 523161 449339 539905 449758 525896 450783 529985 450603 525051 452433 520575 456485 545533 446569 541713 446335 535597 463610 541954 444960 526064 458733 524897 419663 542695 423515 552677 443459 527565 448159 540221...
output:
74089
result:
ok single line: '74089'
Test #115:
score: 0
Accepted
time: 690ms
memory: 438036kb
input:
100000 283135876 232460372 277450177 231462333 283461124 222751166 293286970 225053174 300234425 220781239 288949926 216366698 295888185 221329681 302428495 226815487 295561182 231025878 296371259 220809835 284252697 224862249 288951868 229282334 287604344 227129790 300390661 214488147 289980072 216...
output:
12705
result:
ok single line: '12705'
Test #116:
score: 0
Accepted
time: 537ms
memory: 438216kb
input:
100000 183867 290379 220491 100738 227331 47620 264880 122081 114202 460275 145582 217 334883 386261 242688 156069 363122 73749 144587 391139 191460 328717 404012 18592 8544 238166 178865 441618 452312 487639 351010 377764 105629 364400 89902 19640 6548 335450 260480 445975 178729 47957 47238 138190...
output:
209
result:
ok single line: '209'
Test #117:
score: 0
Accepted
time: 550ms
memory: 438376kb
input:
100000 221940 271886 491561 226857 387806 287392 300537 5504 15086 30737 139570 279925 79726 5278 127896 151142 35975 405923 498015 246186 255955 431986 140514 456089 125292 310787 392824 420861 116992 108375 334293 221128 191893 288124 87532 311952 221140 269660 10232 279109 220323 268843 110536 49...
output:
8653
result:
ok single line: '8653'
Test #118:
score: 0
Accepted
time: 923ms
memory: 438004kb
input:
100000 505190 401525 264895 414360 661793 392290 469867 231342 422829 410346 264589 414666 416444 404593 685027 401584 351767 404984 499720 293359 420145 400892 498166 416781 505316 499165 503580 509505 215810 408985 678567 408044 640436 408457 493093 525612 467901 612256 494825 361892 466639 187222...
output:
100000
result:
ok single line: '100000'
Test #119:
score: 0
Accepted
time: 942ms
memory: 438192kb
input:
100000 242897943 198554365 114595599 186532993 249939623 293790903 241858164 264835304 241625659 128232157 343644203 189318835 248178226 211607256 323453256 186267096 291058947 195993185 245248510 91206992 259568804 200986980 198242157 200635353 241790232 185341142 250186595 296998701 291081382 1943...
output:
100000
result:
ok single line: '100000'
Test #120:
score: 0
Accepted
time: 535ms
memory: 438196kb
input:
100000 250000 250000 239662 443302 98070 314741 369839 95656 179594 261847 134951 355651 113450 267430 227322 389959 439884 281931 184235 300944 194788 46204 275835 246210 284247 308544 135195 233659 38937 415769 379429 323991 183671 391634 3119 356387 74934 284654 446053 162586 114657 10347 157883 ...
output:
252
result:
ok single line: '252'
Test #121:
score: 0
Accepted
time: 683ms
memory: 438228kb
input:
100000 250000000 250000000 222033692 212483408 310619080 171232684 49905190 186804099 151356590 349212886 480745865 160840202 413680515 202333880 352773217 70036693 28754601 201529446 473714419 447982271 37729789 122832821 5337813 193355275 249995035 246729291 393312102 347516183 493965670 160832244...
output:
20003
result:
ok single line: '20003'
Test #122:
score: 0
Accepted
time: 760ms
memory: 438048kb
input:
100000 250000000 250000000 244774368 249989696 183914266 125261063 3160342 27680934 210782977 410998273 249977141 256971337 20775478 293305026 296891003 255507347 249975017 236809987 249981609 244449899 283743449 91173746 400640265 326012571 2126292 312006485 316445535 253828581 249966771 262304429 ...
output:
30004
result:
ok single line: '30004'
Test #123:
score: 0
Accepted
time: 642ms
memory: 438288kb
input:
100000 299190 466775 299190 246521 299190 132412 299190 258211 299190 43778 299190 441140 299190 237138 299190 55005 299190 152396 299190 39293 299190 382489 299190 29746 299190 28224 299190 422780 299190 326133 299190 67449 299190 4536 299190 425251 299190 49023 299190 181054 299190 313366 299190 9...
output:
100000
result:
ok single line: '100000'
Test #124:
score: 0
Accepted
time: 812ms
memory: 438332kb
input:
100000 443242732 131835974 353811505 131835974 345241487 131835974 296576200 131835974 207871253 131835974 389097111 131835974 163792153 131835974 272575457 131835974 58413317 131835974 31940559 131835974 176069816 131835974 495401684 131835974 410968001 131835974 290612679 131835974 326508928 13183...
output:
100000
result:
ok single line: '100000'
Test #125:
score: 0
Accepted
time: 378ms
memory: 438136kb
input:
100000 0 0 0 7585 7585 0 7585 7585 15170 0 15170 7585 22755 0 22755 7585 30340 0 30340 7585 37925 0 37925 7585 45510 0 45510 7585 53095 0 53095 7585 60680 0 60680 7585 68265 0 68265 7585 75850 0 75850 7585 83435 0 83435 7585 91020 0 91020 7585 98605 0 98605 7585 106190 0 106190 7585 113775 0 113775 ...
output:
50002
result:
ok single line: '50002'
Test #126:
score: 0
Accepted
time: 347ms
memory: 438064kb
input:
100000 0 0 0 28019 0 56038 0 84057 0 112076 0 140095 0 168114 0 196133 0 224152 0 252171 0 280190 0 308209 28019 0 28019 28019 28019 56038 28019 84057 28019 112076 28019 140095 28019 168114 28019 196133 28019 224152 28019 252171 28019 280190 28019 308209 56038 0 56038 28019 56038 56038 56038 84057 5...
output:
8411
result:
ok single line: '8411'
Test #127:
score: 0
Accepted
time: 556ms
memory: 438076kb
input:
100000 0 0 0 594354 0 1188708 0 1783062 0 2377416 0 2971770 0 3566124 0 4160478 0 4754832 0 5349186 0 5943540 0 6537894 0 7132248 0 7726602 0 8320956 0 8915310 0 9509664 0 10104018 0 10698372 0 11292726 0 11887080 0 12481434 0 13075788 0 13670142 0 14264496 0 14858850 0 15453204 0 16047558 0 1664191...
output:
26486
result:
ok single line: '26486'
Test #128:
score: 0
Accepted
time: 432ms
memory: 438136kb
input:
100000 0 0 0 107360 0 214720 0 322080 0 429440 0 536800 0 644160 0 751520 0 858880 0 966240 0 1073600 0 1180960 0 1288320 0 1395680 0 1503040 0 1610400 0 1717760 0 1825120 0 1932480 0 2039840 0 2147200 0 2254560 0 2361920 0 2469280 0 2576640 0 2684000 0 2791360 0 2898720 0 3006080 0 3113440 0 322080...
output:
3347
result:
ok single line: '3347'
Test #129:
score: 0
Accepted
time: 443ms
memory: 437960kb
input:
100000 0 0 0 5576 0 11152 0 16728 0 22304 0 27880 0 33456 0 39032 0 44608 0 50184 0 55760 0 61336 0 66912 0 72488 0 78064 0 83640 0 89216 0 94792 0 100368 0 105944 0 111520 0 117096 0 122672 0 128248 0 133824 0 139400 0 144976 0 150552 0 156128 0 161704 0 167280 0 172856 0 178432 0 184008 0 189584 0...
output:
24403
result:
ok single line: '24403'
Extra Test:
score: 0
Extra Test Passed