QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#344755 | #4563. Radio Towers | hos_lyric | 0 | 915ms | 31168kb | C++14 | 11.1kb | 2024-03-05 07:25:27 | 2024-03-05 07:25:27 |
Judging History
answer
#include "towers.h"
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
struct Set {
// max{ceil(log_64(n)), 1}
int log64N, n;
vector<unsigned long long> a[6];
explicit Set(int n_ = 0) : n(n_) {
assert(n >= 0);
int m = n ? n : 1;
for (int d = 0; ; ++d) {
m = (m + 63) >> 6;
a[d].assign(m, 0);
if (m == 1) {
log64N = d + 1;
break;
}
}
}
bool empty() const {
return !a[log64N - 1][0];
}
bool contains(int x) const {
return (a[0][x >> 6] >> (x & 63)) & 1;
}
void insert(int x) {
for (int d = 0; d < log64N; ++d) {
const int q = x >> 6, r = x & 63;
a[d][q] |= 1ULL << r;
x = q;
}
}
void erase(int x) {
for (int d = 0; d < log64N; ++d) {
const int q = x >> 6, r = x & 63;
if ((a[d][q] &= ~(1ULL << r))) break;
x = q;
}
}
// max s.t. <= x (or -1)
int prev(int x) const {
if (x > n - 1) x = n - 1;
for (int d = 0; d <= log64N; ++d) {
if (x < 0) break;
const int q = x >> 6, r = x & 63;
const unsigned long long lower = a[d][q] << (63 - r);
if (lower) {
x -= __builtin_clzll(lower);
for (int e = d; --e >= 0; ) x = x << 6 | (63 - __builtin_clzll(a[e][x]));
return x;
}
x = q - 1;
}
return -1;
}
// min s.t. >= x (or n)
int next(int x) const {
if (x < 0) x = 0;
for (int d = 0; d < log64N; ++d) {
const int q = x >> 6, r = x & 63;
if (static_cast<unsigned>(q) >= a[d].size()) break;
const unsigned long long upper = a[d][q] >> r;
if (upper) {
x += __builtin_ctzll(upper);
for (int e = d; --e >= 0; ) x = x << 6 | __builtin_ctzll(a[e][x]);
return x;
}
x = q + 1;
}
return n;
}
};
////////////////////////////////////////////////////////////////////////////////
// T: monoid representing information of an interval.
// T() should return the identity.
// T(S s) should represent a single element of the array.
// T::pull(const T &l, const T &r) should pull two intervals.
template <class T> struct SegmentTreePoint {
int logN, n;
vector<T> ts;
SegmentTreePoint() : logN(0), n(0) {}
explicit SegmentTreePoint(int n_) {
for (logN = 0, n = 1; n < n_; ++logN, n <<= 1) {}
ts.resize(n << 1);
}
template <class S> explicit SegmentTreePoint(const vector<S> &ss) {
const int n_ = ss.size();
for (logN = 0, n = 1; n < n_; ++logN, n <<= 1) {}
ts.resize(n << 1);
for (int i = 0; i < n_; ++i) at(i) = T(ss[i]);
build();
}
T &at(int i) {
return ts[n + i];
}
void build() {
for (int u = n; --u; ) pull(u);
}
inline void pull(int u) {
ts[u].pull(ts[u << 1], ts[u << 1 | 1]);
}
// Changes the value of point a to s.
template <class S> void change(int a, const S &s) {
assert(0 <= a); assert(a < n);
ts[a += n] = T(s);
for (; a >>= 1; ) pull(a);
}
// Applies T::f(args...) to point a.
template <class F, class... Args>
void ch(int a, F f, Args &&... args) {
assert(0 <= a); assert(a < n);
(ts[a += n].*f)(args...);
for (; a >>= 1; ) pull(a);
}
// Calculates the product for [a, b).
T get(int a, int b) {
assert(0 <= a); assert(a <= b); assert(b <= n);
if (a == b) return T();
a += n; b += n;
T prodL, prodR, t;
for (int aa = a, bb = b; aa < bb; aa >>= 1, bb >>= 1) {
if (aa & 1) { t.pull(prodL, ts[aa++]); prodL = t; }
if (bb & 1) { t.pull(ts[--bb], prodR); prodR = t; }
}
t.pull(prodL, prodR);
return t;
}
// Calculates T::f(args...) of a monoid type for [a, b).
// op(-, -) should calculate the product.
// e() should return the identity.
template <class Op, class E, class F, class... Args>
#if __cplusplus >= 201402L
auto
#else
decltype((std::declval<T>().*F())())
#endif
get(int a, int b, Op op, E e, F f, Args &&... args) {
assert(0 <= a); assert(a <= b); assert(b <= n);
if (a == b) return e();
a += n; b += n;
auto prodL = e(), prodR = e();
for (int aa = a, bb = b; aa < bb; aa >>= 1, bb >>= 1) {
if (aa & 1) prodL = op(prodL, (ts[aa++].*f)(args...));
if (bb & 1) prodR = op((ts[--bb].*f)(args...), prodR);
}
return op(prodL, prodR);
}
// Find min b s.t. T::f(args...) returns true,
// when called for the partition of [a, b) from left to right.
// Returns n + 1 if there is no such b.
template <class F, class... Args>
int findRight(int a, F f, Args &&... args) {
assert(0 <= a); assert(a <= n);
if ((T().*f)(args...)) return a;
if (a == n) return n + 1;
a += n;
for (; ; a >>= 1) if (a & 1) {
if ((ts[a].*f)(args...)) {
for (; a < n; ) {
if (!(ts[a <<= 1].*f)(args...)) ++a;
}
return a - n + 1;
}
++a;
if (!(a & (a - 1))) return n + 1;
}
}
// Find max a s.t. T::f(args...) returns true,
// when called for the partition of [a, b) from right to left.
// Returns -1 if there is no such a.
template <class F, class... Args>
int findLeft(int b, F f, Args &&... args) {
assert(0 <= b); assert(b <= n);
if ((T().*f)(args...)) return b;
if (b == 0) return -1;
b += n;
for (; ; b >>= 1) if ((b & 1) || b == 2) {
if ((ts[b - 1].*f)(args...)) {
for (; b <= n; ) {
if (!(ts[(b <<= 1) - 1].*f)(args...)) --b;
}
return b - n - 1;
}
--b;
if (!(b & (b - 1))) return -1;
}
}
};
////////////////////////////////////////////////////////////////////////////////
constexpr int INF = 1001001001;
struct NodeMin {
int mn;
NodeMin() : mn(+INF) {}
NodeMin(int val) : mn(val) {}
void pull(const NodeMin &l, const NodeMin &r) {
mn = min(l.mn, r.mn);
}
void ch(int val) {
mn = val;
}
void chmin(int val) {
if (mn > val) mn = val;
}
bool test(int tar) const {
return (mn <= tar);
}
};
namespace seg {
using Value = int;
constexpr int MAX_NUM_NODES = 20'000'010;
int n, id, ls[MAX_NUM_NODES], rs[MAX_NUM_NODES];
Value vals[MAX_NUM_NODES];
void init(int n_) {
n = n_;
id = 0;
}
int newNode() {
assert(id < MAX_NUM_NODES);
const int u = id++;
ls[u] = rs[u] = -1;
vals[u] = Value();
return u;
}
int build(int l, int r) {
const int u = newNode();
if (l + 1 == r) return u;
const int mid = (l + r) / 2;
ls[u] = build(l, mid);
rs[u] = build(mid, r);
return u;
}
int modify(int u, int l, int r, int pos, Value val) {
if (!(l <= pos && pos < r)) return u;
const int v = newNode();
if (l + 1 == r) {
vals[v] = val;
return v;
}
const int mid = (l + r) / 2;
ls[v] = modify(ls[u], l, mid, pos, val);
rs[v] = modify(rs[u], mid, r, pos, val);
vals[v] = vals[ls[v]] + vals[rs[v]];
return v;
}
int modify(int u, int pos, Value val) {
return modify(u, 0, n, pos, val);
}
Value get(int u, int l, int r, int a, int b) {
if (b <= l || r <= a) return 0;
if (a <= l && r <= b) return vals[u];
const int mid = (l + r) / 2;
return get(ls[u], l, mid, a, b) + get(rs[u], mid, r, a, b);
}
Value get(int u, int a, int b) {
return get(u, 0, n, a, b);
}
int leftmost(int u, int a) {
int lo = a, hi = n;
for (; lo + 1 < hi; ) {
const int mid = (lo + hi) / 2;
(get(u, a, mid) ? hi : lo) = mid;
}
return lo;
}
int rightmost(int u, int b) {
int lo = 0, hi = b;
for (; lo + 1 < hi; ) {
const int mid = (lo + hi) / 2;
(get(u, mid, b) ? lo : hi) = mid;
}
return lo;
}
} // seg
int N;
vector<int> H;
SegmentTreePoint<NodeMin> segMin;
vector<pair<int, int>> segs;
void init(int N_, std::vector<int> H_) {
N = N_;
H = H_;
segMin = SegmentTreePoint<NodeMin>(H);
vector<int> is;
for (int i = 0, j, k; i < N - 1; i = k) {
for (j = i; j < N - 1 && H[j] < H[j + 1]; ++j) {}
for (k = j; k < N - 1 && H[k] > H[k + 1]; ++k) {}
if (i < j && j < k) {
if (is.size()) {
assert(is.back() == i);
is.pop_back();
}
is.push_back(i);
is.push_back(j);
is.push_back(k);
}
}
// # mountain
int len = (int)is.size() / 2;
assert((int)is.size() == 2 * len + 1);
Set on(N);
using Entry = pair<int, pair<int, int>>;
priority_queue<Entry, vector<Entry>, greater<Entry>> que;
// count mountains
seg::init(N);
int now = seg::build(0, N);
for (int h = 0; h <= 2 * len; ++h) on.insert(is[h]);
for (int h = 0; h < 2 * len; ++h) que.emplace(abs(H[is[h]] - H[is[h + 1]]), make_pair(is[h], is[h + 1]));
for (int h = 1; h <= 2 * len; h += 2) now = seg::modify(now, is[h], 1);
for (; que.size(); ) {
const int d = que.top().first;
const int i = que.top().second.first;
const int j = que.top().second.second;
que.pop();
if (on.contains(i) && on.contains(j)) {
// cerr<<"d = "<<d<<", i = "<<i<<", j = "<<j<<"; on = ";for(int k=0;k<N;++k)if(on.contains(k))cerr<<make_pair(H[k],k)<<" ";cerr<<"now = ";for(int k=0;k<N;++k)cerr<<seg::get(now,k,k+1)<<" ";cerr<<endl;
segs.emplace_back(d, now);
on.erase(i);
on.erase(j);
now = seg::modify(now, (H[i] > H[j]) ? i : j, 0);
const int l = on.prev(i);
const int r = on.next(j);
if (0 <= l && r < N) {
que.emplace(abs(H[l] - H[r]), make_pair(l, r));
}
}
}
segs.emplace_back(INF, now);
}
int max_towers(int L, int R, int D) {
++R;
const int u = lower_bound(segs.begin(), segs.end(), make_pair(D, -INF))->second;
const int sum = seg::get(u, L, R);
// cerr<<"[max_towers] L = "<<L<<", R = "<<R<<", D = "<<D<<": sum = "<<sum<<endl;
int ans = sum - 1;
if (sum) {
const int l = seg::leftmost(u, L);
const int r = seg::rightmost(u, R);
// cerr<<" l = "<<l<<", r = "<<r<<endl;
if (H[l] - segMin.get(L, l).mn >= D) ++ans;
if (H[r] - segMin.get(r + 1, R).mn >= D) ++ans;
}
chmax(ans, 1);
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 4
Accepted
time: 112ms
memory: 5816kb
input:
59640 49885 57346 58504 87383 113182 129676 204090 205404 259925 276583 300332 324014 333675 359377 364049 408489 414852 428310 438038 440113 458193 554789 643468 666525 683112 690791 707313 720088 741028 748785 789826 796576 800966 832867 851750 861044 862283 900756 926925 939560 955678 965636 9740...
output:
1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 47004 lines
Test #2:
score: 0
Accepted
time: 148ms
memory: 7624kb
input:
100000 2578 13067 19114 20399 28997 31651 32660 44354 74124 80988 88107 95439 96029 102645 103539 132139 137628 158023 174859 192033 205256 217839 227259 243992 248025 260099 283750 285030 294864 297371 303073 333910 343091 343725 359151 361656 361691 386777 414415 419149 425074 433963 447813 448681...
output:
1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 100002 lines
Test #3:
score: 0
Accepted
time: 123ms
memory: 7628kb
input:
100000 13114 25925 27245 67202 68073 76184 110151 123581 140992 143871 146221 155748 165589 167167 168714 171437 172941 193840 194941 197306 200400 218140 230901 232201 246351 256019 260798 270505 295025 297243 308012 322193 346038 355192 366304 396540 414362 422681 428999 432243 434231 444296 47452...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 100002 lines
Test #4:
score: -4
Runtime Error
input:
100000 5700 16956 35944 39194 51761 52173 81805 105452 109633 118593 123359 137554 140598 144792 159902 205292 216922 221444 228388 264645 275797 312855 317157 317211 346139 386655 414208 420637 428337 428731 441479 462812 473900 512659 530585 531009 539066 541910 546178 587753 622729 662273 672038 ...
output:
result:
Subtask #2:
score: 0
Runtime Error
Test #8:
score: 11
Accepted
time: 1ms
memory: 3864kb
input:
425 753881706 405729786 890889563 29736246 598281970 208352067 357783003 663497023 178397034 4832890 562140755 510307001 354540290 538848551 436879256 86659033 42928516 24145404 749159097 118423198 506851985 204895765 719719998 726244368 991372008 681703480 799303017 657138050 88278945 417801236 260...
output:
13
result:
ok 3 lines
Test #9:
score: 0
Accepted
time: 0ms
memory: 4396kb
input:
2000 510696791 617882876 373405425 518361747 407161508 435668375 559543221 465317236 38039460 717410075 714427583 977153243 679286738 23933545 750215417 37078782 973334934 244734879 243897181 603105656 981870220 85688930 807317304 901266308 225354691 737318933 824323690 365669439 111883771 153256479...
output:
292
result:
ok 3 lines
Test #10:
score: 0
Accepted
time: 1ms
memory: 4116kb
input:
2000 516351740 512181903 200723571 993230512 160881035 858124753 539677115 120758992 855511696 883443323 930303372 707938300 186981787 145199071 581235758 65550786 7197175 474759320 732341567 517832089 220614631 428681162 168642809 331743780 689236970 514407524 725936494 447118446 628858360 36946526...
output:
91
result:
ok 3 lines
Test #11:
score: 0
Accepted
time: 1ms
memory: 4184kb
input:
2000 9654673 812116916 373455422 816862897 353222263 785552601 262143032 654718863 361397545 763154940 79011466 983035671 46521930 654559175 371270845 610911343 19671952 831534324 157278884 850193672 83857278 600512673 91419235 820220378 19933790 959137813 447541847 957882585 47577396 981451791 2290...
output:
336
result:
ok 3 lines
Test #12:
score: 0
Accepted
time: 1ms
memory: 4220kb
input:
2000 101597651 901337214 94865893 515541321 223422476 791229261 361846447 652989994 147299317 644867197 32737606 525776949 182468296 547470985 330848340 873710937 392296086 971753844 156102346 764082424 254318166 685488259 221310405 521552461 481853974 868664461 300437861 938093383 466194541 6653033...
output:
176
result:
ok 3 lines
Test #13:
score: 0
Accepted
time: 1ms
memory: 4264kb
input:
2000 472936055 973169917 157888070 752944598 254539436 814034071 26698036 538887055 429236303 861439585 333049317 960563190 374468157 913310144 89434192 863875353 370790916 558434605 461824050 727741912 341709750 906272885 334496641 886737508 281651305 854169557 304260640 494128561 360711440 5339229...
output:
130
result:
ok 3 lines
Test #14:
score: 0
Accepted
time: 1ms
memory: 4216kb
input:
2000 448125011 914906568 342296305 596847215 308205069 607246435 321988425 906263458 12754675 760166384 151837669 976756930 492753133 973159665 56759675 984884487 393926205 542913032 452064909 641120579 160301206 621818390 240470745 728458832 262255458 718912726 467544291 738536144 174343867 6066620...
output:
34
result:
ok 3 lines
Test #15:
score: -11
Runtime Error
input:
2000 63119 1763800 2560156 2577120 2947719 4220876 4493280 5257204 5695924 6255528 6688141 6874164 6986335 8608902 8655716 8667255 8733692 9297137 9612369 10639944 11677890 11850447 12123475 12942200 13292330 13630586 14006505 14704409 15864169 16065863 16090141 16348841 16582396 16707789 16914115 1...
output:
result:
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Runtime Error
Test #65:
score: 14
Accepted
time: 619ms
memory: 23284kb
input:
99308 491693640 24020487 317364185 726230755 737284540 951143270 709116045 641023337 360629062 964879440 47884022 532494780 803629825 635450854 688041998 573937055 113198481 191311841 929603572 636688 598629732 895342035 396521271 619919754 716589045 657789547 373121546 866402108 609316614 60046511 ...
output:
11903 4770 14278 13956 571 9308 4389 9 22097 16784 26037 2813 8487 16602 2029 6158 17236 29707 19863 12083 20816 18090 4195 11612 4623 6658 7660 624 9839 13012 14475 11799 14795 6365 7308 5981 13614 14208 15922 17325 6020 10291 1819 29076 3117 6638 5810 28747 14944 9541 5498 1015 5001 20938 305 1993...
result:
ok 76385 lines
Test #66:
score: 0
Accepted
time: 745ms
memory: 23324kb
input:
100000 646527498 970130195 879656883 854139882 920539450 14492099 70829155 825526447 519236533 385324961 763550841 616593724 202907362 504717767 861551686 907280958 806537098 75704450 554965405 422432432 940208667 752899470 775720977 966726690 961764576 993069149 823583546 69522676 360505418 7633091...
output:
14639 9186 584 818 3164 16444 1579 16458 6571 5493 20925 3038 3459 7677 14998 8753 2530 12026 13859 985 3177 296 398 6246 6210 6153 7709 24258 1152 3748 7952 8080 13438 5107 1161 4986 23542 15941 18037 791 15601 8274 3031 13339 8920 8559 11180 24013 394 8673 4017 6704 6973 210 2085 8072 3422 6896 10...
result:
ok 100002 lines
Test #67:
score: 0
Accepted
time: 743ms
memory: 23328kb
input:
100000 799666095 11912869 1942326 329008647 676518434 731915773 50963049 775935498 336708769 698841857 979426630 497121885 413375659 771207486 690312572 933493505 987882987 160504698 336117631 191934672 178953077 95891702 137046482 542428354 425646854 622674091 727455806 150971684 875220551 94422593...
output:
3359 5788 2636 4749 12929 3462 9867 19742 27431 10049 6507 21413 26395 16171 1065 1099 6059 3852 827 8338 4447 19422 6687 18554 12713 17167 17551 6782 6320 12234 14788 9130 5326 19419 3788 8 4527 7191 2972 21849 17183 18614 8536 21210 4177 6455 5606 163 18117 7891 14769 7953 1074 4478 11977 29196 40...
result:
ok 100002 lines
Test #68:
score: 0
Accepted
time: 849ms
memory: 31068kb
input:
100000 309383765 818406090 14295145 629135702 209715251 509716889 12520088 913509863 261355145 755723016 134249674 908312702 67849537 765830435 242732056 593027397 386060391 727871977 280196624 593068179 108402646 788956280 297991891 717564506 119204481 557237512 343638543 799142578 267285209 810194...
output:
23097 5447 23783 27586 952 21564 3870 8703 21117 7700 11000 20983 38022 2663 941 11454 2759 11174 36632 8509 16858 40362 25309 12070 32624 30796 9202 7175 11966 11519 16231 6793 36568 6656 25316 20825 14867 22408 3890 4120 1635 13839 29293 20761 28612 2624 9766 31836 8423 11943 11214 14008 661 8133 ...
result:
ok 100002 lines
Test #69:
score: 0
Accepted
time: 826ms
memory: 31168kb
input:
100000 398604064 517084515 403316469 941093925 341076538 763446081 355078186 592439416 478732289 646978211 411743599 905272211 443935337 593019442 240172880 860046653 35947342 589508481 340756803 701412642 475907286 706217099 208187382 909958202 390508631 817202038 114304432 775409240 89780581 53218...
output:
24400 36714 13886 14509 36820 1421 7548 27671 1349 26896 5653 25203 6164 5360 21403 33193 8148 7314 39871 8396 17198 6121 1871 1497 4763 30054 5495 31727 24694 45309 25900 28269 6858 9003 2063 4238 44756 22939 13667 25304 24777 19243 2781 36090 7651 12367 47033 6413 11981 4430 7511 25676 32483 36198...
result:
ok 100002 lines
Test #70:
score: 0
Accepted
time: 896ms
memory: 31016kb
input:
100000 470436767 754487792 461866345 963898735 349595303 728616335 250549334 578810355 347325118 804024766 15413294 787037528 105324976 872668363 473184954 707188829 464977606 782556528 256065321 752907482 412827734 758149764 362598737 510432812 220636665 831053655 189976212 708640841 59667440 87439...
output:
4031 19471 10612 11305 29772 29874 21670 2464 5310 25620 24369 6447 795 10520 18039 1110 11300 7418 19857 3817 7976 14218 18688 45775 31258 24208 13949 1287 11237 32270 34202 9525 38736 11963 21324 21122 13715 45274 28148 26076 726 24521 11067 20365 5491 7039 20594 14715 4222 15081 3768 12930 11824 ...
result:
ok 100002 lines
Test #71:
score: 0
Accepted
time: 856ms
memory: 31100kb
input:
100000 412173417 598390408 450506026 862926714 62758084 584835820 312278703 842539009 241894641 534565458 27030476 943943695 471359870 991029867 307671828 975813712 466428149 865400208 101594411 879257618 112546625 917139766 242222832 744966595 51074647 579442498 239653108 584603561 477338553 655568...
output:
33924 11012 17217 5652 35774 19773 7167 16147 4921 22378 2886 6381 20729 25984 37105 33701 12765 15814 31567 4523 3853 2591 5038 24440 15123 29860 5543 28365 21666 6416 7901 16121 5444 18700 17557 8004 9915 26519 5987 605 7786 4804 4099 16672 20783 5924 44630 21907 44651 18917 6041 5328 4338 15527 3...
result:
ok 100002 lines
Test #72:
score: -14
Runtime Error
input:
100000 2879 32457 32800 34124 37088 65871 67630 69007 70609 76863 96036 96369 96565 105168 106207 119568 120684 131675 139246 156582 157087 161216 175779 185692 192424 252496 261161 268435 272206 274575 290650 292159 302124 302145 323135 347536 353475 358692 362164 370878 382914 383697 387884 395290...
output:
result:
Subtask #5:
score: 0
Runtime Error
Test #86:
score: 17
Accepted
time: 42ms
memory: 7804kb
input:
23881 605288257 422163932 155875880 339929874 76049859 196344969 958160745 767945284 469191956 997116006 387749577 15911341 920437918 367576975 800789357 351557615 283723284 369507452 841548133 643412903 309731505 256549694 370065644 699518122 559017597 347646657 469353381 575240521 501893001 454519...
output:
7197 7063 150 5030 5227 7333 1778 6675 2012 5921 4878 7477 4598 2769 5360 6465 7660 7234 7794 2760 6321 7056 7302 4749 464 2029 5650 1973 6227 4900 4966 4990 3142 785 5818 3005 7705 6967 1940 5880 7201 4752 1278 6554 2951 894 6601 7019 7236 6076 5182 6579 2343 2070 4337 5744 4437 2262 6686 1739 7756...
result:
ok 31567 lines
Test #87:
score: 0
Accepted
time: 211ms
memory: 23320kb
input:
100000 187962236 252322706 659740540 756184857 615615021 870954164 997894181 924184575 178246679 206117936 948374169 611376809 940125697 583402158 621243496 179806768 420420048 261580744 495350370 179501503 624736464 865025098 132756697 396891347 254854635 384499314 232013282 699329403 718265326 972...
output:
21501 24099 33073 16936 24145 8440 674 23350 29618 2899 7659 19499 19027 10215 4083 14518 30601 23009 17970 7096 15472 32634 26673 29553 6232 11457 690 8753 7786 4078 28404 25386 28535 1752 5912 16456 18098 25382 30618 28242 30215 30920 19228 20981 27023 18696 16047 19091 7953 9832 13542 4224 26991 ...
result:
ok 100002 lines
Test #88:
score: 0
Accepted
time: 213ms
memory: 23384kb
input:
100000 195876641 146621733 341834495 380796725 369334549 293410542 978028075 874593626 703011075 519634832 164249958 637129162 298077642 409700388 597488029 208278772 746990129 51413696 131278404 949003744 715997226 208017329 494082201 972593011 718736913 14104256 281109734 780778410 380464107 29853...
output:
31327 32678 5845 12353 3257 8926 13111 9562 10067 19324 255 7803 6244 5462 17193 33299 5823 24299 31456 20379 13299 17670 10250 31047 750 28337 5058 5037 31225 2578 18079 32308 15960 21734 23722 17448 3403 22865 12869 22981 12521 27550 32677 8772 16024 27145 32107 20420 31630 25199 583 30494 13145 2...
result:
ok 100002 lines
Test #89:
score: 0
Accepted
time: 231ms
memory: 31124kb
input:
100000 140151127 703171223 64650609 807179656 91579199 616439566 262279532 635385641 182204773 746966272 29134735 694384584 151383885 835424004 374370699 839210095 26199233 802967114 424348660 929961627 334908843 613933030 264472963 967927306 374534013 795616963 181399017 942772713 325557168 6356971...
output:
16852 44989 5073 188 18334 719 37773 31991 27369 49758 2886 37462 2269 14671 36297 47833 45768 45948 44197 36763 13579 37257 34232 22326 19121 4483 3193 9572 44327 43476 37410 4641 9134 21884 17460 39750 31826 13138 6713 29509 28834 48569 47845 14636 42288 209 9318 7431 45730 16465 5906 40699 39638 ...
result:
ok 100002 lines
Test #90:
score: 0
Accepted
time: 246ms
memory: 31064kb
input:
100000 229371426 615845385 8395463 725670138 253945139 837481603 267122821 564928938 88384991 615119435 233045729 736737408 9623699 705904592 292693606 920163778 297466268 725313668 361252589 813252985 350864743 741659990 170849476 539562600 432839207 511464025 99353592 875179636 297454089 687124695...
output:
17581 24948 38391 14419 27799 4569 38668 35697 26067 49978 42190 1235 1655 28211 22625 47715 40160 39008 37550 19341 5003 109 10527 40699 48346 4305 5676 8370 23348 27672 31587 48842 49999 46869 20992 43858 6386 35113 50 46394 49096 24013 33036 49696 44127 30556 26524 3723 36254 9349 12089 2510 3087...
result:
ok 100002 lines
Test #91:
score: 0
Accepted
time: 224ms
memory: 31108kb
input:
100000 487111066 855860485 99041551 892763368 90402565 506637676 222215611 835773505 321823015 869201207 89953137 536799062 104579533 834586895 472040129 763002761 152483347 634595719 449887741 956583186 34700464 521025155 55345113 944384213 127641496 513194723 356649230 967880428 337980827 91463839...
output:
942 45725 29253 32000 34983 3056 10934 34915 6732 11677 1908 652 47087 1198 27913 18121 7533 3821 24817 31833 5715 2456 36255 41755 48827 46825 46456 9695 562 7920 24435 19004 5205 24363 3456 48946 23953 49466 31719 39841 12272 16871 42212 19612 38959 9101 5563 12587 43949 48475 41360 6428 41967 184...
result:
ok 100002 lines
Test #92:
score: 0
Accepted
time: 219ms
memory: 31048kb
input:
100000 27073748 576331364 400237255 795460519 71014022 637435072 214575137 823870913 216504420 807569134 433278403 608674530 363485760 723516242 157786468 990284424 191375275 730792204 290439949 971661182 370244883 986406055 345467763 738556373 233197961 953353962 129769517 642436238 381534949 97463...
output:
15228 45987 5889 540 24979 14594 39331 30269 9981 22404 3267 11420 12707 42431 49834 35779 22037 20640 28981 41713 13306 2152 44699 25014 49999 49722 28703 25852 31644 27995 42377 43981 46325 34863 25315 25298 48064 12187 614 35850 45155 47254 21988 7289 5643 47552 48834 14785 10748 44858 26283 2402...
result:
ok 100002 lines
Test #93:
score: -17
Runtime Error
input:
100000 14044 31568 48921 51214 59358 71379 100023 115598 139483 155653 157116 163984 169449 181325 188904 191112 194401 200495 208085 244825 258317 269389 271415 278442 294904 302861 331145 358689 365346 371514 371674 420312 426358 426926 439486 447109 449034 452747 459208 464379 471543 477242 48520...
output:
result:
Subtask #6:
score: 0
Runtime Error
Test #97:
score: 19
Accepted
time: 659ms
memory: 20840kb
input:
88768 238644804 620122421 789364401 899010695 885388612 437964772 845379533 657562749 773925456 625793781 916240972 291506550 379611161 905077982 629848170 530056471 520438258 806293637 326792996 785404568 74285074 565304193 846963319 63529729 804909008 212070492 69936548 656129389 408708069 3070450...
output:
7293 18702 4922 19044 23488 1992 20887 9156 21248 15708 115 11736 8529 19157 9407 9139 5401 20114 1699 3993 22639 5925 17883 12913 5726 12378 21617 15763 646 5418 16982 7639 6140 1776 6289 619 766 3079 8806 11541 7217 2650 15835 2238 2024 9705 23983 4664 8898 5006 2392 20170 8341 14535 16454 6623 18...
result:
ok 85825 lines
Test #98:
score: 0
Accepted
time: 856ms
memory: 23256kb
input:
100000 821318783 448021739 293229061 462749326 277470126 112573967 30337160 961285688 337755987 539828416 181898269 886972019 692006779 120903166 745269606 63338329 802359215 553142737 128078880 176268977 801614897 319003788 904621668 760902954 355521853 953955853 272787937 630475166 479856202 97240...
output:
4072 1852 14754 15134 16937 1671 2095 6403 19494 11439 5340 5911 14816 2035 1864 3849 1585 261 991 13796 13299 5424 2956 10339 14124 311 5887 12171 7462 7227 17292 10436 12595 20040 14674 5120 2783 3869 10726 119 8309 10154 2397 21296 9862 1583 16958 669 12228 2332 1606 1416 6889 3081 4920 5185 3298...
result:
ok 100002 lines
Test #99:
score: 0
Accepted
time: 815ms
memory: 23736kb
input:
100000 974457380 489804414 975323016 792393898 178673302 829997641 715503758 764211091 7744575 148312608 397774058 912724371 757250885 947201396 721514139 91810332 983705104 488199881 616523266 90995409 40359308 661996020 970979876 41637322 819404132 26011739 881692902 6891469 437022280 151058744 75...
output:
12840 8299 4235 10320 5766 7536 5596 3148 4241 4794 9978 1895 179 451 7353 1793 10382 3741 5016 8835 6606 4163 6024 1130 11787 172 7926 3939 12012 5121 9723 5717 3639 1405 7171 3784 3569 3033 5060 3121 2791 748 2868 3357 3420 3811 629 175 2172 729 352 4670 468 3707 6598 1566 2816 8561 8123 9970 2859...
result:
ok 100002 lines
Test #100:
score: 0
Accepted
time: 804ms
memory: 31024kb
input:
100000 357347743 761725897 425912256 926238155 365934964 834336116 263223794 788454869 27764697 694141901 151041985 988404305 258981391 772070971 449750311 968490622 42354191 702772109 162405523 848221756 280890184 509945710 297977771 543291234 151532412 727310095 275706410 646634937 86407089 699514...
output:
16338 14679 4268 2726 15988 8214 27571 22198 15685 19570 17801 5128 21721 22935 13365 18140 13063 9951 6043 15247 3286 2717 27739 21451 1457 15909 1135 9419 14494 25887 14324 12952 968 10801 3561 6807 655 9306 5633 9975 8663 22489 2542 1301 11781 3154 9214 8306 6573 14500 12338 2643 20065 3220 9671 ...
result:
ok 100002 lines
Test #101:
score: 0
Accepted
time: 915ms
memory: 31048kb
input:
100000 446568041 977107032 25904 776140085 397534174 533766150 347710597 844334914 164510494 896515795 378013522 673766086 499181052 613613383 342801166 733889534 176721824 762866517 158619611 819383953 393003811 522697473 472793464 619440492 466162100 888565185 283086307 994250345 412123886 9892218...
output:
1377 878 2185 2761 2530 139 297 1475 2650 1341 2727 35 346 530 2796 412 2711 1901 737 1438 420 1432 797 1058 2365 2294 211 460 337 741 1388 638 2418 698 2642 936 953 289 330 844 898 371 1263 1934 1328 79 2233 1 513 1983 341 1252 907 453 2243 2181 216 55 1205 38 1014 923 230 1029 3099 1704 1751 1976 ...
result:
ok 100002 lines
Test #102:
score: 0
Accepted
time: 894ms
memory: 30996kb
input:
100000 361993958 518400744 170314362 832430504 67737131 850498699 143438389 769073065 427026389 626235093 12315845 999053531 232178431 595719744 222091361 748826451 155745346 808153197 423388481 812451436 308312330 566155367 122907128 549657129 119893951 984086377 228383550 902865377 3355028 8485702...
output:
18034 20102 1895 16533 681 8957 14295 4993 10079 282 10937 1010 482 27975 102 10644 6387 18707 16968 9529 11818 17621 8331 15637 20436 9145 13267 22435 5805 7604 5138 15321 3858 3773 11244 6753 13271 10798 6810 16433 6838 17572 9970 3550 4102 16058 16542 2808 19134 14852 2970 3443 2201 7133 13333 22...
result:
ok 100002 lines
Test #103:
score: 0
Accepted
time: 769ms
memory: 31028kb
input:
100000 460137395 804405301 58412926 580805892 202047511 526162554 13011089 597669368 448283525 678943914 448778424 855654466 224926600 593802085 452052881 931504627 479165179 541410305 432698072 837263488 156840126 922641654 362658558 566709443 354409794 860635108 343400593 547170419 47960825 794404...
output:
14195 798 14769 40813 21362 6631 27858 25515 13353 8303 3983 10784 7082 694 33161 4293 622 6659 15577 41902 24382 3694 11428 3894 7049 16527 17511 33512 19159 22408 12885 37346 528 9497 3758 14247 12071 9278 19894 17240 14140 20935 12348 32985 23893 18824 17970 18193 21237 42784 4977 28342 16114 436...
result:
ok 100002 lines
Test #104:
score: -19
Runtime Error
input:
100000 9029 13328 60594 74789 92931 98307 99287 122661 132414 144464 153362 156308 173886 186071 191902 207160 207573 213309 219779 224219 227911 247218 249622 256078 261818 277448 283109 289909 304555 308246 317764 330995 332460 332847 338963 372499 380206 381667 401309 404116 422509 426670 427254 ...
output:
result:
Subtask #7:
score: 0
Skipped
Dependency #1:
0%