QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#85618#9020. 测测你的半平面修改查询Scintilla55 1201ms59748kbC++146.1kb2023-03-07 22:59:472023-03-07 22:59:51

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-07 22:59:51]
  • 评测
  • 测评结果:55
  • 用时:1201ms
  • 内存:59748kb
  • [2023-03-07 22:59:47]
  • 提交

answer

#pragma GCC optimize("O2")
#include "hpmq.h"
#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb emplace_back
#define rep(i, s, e) for (int i = s; i <= e; ++i)
#define drep(i, s, e) for (int i = s; i >= e; --i)
#define file(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout)
#define pv(a) cout << #a << " = " << a << endl
#define pa(a, l, r) cout << #a " : "; rep(_, l, r) cout << a[_] << ' '; cout << endl

using ull = unsigned long long;
using pii = pair <int, int>;

const int INF = 0x3f3f3f3f;

const int N = 6e5 + 10;
const int M = 3e4 + 10;

int read() {
  int x = 0, f = 1; char c = getchar();
  for (; c < '0' || c > '9'; c = getchar()) if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48;
  return x * f;
}

mt19937_64 rng(time(0));
int Rand(int l, int r) {
  return l + rng() % (r - l + 1);
}

struct frac {
  int p, q;
  frac(int _p = 0, int _q = 1) {
    p = _p, q = _q;
    if (q < 0) p = -p, q = -q;
  }
  friend bool operator < (frac a, frac b) {
    return 1ll * a.p * b.q < 1ll * b.p * a.q;
  }
  friend bool operator == (frac a, frac b) {
    return 1ll * a.p * b.q == 1ll * b.p * a.q;
  }
  void print() {
    printf("%d/%d\n", p, q);
  }
} ;

struct vec {
  int x, y;
  void init() {
    x = read(), y = read();
  }
  friend bool operator < (vec a, vec b) {
    return a.x == b.x ? a.y < b.y : a.x < b.x;
  }
  void print() {
    printf("(%d, %d)\n", x, y);
  }
} ;

struct line {
  int a, b, c;
  frac k;
  line(int _a = 0, int _b = 1, int _c = 0) {
    a = _a, b = _b, c = -_c;
    k = frac(-a, b);
  }
  bool chk(vec p) {
    return a * p.x + b * p.y + c < 0;
  }
  bool above(vec p) {
    if (b > 0) return a * p.x + b * p.y + c < 0;
    else return a * p.x + b * p.y + c > 0;
  }
  friend bool operator < (line l1, line l2) {
    if (l1.k == l2.k) return frac(-l1.c, l1.b) < frac(-l2.c, l2.b);
    else return l2.k < l1.k;
  }
} ;

frac inter(line l1, line l2) {
  return frac(l2.c * l1.b - l1.c * l2.b, l1.a * l2.b - l2.a * l1.b);
}

#define ls lson[u]
#define rs rson[u]

int tot, lson[N], rson[N];
vec p[N];
Data dat[N];
Operation laz[N];

void down(int u, Operation o) {
  o.apply(dat[u]);
  o.apply(laz[u]);
}

void pushdown(int u) {
  down(ls, laz[u]);
  down(rs, laz[u]);
  laz[u].clr();
}

void maintain(int u) {
  p[u] = p[ls];
  dat[u].add(dat[ls], dat[rs]);
}

int newnode() {
  return ++ tot;
}

void undo() {
  pushdown(tot);
  lson[tot] = rson[tot] = 0;
  p[tot] = vec();
  dat[tot].clr();
  -- tot;
}

struct O {
  line l;
  Operation o;
} op[N];

int n, m, B, rk[N];
ull pre[N], suf[N], h[N], key[N];

void solve(int l, int r, vector <int> c) {
  int len = r - l + 1, cur = tot;
  auto work = [&]() {
    for (auto it : c) h[it] = 0;
    vector <int> ord;
    rep(i, l, r) ord.pb(i);
    sort(ord.begin(), ord.end(), [&](int i, int j) {
      return op[i].l < op[j].l;
    });
    rep(i, 0, len - 1) {
      key[ord[i]] = rng() % (1ll << 60);
      pre[ord[i]] = i ? pre[ord[i - 1]] : 0;
      if (op[ord[i]].l.b < 0) pre[ord[i]] ^= key[ord[i]];
      rk[ord[i]] = i;
    }
    drep(i, len - 1, 0) {
      suf[ord[i]] = i < len - 1 ? suf[ord[i + 1]] : 0;
      if (op[ord[i]].l.b > 0) suf[ord[i]] ^= key[ord[i]];
    }
    sort(c.begin(), c.end(), [&](int i, int j) {
      return p[i] < p[j];
    });
    vector <pair <frac, pii> > px;
    rep(i, 0, len - 1) rep(j, i + 1, len - 1) if (op[ord[j]].l.k < op[ord[i]].l.k) {
      px.pb(mp(inter(op[ord[i]].l, op[ord[j]].l), mp(ord[i], ord[j])));
    }
    px.pb(mp(frac(INF, 1), mp(0, 0)));
    sort(px.begin(), px.end(), [&](pair <frac, pii> a, pair <frac, pii> b) {
      if (a.first == b.first) {
        if (rk[a.second.first] == rk[b.second.first]) {
          return rk[a.second.second] < rk[b.second.second];
        }
        else return rk[a.second.first] < rk[b.second.first];
      }
      else return a.first < b.first;
    });
    for (int i = 0, j = 0; i < px.size(); ++ i) {
      for (; j < c.size() && p[c[j]].x < px[i].first; ++ j) {
        auto it = partition_point(ord.begin(), ord.end(), [&](int k) {
          return !op[k].l.above(p[c[j]]);
        });
        if (it != ord.end()) h[c[j]] ^= suf[*it];
        if (it != ord.begin()) h[c[j]] ^= pre[*(-- it)];
      }
      int u = px[i].second.first, v = px[i].second.second;
      if (!u && !v) continue;
      assert(rk[u] + 1 == rk[v]);
      swap(ord[rk[u]], ord[rk[v]]);
      swap(rk[u], rk[v]);
      if (op[u].l.b < 0) pre[v] ^= key[u];
      else suf[v] ^= key[u];
      if (op[v].l.b < 0) pre[u] ^= key[v];
      else suf[u] ^= key[v];
    }
    sort(c.begin(), c.end(), [&](int i, int j) {
      return h[i] < h[j];
    });
    vector <int> nc;
    for (int i = 0, j; i < c.size(); i = j + 1) {
      for (j = i; j + 1 < c.size() && h[c[j + 1]] == h[c[i]]; ++ j) ;
      if (i < j) {
        rep(k, i + 1, j) {
          int u = newnode();
          ls = k == i + 1 ? c[i] : u - 1, rs = c[k];
          maintain(u);
        }
        nc.pb(tot);
      }
      else nc.pb(c[i]);
    }
    c = nc;
  } ;
  work();
  if (l == r) {
    bool flag = false;
    for (auto it : c) {
      if (op[l].l.chk(p[it])) {
        dat[it].print();
        down(it, op[l].o);
        flag = true;
        break;
      }
    }
    if (!flag) Data().print();
    while (tot > cur) undo();
    return;
  }
  int mid = (l + r) >> 1;
  solve(l, mid, c);
  solve(mid + 1, r, c);
  while (tot > cur) undo();
}

#undef ls
#undef rs

void solve(const int _n, const int _m, const int *_x, const int *_y, const Data *_d, 
const int *_a, const int *_b, const int *_c, const Operation *_o) {
  n = _n, m = _m, tot = n, B = int(sqrt(n * 2 / 3)) + 1;
  rep(i, 1, n) p[i].x = _x[i - 1], p[i].y = _y[i - 1], dat[i] = _d[i - 1];
  rep(i, 1, m) op[i].l = line(_a[i - 1], _b[i - 1], _c[i - 1]), op[i].o = _o[i - 1];
  for (int l = 1, r; l <= m; l = r + 1) {
    r = min(l + B - 1, m);
    vector <int> all;
    rep(i, 1, n) all.pb(i);
    solve(l, r, all);
  }
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 91ms
memory: 32180kb

input:

20000
5245 -9733 6
2898 -2273 6
-3025 13598 7
-2111 542 3
-913 -1516 6
-1525 -1050 2
17646 4583 6
-2101 -1295 10
-635 1367 4
-2828 1004 6
-1497 -2603 5
-3415 -3290 7
3995 -6478 2
-2093 -203 6
2748 181 9
-9456 206 6
-15645 14633 9
-4783 555 3
-4383 425 5
-20919 36410 1
1921 -405 1
3934 8809 4
-1303 -...

output:

1012145
1184568235

result:

ok The answer is correct.

Test #2:

score: 0
Accepted
time: 89ms
memory: 32292kb

input:

20000
686 -1046 4
694 850 10
-830 -8542 1
-795 1008 7
12881 -3183 1
961 -394 1
-1031 -259 2
8442 -2883 7
-14 -1204 1
1121 418 1
1102 -453 9
-574 -827 5
4775 -1978 7
1006 2061 5
3575 1146 7
-546 -934 6
1037 -159 1
-965 -304 2
-878 -573 5
345 1893 6
-1080 5502 3
-294 1155 10
1789 -2 5
217 1179 6
911 -...

output:

1034148
1565105122

result:

ok The answer is correct.

Test #3:

score: 0
Accepted
time: 93ms
memory: 32120kb

input:

20000
11122 -11638 4
-1740 -5825 9
-3944 2250 8
1964 983 2
-4102 2439 2
11896 -2032 4
-6247 -3805 8
-875 -2529 10
81 4894 5
-2103 -227 7
1819 2958 2
2822 5467 2
5556 -8941 6
11961 7486 6
-1291 -2731 2
20342 -1088 1
194 3036 10
-6729 5391 1
1164 1694 10
-34776 -45966 3
622 -2586 6
1607 -4155 6
-22275...

output:

1015416
3203875655

result:

ok The answer is correct.

Test #4:

score: 0
Accepted
time: 88ms
memory: 32188kb

input:

20000
438860 -73910 1
228935 75600 4
-961920 188700 8
660015 655330 6
-18922 196153 2
-855750 819770 5
40151 -175778 4
145568 92246 3
512816 147766 2
207512 182989 9
134174 31956 10
178622 -186978 6
-343680 100680 6
115980 305670 8
-174382 307699 9
478417 373980 2
-201400 -102780 5
-71050 -612550 3
...

output:

981659
2618948775

result:

ok The answer is correct.

Test #5:

score: 0
Accepted
time: 68ms
memory: 32164kb

input:

20000
398519 123762 8
-571339 -86531 4
-241091 447702 5
-96819 557807 1
124523 -180638 10
420494 -575313 5
-589407 278420 8
-805008 -160484 7
-231491 -328375 1
283671 -132403 8
285203 612859 7
-354672 -47543 4
624976 40852 7
-386647 -33515 9
-122556 389227 8
535015 -282411 5
-16618 -949802 10
-74675...

output:

896972
2246548101

result:

ok The answer is correct.

Test #6:

score: 0
Accepted
time: 100ms
memory: 32124kb

input:

20000
6889 -29721 8
-1036 12027 6
10547 -290 8
-10371 -677 8
-3756 898 3
4874 -2930 5
-7515 6173 8
12336 1374 10
174220 -173020 8
4985 -1557 10
3230 10378 8
-9111 -4121 10
10509 -534 8
-11098 -2764 6
-44859 -51666 4
188 -13280 2
-8390 5440 5
-5333 -11150 2
3908 -17979 1
-7398 -17442 9
16424 3525 5
2...

output:

985232
389229703

result:

ok The answer is correct.

Test #7:

score: 0
Accepted
time: 83ms
memory: 31916kb

input:

20000
1633 259 5
579 -1029 1
498 1139 7
171 474 6
675 -85 8
371 -52 9
-2073 2829 8
-5 -1111 10
-795 195 9
-11 144 8
-238 41 1
405 614 3
128 410 10
-324 -1193 8
-4317 7438 2
-236 300 5
420 -629 2
509 637 4
-436 228 5
-246 581 2
189 1385 2
1363 1816 5
553 -344 6
-148 -108 1
190 450 5
659 -1115 4
202 -...

output:

994063
2817220556

result:

ok The answer is correct.

Test #8:

score: 0
Accepted
time: 76ms
memory: 32164kb

input:

20000
0 -1 2
0 7 1
-998285 499142 9
209116 418238 2
91751 -183498 5
-4 -2 8
-2 -2 7
5 -1 2
-1 -3 1
-5 6 9
-34226 68447 8
-810116 -405054 1
80050 -160092 1
1 -2 7
1 -5 10
0 4 4
-7 -1 1
3 1 9
-1 7 2
2 -2 1
-123822 247644 10
-3 -2 4
-5 -4 7
-6 8 8
157702 -315413 9
2 -1 5
-4 0 10
3 0 10
-205546 -411093 ...

output:

844706
905897730

result:

ok The answer is correct.

Test #9:

score: 0
Accepted
time: 75ms
memory: 32224kb

input:

20000
-478255 358690 10
-1 2 7
306414 -153207 2
-1 3 5
-313442 -313441 5
204483 -102240 10
-2 -2 6
-851493 -425749 3
-53735 161214 5
302522 -453784 6
-303898 -151948 2
5 -3 6
-55683 83527 10
-302149 453227 7
-104583 -104585 8
-115225 172834 5
2 0 2
108784 81588 3
14 5 6
146710 97808 8
73175 48782 1
...

output:

898151
1748878069

result:

ok The answer is correct.

Test #10:

score: 0
Accepted
time: 43ms
memory: 32256kb

input:

20000
-999566 -999553 7
-998415 -998413 9
-999637 -999642 4
-999533 -999541 6
-999217 -999213 9
-998699 -998689 6
-998866 -998859 3
-999344 -999343 2
-999057 -999048 1
-999927 -999932 6
-999270 -999270 9
-999063 -999065 9
-998815 -998804 4
-998534 -998545 7
-999423 -999431 10
-999510 -999503 1
-9991...

output:

779488
795812623

result:

ok The answer is correct.

Test #11:

score: 0
Accepted
time: 42ms
memory: 32180kb

input:

20000
-999587 -999588 8
-998343 -998350 6
-999715 -999715 4
-999162 -999156 2
-998649 -998641 4
-998063 -998061 10
-997911 -997919 5
-998540 -998541 10
-998798 -998786 6
-998314 -998318 10
-998657 -998657 6
-998880 -998870 4
-998577 -998568 2
-998593 -998593 5
-999079 -999084 2
-997241 -997245 6
-99...

output:

773694
1011088017

result:

ok The answer is correct.

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #12:

score: 0
Wrong Answer
time: 82ms
memory: 32276kb

input:

20000
2641 1830 6
-2037 -206 1
-6986 489 3
-3427 3874 9
-810 -5729 8
-48 -797 3
3035 1378 1
9159 -7860 2
-3123 -7198 6
2024 -417 4
3348 -7912 7
1093 1896 1
2878 2836 1
906 1826 3
-1728 2809 10
-12842 5268 7
2552 -225 8
20452 22770 5
2793 2016 10
-1624 592 4
-1838 6563 7
-4113 2448 4
4533 -2058 8
121...

output:

1012210
2203490789

result:

wrong answer Too many operations.

Subtask #3:

score: 5
Accepted

Test #23:

score: 5
Accepted
time: 88ms
memory: 57480kb

input:

200000
-1014 -2657 4
-441 -2850 9
-860 3331 8
6027 -6526 6
144250 69365 6
-2855 -3780 9
1460 2333 6
-644 1051 10
-4535 -3692 1
3573 -175 4
232 2495 5
-3996 2251 7
6945 -17184 8
-9520 1403 1
2112 1387 8
-1205 1496 8
2673 605 10
-2820 -973 3
558 -846 2
-17020 -11100 7
868 2321 8
-580 -758 6
1785 -1253...

output:

636080
1475663463

result:

ok The answer is correct.

Test #24:

score: 0
Accepted
time: 92ms
memory: 57496kb

input:

200000
31593 29215 4
3175 -2692 10
1876 792 7
3241 797 5
-4043 12516 9
-1807 971 7
1397 -993 10
367 1284 7
175 -1027 3
-571 2811 4
-2337 978 10
-7393 40407 8
1008 -1394 6
700 -745 4
220 1192 1
3314 119 8
1049 177 1
-848 2561 8
-3393 486 1
1037 242 5
-2506 4006 10
1088 -1076 3
3576 392 3
-5294 -7256 ...

output:

637094
1700331537

result:

ok The answer is correct.

Test #25:

score: 0
Accepted
time: 81ms
memory: 58848kb

input:

200000
7482 10251 7
-674 -3115 8
-12482 29166 2
3410 5181 6
2023 -111 9
-3389 1076 6
-665 -4545 2
-128926 179024 5
-36372 22327 3
20097 2525 9
846 7500 3
2292 -9338 1
-1763 -1802 8
1416 -1420 7
129787 17300 10
1767 977 1
-5978 -1291 2
36388 8452 9
-4025 770 2
7456 4224 8
2213 -3648 5
9902 -22535 6
-...

output:

636334
4285388758

result:

ok The answer is correct.

Test #26:

score: 0
Accepted
time: 90ms
memory: 58032kb

input:

200000
696558 56906 5
-299486 80870 8
172464 -271336 7
-178465 42958 1
135682 42372 9
45648 -189508 5
242480 101920 6
441790 191460 3
57110 14232 8
72596 499038 7
-160421 165248 6
-101042 136546 10
79616 -210804 4
74530 140360 2
-273490 111650 2
52294 163321 5
44880 247930 6
-219946 -13062 8
-205985...

output:

631922
4007150453

result:

ok The answer is correct.

Test #27:

score: 0
Accepted
time: 86ms
memory: 58320kb

input:

200000
-181659 -392133 2
682822 -165783 3
-150583 -330974 4
86298 299407 6
532528 214452 2
-45743 -35689 2
-53974 459595 1
193386 91173 6
-156137 671316 1
114443 -76044 4
331684 -611676 8
-388788 466140 3
224209 650199 3
-39516 640868 2
36464 650059 3
-34812 490820 3
38927 -69366 7
348395 -451516 3
...

output:

620773
395174535

result:

ok The answer is correct.

Test #28:

score: 0
Accepted
time: 73ms
memory: 57468kb

input:

200000
2484 8786 7
-3420 -27610 8
-1367 4564 7
-9111 -4121 6
4283 -4065 6
6253 -5375 3
3310 -5763 8
4760 -8098 7
-6381 5886 1
-11724 -3846 2
5087 -3417 2
-7779 7240 4
-861 -14238 4
6165 -4350 9
-4997 489 5
-5960 -12091 5
-1031 -9170 10
1365 21322 9
-3752 -6737 1
-513980 -601268 6
-23185 18459 3
8536...

output:

632972
1650421457

result:

ok The answer is correct.

Test #29:

score: 0
Accepted
time: 80ms
memory: 57172kb

input:

200000
1537 1501 8
-117 -126 1
685 235 9
546 256 6
944 -347 3
624 890 3
362 2015 5
-2439 -200 2
-843 -630 1
149 356 9
-885 -688 3
-1851 2126 2
404 -934 8
290 -1574 3
311 -66 1
-1225 780 9
-36 624 3
260 -548 3
498 -152 2
72 -916 2
-395 -13 2
29 640 6
617 11 7
-423 -282 7
-734 -685 3
433 911 10
86 199...

output:

633315
3400699918

result:

ok The answer is correct.

Test #30:

score: 0
Accepted
time: 82ms
memory: 58092kb

input:

200000
2 3 2
-2 2 7
1 5 1
-3 2 6
2 0 5
37797 -75592 6
2 2 2
2 1 4
-6 -5 10
-356480 178236 7
197841 395680 9
-1 0 10
183874 367748 7
-309466 154735 10
0 1 10
5 3 3
388611 194301 2
1 -2 3
-4 1 4
0 0 2
127035 -254066 4
-44451 88897 1
-1 2 2
1 -3 4
53370 -106742 2
-3 1 2
642925 -321465 2
5 -4 5
151369 -...

output:

614155
2696913447

result:

ok The answer is correct.

Test #31:

score: 0
Accepted
time: 90ms
memory: 59280kb

input:

200000
15 -25 8
8 0 2
-3 0 10
344864 114958 4
-774946 387474 1
2 1 10
822507 411257 10
-1 0 4
-148954 -446867 5
-2 -4 5
-584095 292048 6
0 0 6
-118521 -237039 1
-3 1 5
-2 0 10
211814 211815 10
-45540 -22767 8
-205809 205813 3
3 3 3
982179 -245547 3
19708 39407 3
-6 -7 7
-635704 317849 8
171184 17118...

output:

618371
4028719501

result:

ok The answer is correct.

Test #32:

score: 0
Accepted
time: 51ms
memory: 57176kb

input:

200000
-999668 -999663 3
-999726 -999720 2
-999899 -999894 8
-999970 -999961 10
-999787 -999787 5
-999723 -999717 10
-999739 -999736 2
-999678 -999671 9
-999932 -999938 7
-999691 -999680 7
-999827 -999827 3
-999768 -999768 6
-999963 -999963 5
-999756 -999751 7
-999813 -999804 4
-999760 -999755 3
-99...

output:

607320
4149368756

result:

ok The answer is correct.

Test #33:

score: 0
Accepted
time: 44ms
memory: 57120kb

input:

200000
-999927 -999923 4
-999825 -999829 9
-999994 -999984 8
-999833 -999833 2
-999943 -999938 2
-999689 -999687 7
-999922 -999916 2
-999736 -999720 1
-999845 -999859 4
-999854 -999858 3
-999871 -999876 7
-999775 -999782 7
-999667 -999671 9
-999830 -999823 5
-999832 -999830 10
-999785 -999781 5
-999...

output:

607230
2525605831

result:

ok The answer is correct.

Subtask #4:

score: 15
Accepted

Dependency #3:

100%
Accepted

Test #34:

score: 15
Accepted
time: 81ms
memory: 57376kb

input:

200000
-1674 -832 7
-3834 -6457 5
-139143 -294548 1
7100 -8777 3
1687 -1816 7
3267 -3450 5
-7284 -2796 5
-2341 -1343 9
1509 -567 5
-715 -3898 7
-82 818 9
7398 -18124 4
1405 3516 9
815 1567 5
6627 3543 7
7767 15939 3
-1029 -99 2
42 931 1
2135 -1482 1
-2848 -1015 2
3665 1813 2
-2091 -1908 9
49 1263 9
...

output:

635910
3288359239

result:

ok The answer is correct.

Test #35:

score: 0
Accepted
time: 79ms
memory: 57356kb

input:

200000
1931 1008 4
17736 -10372 5
1045 -415 7
-123 1022 2
-1103 -347 9
-857 -564 9
-892 -494 9
915 2536 1
930 734 4
-1021 1166 6
392 -1141 8
-947 460 2
942 -402 1
3274 -5902 2
669 -918 2
864 509 7
1056 367 7
-376 1062 9
6608 4986 4
-1089 -182 10
-2068 -1153 5
-1067 -1556 5
292 1095 7
-3729 436 6
281...

output:

637883
3492291470

result:

ok The answer is correct.

Test #36:

score: 0
Accepted
time: 79ms
memory: 57652kb

input:

200000
-5621 9153 7
3127 -6722 6
118 1381 2
-2020 -704 2
2982 8143 5
648 -4953 2
-7951 -4988 3
553 1933 2
2341 11191 8
-6780 -8753 5
-254 6531 7
3147 -1065 5
-16628 -1069 8
1950 -539 6
98179 -26114 5
-1999 -1062 5
-14596 14346 4
-1265 -151 7
7967 -6181 8
-1013 1118 10
-1946 3960 10
-1721 -3000 4
-22...

output:

635986
1868830709

result:

ok The answer is correct.

Test #37:

score: 0
Accepted
time: 80ms
memory: 59748kb

input:

200000
-525325 665225 10
-262512 198085 9
-209457 193860 2
690080 -456008 8
-186746 -2766 1
-30004 169133 2
-64912 72465 1
-167600 371130 4
-93629 -159267 6
22257 107525 7
-19655 99940 10
-168790 -31741 2
-26062 -121367 9
16547 -128110 9
-113505 46055 1
-720677 -163328 9
329444 -122273 9
194032 1313...

output:

631756
2250220609

result:

ok The answer is correct.

Test #38:

score: 0
Accepted
time: 77ms
memory: 58204kb

input:

200000
817531 147545 2
-921621 44948 4
-89498 82295 3
46093 939349 8
322801 -380412 7
278926 454245 4
-209620 -3238 2
325161 305649 8
404511 -360449 10
-612653 -207622 9
-474893 -220870 4
472828 -322112 6
-54213 179580 6
-642401 -245004 4
-32156 -67735 4
-92357 -464176 1
-205042 -505877 1
-41734 408...

output:

620491
2368005640

result:

ok The answer is correct.

Test #39:

score: 0
Accepted
time: 76ms
memory: 57640kb

input:

200000
16891 -2286 1
-160264 -95389 4
-1560 -10082 9
-9125 8639 9
11881 28972 8
-9111 -4121 1
-56469 -24696 8
-5137 -48142 6
9417 -15399 4
46300 -36803 7
31772 -3958 3
3410 8932 2
11762 -2723 4
-3043 7127 5
9876 2097 9
-3257 -1325 5
-8390 5440 5
-6103 -12869 6
-14805 -84 10
3200 -17468 7
-2606 -1665...

output:

633561
358490033

result:

ok The answer is correct.

Test #40:

score: 0
Accepted
time: 79ms
memory: 57344kb

input:

200000
1097 -115 5
-1013 1381 8
-1842 2090 3
1527 -3651 1
-1836 -719 6
-275 -215 8
-36 -765 8
226 -24 9
1719 -2181 4
5358 -8811 6
-605 1807 6
-1561 303 2
977 462 9
-1238 -178 6
-671 95 8
-1051 40 2
-1492 -1882 10
-2299 -76 2
245 -402 1
3567 8845 2
-78 1059 8
1291 5078 5
-106 -415 2
454 503 2
332 -58...

output:

633764
1659682910

result:

ok The answer is correct.

Test #41:

score: 0
Accepted
time: 81ms
memory: 57856kb

input:

200000
0 3 2
2 2 6
-2 0 5
-1 -1 9
0 -2 8
15197 30399 10
111350 -222692 4
793088 396543 3
0 0 9
5 0 10
-8 0 5
1 1 4
7 -1 1
2 -5 1
11542 -23092 6
0 1 6
-6 0 5
-1 1 1
8 9 6
-4 0 7
-18257 -9133 10
95376 -190749 9
-215244 430499 9
-1 4 4
-6 3 6
-5 6 6
2 0 3
-676042 -338020 6
-732236 -366119 3
248616 4972...

output:

614494
1275547843

result:

ok The answer is correct.

Test #42:

score: 0
Accepted
time: 77ms
memory: 58132kb

input:

200000
-143483 -107614 2
-674481 449657 4
-19 16 8
-4 0 9
-2 2 8
-293107 146552 4
386411 193204 1
384639 256428 6
-1 -3 1
5 -4 1
395740 -263828 6
207573 -415142 7
652851 -217620 7
-992583 -496291 1
-3 -1 7
258083 258085 8
14 -37 4
147947 -49316 4
606546 404362 4
255842 -191883 2
-20 15 2
14488 14488...

output:

620908
4069995663

result:

ok The answer is correct.

Test #43:

score: 0
Accepted
time: 38ms
memory: 56888kb

input:

200000
-999663 -999679 1
-999755 -999749 1
-999678 -999666 7
-999735 -999739 4
-999907 -999910 10
-999751 -999739 6
-999738 -999736 9
-999948 -999941 2
-999726 -999729 5
-999696 -999706 5
-999640 -999650 6
-999749 -999763 7
-999710 -999695 9
-999795 -999786 1
-999921 -999915 1
-999857 -999852 9
-999...

output:

606467
1102507425

result:

ok The answer is correct.

Test #44:

score: 0
Accepted
time: 31ms
memory: 57176kb

input:

200000
-999798 -999799 6
-999632 -999640 3
-999738 -999734 7
-999649 -999648 2
-999862 -999857 4
-999640 -999641 2
-999752 -999753 6
-999927 -999934 2
-999732 -999731 2
-999694 -999697 4
-999892 -999878 10
-999940 -999930 1
-999854 -999858 10
-999631 -999624 1
-999943 -999945 5
-999720 -999736 3
-99...

output:

606803
3656377611

result:

ok The answer is correct.

Subtask #5:

score: 20
Accepted

Test #45:

score: 20
Accepted
time: 1192ms
memory: 39292kb

input:

65536
-128 -128 6
-128 -127 3
-128 -126 3
-128 -125 2
-128 -124 8
-128 -123 8
-128 -122 6
-128 -121 3
-128 -120 10
-128 -119 2
-128 -118 6
-128 -117 9
-128 -116 7
-128 -115 1
-128 -114 8
-128 -113 3
-128 -112 4
-128 -111 6
-128 -110 9
-128 -109 10
-128 -108 6
-128 -107 7
-128 -106 9
-128 -105 3
-128...

output:

15692490
1531224321

result:

ok The answer is correct.

Test #46:

score: 0
Accepted
time: 1201ms
memory: 39260kb

input:

65536
-128 -128 1
-128 -127 7
-128 -126 4
-128 -125 9
-128 -124 3
-128 -123 6
-128 -122 8
-128 -121 10
-128 -120 3
-128 -119 6
-128 -118 10
-128 -117 8
-128 -116 10
-128 -115 3
-128 -114 6
-128 -113 8
-128 -112 9
-128 -111 6
-128 -110 2
-128 -109 8
-128 -108 4
-128 -107 9
-128 -106 8
-128 -105 4
-12...

output:

15687415
272259564

result:

ok The answer is correct.

Test #47:

score: 0
Accepted
time: 559ms
memory: 38768kb

input:

65536
-128 -128 10
-128 -127 7
-128 -126 5
-128 -125 7
-128 -124 10
-128 -123 4
-128 -122 10
-128 -121 10
-128 -120 1
-128 -119 5
-128 -118 9
-128 -117 8
-128 -116 6
-128 -115 7
-128 -114 3
-128 -113 2
-128 -112 10
-128 -111 3
-128 -110 4
-128 -109 6
-128 -108 9
-128 -107 1
-128 -106 8
-128 -105 1
-...

output:

13371541
3364760732

result:

ok The answer is correct.

Test #48:

score: 0
Accepted
time: 552ms
memory: 39104kb

input:

65536
-128 -128 6
-128 -127 10
-128 -126 8
-128 -125 3
-128 -124 6
-128 -123 1
-128 -122 9
-128 -121 3
-128 -120 4
-128 -119 1
-128 -118 6
-128 -117 4
-128 -116 4
-128 -115 1
-128 -114 10
-128 -113 3
-128 -112 8
-128 -111 10
-128 -110 10
-128 -109 2
-128 -108 3
-128 -107 8
-128 -106 9
-128 -105 10
-...

output:

13355319
4169494042

result:

ok The answer is correct.

Subtask #6:

score: 10
Accepted

Test #49:

score: 10
Accepted
time: 572ms
memory: 57900kb

input:

200000
0 0 9
0 2 7
0 4 1
0 6 4
0 8 2
0 10 2
0 12 5
0 14 10
0 16 7
0 18 4
0 20 4
0 22 9
0 24 8
0 26 4
0 28 8
0 30 5
0 32 4
0 34 9
0 36 3
0 38 7
0 40 4
0 42 10
0 44 4
0 46 6
0 48 3
0 50 7
0 52 9
0 54 7
0 56 8
0 58 8
0 60 4
0 62 10
0 64 2
0 66 4
0 68 4
0 70 1
0 72 1
0 74 6
0 76 1
0 78 4
0 80 3
0 82 7
0...

output:

22496577
4243564198

result:

ok The answer is correct.

Test #50:

score: 0
Accepted
time: 549ms
memory: 57988kb

input:

200000
0 0 6
0 2 7
0 4 10
0 6 6
0 8 2
0 10 4
0 12 5
0 14 10
0 16 4
0 18 7
0 20 7
0 22 4
0 24 10
0 26 9
0 28 6
0 30 4
0 32 7
0 34 1
0 36 6
0 38 1
0 40 5
0 42 7
0 44 10
0 46 4
0 48 4
0 50 7
0 52 2
0 54 1
0 56 10
0 58 5
0 60 4
0 62 3
0 64 6
0 66 6
0 68 8
0 70 2
0 72 3
0 74 3
0 76 4
0 78 6
0 80 4
0 82 5...

output:

22496274
912738561

result:

ok The answer is correct.

Subtask #7:

score: 0
Time Limit Exceeded

Test #51:

score: 0
Time Limit Exceeded

input:

200000
-1099 1879 7
1402 -488 8
-9770 8838 3
-177 -1714 9
2929 1099 9
4906 385 1
1606 5775 10
-2824 3929 10
997 2113 8
2897 -1592 4
-1679 8134 10
1988 405 4
-124 -112 5
-7851 12185 10
-2048 -1963 10
140 -2168 4
16857 -9907 4
-2719 10 8
1383 -648 9
2161 -464 9
1917 -1321 3
607 -2034 10
-22 1839 6
-30...

output:


result:


Subtask #8:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%