QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#616805 | #7787. Maximum Rating | Kdlyh | AC ✓ | 721ms | 43688kb | C++20 | 15.5kb | 2024-10-06 12:01:30 | 2024-10-06 12:01:30 |
Judging History
answer
// #include <cassert>
// #include <cmath>
// #include <cstdint>
// #include <cstdio>
// #include <cstdlib>
// #include <cstring>
// #include <algorithm>
// #include <bitset>
// #include <complex>
// #include <deque>
// #include <functional>
// #include <iterator>
// #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>
// #include <stack>
// #ifdef LOCAL
// template <class T, size_t size = std::tuple_size<T>::value> std::string to_debug(T, std::string s = "") requires(not std::ranges::range<T>);
// std::string to_debug(auto x) requires requires(std::ostream& os) { os << x; } { return static_cast<std::ostringstream>(std::ostringstream() << x).str(); }
// std::string to_debug(std::ranges::range auto x, std::string s = "") requires(not std::is_same_v<decltype(x), std::string>) {
// for (auto xi : x) { s += ", " + to_debug(xi); }
// return "[" + s.substr(s.empty() ? 0 : 2) + "]";
// }
// template <class T, size_t size> std::string to_debug(T x, std::string s) requires(not std::ranges::range<T>) {
// [&]<size_t... I>(std::index_sequence<I...>) { ((s += ", " + to_debug(get<I>(x))), ...); }(std::make_index_sequence<size>());
// return "(" + s.substr(s.empty() ? 0 : 2) + ")";
// }
// #define debug(...) std::cerr << __LINE__ << ": (" #__VA_ARGS__ ") = " << to_debug(std::tuple(__VA_ARGS__)) << "\n"
// #else
// #define debug(x...)
// #endif
// using i64 = long long;
// template <class T>
// struct Discreter {
// std::vector<T> elementSet;
// Discreter(const std::vector<T> &a) : elementSet(a) {
// std::sort(begin(elementSet), end(elementSet));
// elementSet.erase(std::unique(begin(elementSet), end(elementSet)), end(elementSet));
// }
// std::vector<int> process(const std::vector<T> &a) const {//get the dicreter arr
// std::vector<int> discRes(a.size());
// for (int i = 0; i < a.size(); i++) {
// discRes[i] = query(a[i]);
// }
// return discRes;
// }
// int query(const T &x) const {
// auto it = std::lower_bound(begin(elementSet), end(elementSet), x);
// return it - begin(elementSet);
// }
// int queryUpperBound(const T &x) const {
// auto it = std::upper_bound(begin(elementSet), end(elementSet), x);
// return it - begin(elementSet);
// }
// T queryInv(int index) const {
// return elementSet[index];
// }
// int size() {
// return elementSet.size();
// }
// };
// template<class Info>
// struct SegmentTree {
// int n;
// std::vector<Info> info;
// SegmentTree() : n(0) {}
// SegmentTree(int n_, Info v_ = Info()) {
// init(n_, v_);
// }
// template<class T>
// SegmentTree(std::vector<T> init_) {
// init(init_);
// }
// void init(int n_, Info v_ = Info()) {
// init(std::vector(n_, v_));
// }
// template<class T>
// void init(std::vector<T> init_) {
// n = init_.size();
// info.assign(4 << std::__lg(n), Info());
// std::function<void(int, int, int)> build = [&](int p, int l, int r) {
// if (r - l == 1) {
// info[p] = init_[l];
// return;
// }
// int m = (l + r) / 2;
// build(2 * p, l, m);
// build(2 * p + 1, m, r);
// pull(p);
// };
// build(1, 0, n);
// }
// void pull(int p) {
// info[p] = info[2 * p] + info[2 * p + 1];
// }
// void modify(int p, int l, int r, int x, const Info &v) {
// if (r - l == 1) {
// info[p] = info[p] + v;
// return;
// }
// int m = (l + r) / 2;
// if (x < m) {
// modify(2 * p, l, m, x, v);
// } else {
// modify(2 * p + 1, m, r, x, v);
// }
// pull(p);
// }
// void modify(int p, const Info &v) {
// modify(1, 0, n, p, v);
// }
// Info rangeQuery(int p, int l, int r, int x, int y) {
// if (l >= y || r <= x) {
// return Info();
// }
// if (l >= x && r <= y) {
// return info[p];
// }
// int m = (l + r) / 2;
// return rangeQuery(2 * p, l, m, x, y) + rangeQuery(2 * p + 1, m, r, x, y);
// }
// Info rangeQuery(int l, int r) {
// return rangeQuery(1, 0, n, l, r);
// }
// int findFirst(int p, int l, int r, int x, int y, i64 tar) {
// if (l >= y || r <= x) {
// return -1;
// }
// if (l >= x && r <= y && (info[p].sum <= tar)) {
// return -1;
// }
// if (r - l == 1) {
// return l;
// }
// int m = (l + r) / 2;
// int res = findFirst(2 * p, l, m, x, y, tar);
// if (res == -1) {
// res = findFirst(2 * p + 1, m, r, x, y, tar - info[2 * p].sum);//把左边的所有贡献加起来,因为是求前缀和
// }
// return res;
// }
// int findFirst(int l, int r, i64 tar) {
// return findFirst(1, 0, n, l, r, tar);
// }
// };
// struct Info {i64 sum{}, cnt{};};//直接在线段树里面同步维护正数个数,就不用multiset了
// Info operator + (const Info& a, const Info& b) {return {a.sum + b.sum, a.cnt + b.cnt};}
// void solve()
// {
// int n, Q; std::cin >> n >> Q; std::vector<int> a(n); for (auto& ai : a) {std::cin >> ai;}
// //离散化正数
// std::vector<int> positives; auto get_positive = [&](auto& x) {if (x > 0) {positives.push_back(x);} return ;};
// for (auto& ai : a) {get_positive(ai);}
// std::vector<std::pair<int, int>> querires(Q); for (auto&[x, v] : querires) {std::cin >> x >> v; --x; get_positive(v);}
// Discreter discreter(positives);
// //处理负数
// i64 negative_abs_sum{}; for (auto& ai : a) if (ai <= 0) {negative_abs_sum += std::abs(ai);}
// //建权值线段树
// SegmentTree<Info> T(n + Q); for (auto& ai : a) if (ai > 0) {T.modify(discreter.query(ai), {ai, 1});}
// for (auto&[x, v] : querires) {
// //修改前
// if (a[x] <= 0) {negative_abs_sum -= std::abs(a[x]);} else {T.modify(discreter.query(a[x]), {-a[x], -1});}
// //修改后
// if (v <= 0) {negative_abs_sum += std::abs(v);} else {T.modify(discreter.query(v), {v, 1});} a[x] = v;
// //第一遍线段树二分,找到第一个大于负数绝对值的前缀和的下标
// int k{T.findFirst(0, n + Q, negative_abs_sum)};
// if (k == -1) {std::cout << T.rangeQuery(0, n + Q).cnt + 1 << "\n"; continue;}
// //第二遍找k取了多少个
// auto pre_sum{T.rangeQuery(0, k).sum}, pre_take{T.rangeQuery(0, k).cnt}; int k_val{discreter.queryInv(k)};
// i64 k_take{(negative_abs_sum - pre_sum) / k_val + 1};
// std::cout << k_take + pre_take << "\n";
// }
// }
// signed main()
// {
// std::cin.tie(nullptr)->sync_with_stdio(false);
// int _{1};
// #ifdef tests
// std::cin >> _;
// #endif
// while(_--) solve();
// return 0;
// }
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iterator>
#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>
#include <stack>
#ifdef LOCAL
template <class T, size_t size = std::tuple_size<T>::value> std::string to_debug(T, std::string s = "") requires(not std::ranges::range<T>);
std::string to_debug(auto x) requires requires(std::ostream& os) { os << x; } { return static_cast<std::ostringstream>(std::ostringstream() << x).str(); }
std::string to_debug(std::ranges::range auto x, std::string s = "") requires(not std::is_same_v<decltype(x), std::string>) {
for (auto xi : x) { s += ", " + to_debug(xi); }
return "[" + s.substr(s.empty() ? 0 : 2) + "]";
}
template <class T, size_t size> std::string to_debug(T x, std::string s) requires(not std::ranges::range<T>) {
[&]<size_t... I>(std::index_sequence<I...>) { ((s += ", " + to_debug(get<I>(x))), ...); }(std::make_index_sequence<size>());
return "(" + s.substr(s.empty() ? 0 : 2) + ")";
}
#define debug(...) std::cerr << __LINE__ << ": (" #__VA_ARGS__ ") = " << to_debug(std::tuple(__VA_ARGS__)) << "\n"
#else
#define debug(x...)
#endif
using i64 = long long;
inline int __lg(int __n) { return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); }
template <class T>
struct Discreter {
std::vector<T> elementSet;
Discreter(const std::vector<T> &a) : elementSet(a) {
std::sort(begin(elementSet), end(elementSet));
elementSet.erase(std::unique(begin(elementSet), end(elementSet)), end(elementSet));
}
std::vector<int> process(const std::vector<T> &a) const {//get the dicreter arr
std::vector<int> discRes(a.size());
for (int i = 0; i < a.size(); i++) {
discRes[i] = query(a[i]);
}
return discRes;
}
int query(const T &x) const {
auto it = std::lower_bound(begin(elementSet), end(elementSet), x);
// assert(it != end(elementSet) and *it == x);
return it - begin(elementSet);
}
int queryUpperBound(const T &x) const {
auto it = std::upper_bound(begin(elementSet), end(elementSet), x);
return it - begin(elementSet);
}
T queryInv(int index) const {
return elementSet[index];
}
int size() {
return elementSet.size();
}
};
template<class Info>
struct SegmentTree {
int n;
std::vector<Info> info;
SegmentTree() : n(0) {}
SegmentTree(int n_, Info v_ = Info()) {
init(n_, v_);
}
template<class T>
SegmentTree(std::vector<T> init_) {
init(init_);
}
void init(int n_, Info v_ = Info()) {
init(std::vector(n_, v_));
}
template<class T>
void init(std::vector<T> init_) {
n = init_.size();
info.assign(4 << __lg(n), Info());
std::function<void(int, int, int)> build = [&](int p, int l, int r) {
if (r - l == 1) {
info[p] = init_[l];
return;
}
int m = (l + r) / 2;
build(2 * p, l, m);
build(2 * p + 1, m, r);
pull(p);
};
build(1, 0, n);
}
void pull(int p) {
info[p] = info[2 * p] + info[2 * p + 1];
}
void modify(int p, int l, int r, int x, const Info &v) {
if (r - l == 1) {
info[p] = info[p] + v;
return;
}
int m = (l + r) / 2;
if (x < m) {
modify(2 * p, l, m, x, v);
} else {
modify(2 * p + 1, m, r, x, v);
}
pull(p);
}
void modify(int p, const Info &v) {
modify(1, 0, n, p, v);
}
Info rangeQuery(int p, int l, int r, int x, int y) {
if (l >= y || r <= x) {
return Info();
}
if (l >= x && r <= y) {
return info[p];
}
int m = (l + r) / 2;
return rangeQuery(2 * p, l, m, x, y) + rangeQuery(2 * p + 1, m, r, x, y);
}
Info rangeQuery(int l, int r) {
return rangeQuery(1, 0, n, l, r);
}
template<class F>
int findFirst(int p, int l, int r, int x, int y, F &&pred) {
if (l >= y || r <= x) {
return -1;
}
if (l >= x && r <= y && !pred(info[p])) {
return -1;
}
if (r - l == 1) {
return l;
}
int m = (l + r) / 2;
int res = findFirst(2 * p, l, m, x, y, pred);
if (res == -1) {
res = findFirst(2 * p + 1, m, r, x, y, pred);
}
return res;
}
template<class F>
int findFirst(int l, int r, F &&pred) {
return findFirst(1, 0, n, l, r, pred);
}
template<class F>
int findLast(int p, int l, int r, int x, int y, F &&pred) {
if (l >= y || r <= x) {
return -1;
}
if (l >= x && r <= y && !pred(info[p])) {
return -1;
}
if (r - l == 1) {
return l;
}
int m = (l + r) / 2;
int res = findLast(2 * p + 1, m, r, x, y, pred);
if (res == -1) {
res = findLast(2 * p, l, m, x, y, pred);
}
return res;
}
template<class F>
int findLast(int l, int r, F &&pred) {
return findLast(1, 0, n, l, r, pred);
}
};
#define int long long
struct Info {
i64 sum{}, cnt{};
};
Info operator + (const Info& a, const Info& b) {return {a.sum + b.sum, a.cnt + b.cnt};}
void solve()
{
int n, Q; std::cin >> n >> Q; std::vector<int> a(n); for (auto& ai : a) {std::cin >> ai;}
SegmentTree<Info> T(n + Q);
std::vector<int> positives; for (auto& ai : a) if (ai > 0) {positives.push_back(ai);}
std::vector<std::pair<int, int>> querires(Q); for (auto&[x, v] : querires) {
std::cin >> x >> v; --x; if (v > 0) {positives.push_back(v);}
}
Discreter discreter(positives);
std::map<int, int> cnt; for (auto& ai : a) if (ai > 0) {cnt[ai] += 1;}
for (auto&[ai, c] : cnt) {T.modify(discreter.query(ai), {c * ai, c});}
i64 negative_abs_sum{}; for (auto& ai : a) if (ai <= 0) {negative_abs_sum += -ai;}
for (auto&[x, v] : querires) {
//当前这个下标上对应的数的权值线段树的值
//不一定就是单点赋值,而是把修改前的那个点减去一次a[x], 然后在新的v对应的上面加一次a=v
if (a[x] <= 0) {negative_abs_sum -= std::abs(a[x]);}
else {
int id{discreter.query(a[x])};
T.modify(id, {-a[x], -1});
}
if (v <= 0) {
negative_abs_sum += std::abs(v);
} else {
int id{discreter.query(v)};
T.modify(id, {v, 1});
}
int k{n + Q};
{//第一遍k
int lo{}, hi{n + Q - 1}; while (lo <= hi) {
int mid{(lo + hi) / 2};
(T.rangeQuery(0, mid + 1).sum > negative_abs_sum)
? hi = mid - 1, k = mid : lo = mid + 1;
}
}
a[x] = v;
if (k == n + Q) {
std::cout << T.rangeQuery(0, n + Q).cnt + 1 << "\n";
continue ;
}
i64 pre_sum{T.rangeQuery(0, k).sum};
int k_take{}, pre_take{T.rangeQuery(0, k).cnt};
{//第二遍找k取了多少个
auto k_sum{T.rangeQuery(k, k + 1).sum};
auto k_val{discreter.queryInv(k)};
i64 lo{1}, hi{k_sum / k_val}; while (lo <= hi) {
i64 mid{(lo + hi) / 2};
(pre_sum + mid * k_val > negative_abs_sum) ?
hi = mid - 1, k_take = mid : lo = mid + 1;
}
}
std::cout << k_take + pre_take << "\n";
}
}
signed main()
{
std::cin.tie(nullptr)->sync_with_stdio(false);
int _{1};
#ifdef tests
std::cin >> _;
#endif
while(_--) solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3524kb
input:
3 5 1 2 3 3 4 2 -2 1 -3 3 1 2 1
output:
1 2 2 2 3
result:
ok 5 number(s): "1 2 2 2 3"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
3 5 1 2 3 3 4 2 -2 1 3 3 1 2 1
output:
1 2 1 2 1
result:
ok 5 number(s): "1 2 1 2 1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
1 1 1000000000 1 1000000000
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
1 1 -1000000000 1 -1000000000
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
1000 1000 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 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 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 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 ...
output:
946 65 252 410 915 592 983 487 343 899 809 432 586 587 139 464 804 84 476 699 504 149 579 352 375 856 545 166 140 657 568 509 275 710 873 430 537 879 301 1 298 970 923 510 984 642 55 879 941 344 464 788 917 994 571 610 491 442 926 101 986 840 624 613 425 345 816 423 275 221 317 113 386 116 469 260 4...
result:
ok 1000 numbers
Test #6:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
1000 1000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000...
output:
500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 ...
result:
ok 1000 numbers
Test #7:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
1000 1000 -485078954 -474724347 -284958745 -99994191 -853392841 -796786314 -87134718 -861459498 -982809180 -184620712 -618476092 -244916830 -349486182 -751407510 -874417202 -419521829 -888338757 -735353446 -426330733 -715383449 -48093437 -359419189 -474876639 -887614191 -157085227 -51186523 -4851821...
output:
2 3 4 5 6 7 8 9 10 11 12 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 51 52 53 54 55 56 57 58 59 60 60 61 62 63 64 65 65 66 67 68 69 70 71 72 73 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 88 89 90 91 92 92 93 94 95 96...
result:
ok 1000 numbers
Test #8:
score: 0
Accepted
time: 2ms
memory: 3704kb
input:
1000 1000 692178227 662595541 345515063 991152011 835514013 25683568 123726285 66892783 865428606 354216625 814472013 533064716 948349754 361975669 37940082 869044119 662812642 803704097 146471883 707522800 739525519 193714172 427089913 397196213 189039234 246429967 813126715 687459477 71112534 8404...
output:
43 51 56 64 65 74 75 86 87 95 101 108 113 120 128 133 138 139 139 144 145 148 151 156 156 158 160 161 166 168 172 174 178 181 184 187 187 189 191 194 198 202 205 206 207 209 208 208 212 213 213 212 215 219 220 221 222 223 225 228 231 234 235 235 236 236 238 238 241 243 244 244 247 247 247 248 249 25...
result:
ok 1000 numbers
Test #9:
score: 0
Accepted
time: 2ms
memory: 3776kb
input:
1000 1000 574468116 94882719 344585092 303636576 860857354 553186159 965991069 700277773 418699098 303119379 321049044 311046263 246185690 843955069 991766564 157610065 845367822 6325150 14241791 204057976 158548256 378251315 960460247 976973909 903759916 617675386 774999095 700647307 182260243 3951...
output:
1 1 1 44 62 62 62 62 62 62 62 63 75 86 86 94 94 94 94 94 94 101 106 110 109 109 110 110 114 118 120 120 125 133 137 142 149 151 151 154 158 163 164 164 166 171 166 171 171 176 178 178 178 182 184 189 191 192 192 193 194 194 199 199 200 200 200 201 201 202 202 203 203 203 203 204 205 209 211 213 216 ...
result:
ok 1000 numbers
Test #10:
score: 0
Accepted
time: 2ms
memory: 3948kb
input:
1000 1000 751725297 937235315 680091610 26186557 254796915 744252261 881884780 923597346 266936883 546989425 417560660 89027810 544021626 957338248 904123848 814772232 101551928 545382694 250607919 995560445 577570993 931384678 862426799 261784312 954917086 283888096 73307963 303769720 219779023 411...
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 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 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 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 1000 numbers
Test #11:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
1000 1000 -508752650 194148329 -801456523 151112987 832369235 -688290588 806491091 836936846 -122281173 356992850 -568184583 -516872363 165777265 -971767664 709095458 287512288 -240509024 222892519 809890680 -240691276 -160995890 -941338137 -110422024 -171235654 137147409 269779505 791942508 8316469...
output:
502 501 501 501 501 500 500 501 501 501 501 501 501 501 500 500 501 501 501 500 501 500 499 499 498 497 497 496 496 496 496 496 496 495 496 495 495 495 495 495 495 496 496 496 496 497 497 496 495 495 495 495 495 495 494 495 495 495 496 496 496 495 495 494 493 494 494 494 493 494 495 495 494 494 493 ...
result:
ok 1000 numbers
Test #12:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
1000 1000 668917653 -912360220 -484296636 877719068 -532863859 -652299905 349419681 -27295020 117337504 915047258 669717799 -747101717 26685070 -475274955 944477505 -234513487 454335340 -77938580 827974643 579724786 32112764 -906575069 136172094 -160983053 -178633432 191196169 -702355948 -224063041 ...
output:
490 491 491 491 491 491 491 492 491 491 491 491 490 491 491 492 491 492 492 491 491 491 492 493 492 493 492 492 491 491 490 491 491 492 492 491 491 491 492 492 493 493 494 495 495 494 495 494 493 494 494 494 495 494 493 492 493 493 493 492 491 491 491 490 490 491 491 490 491 491 490 489 489 490 490 ...
result:
ok 1000 numbers
Test #13:
score: 0
Accepted
time: 206ms
memory: 27760kb
input:
200000 200000 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 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 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 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 ...
output:
72376 101111 115499 58115 162542 118228 127603 92640 159784 158521 23443 120553 3776 74867 53743 144513 110937 175487 110103 155120 90227 14151 141505 165956 73915 122548 124144 170214 87824 60252 31007 63702 179573 141360 166667 31159 15231 115256 166707 175939 169172 147787 1411 98677 10409 185322...
result:
ok 200000 numbers
Test #14:
score: 0
Accepted
time: 257ms
memory: 27232kb
input:
200000 200000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -1000000000 1 -100...
output:
100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000...
result:
ok 200000 numbers
Test #15:
score: 0
Accepted
time: 505ms
memory: 27660kb
input:
200000 200000 -641536243 -965183184 -141619591 -549578174 -605343285 -234948471 -911248231 -720193527 -374462595 -876901055 -305631438 -321131226 -273535990 -24800331 -302573198 -104933640 -943270107 -991477211 -671845994 -877636895 -967575238 -964139845 -414345700 -424981584 -72662072 -55397356 -69...
output:
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102...
result:
ok 200000 numbers
Test #16:
score: 0
Accepted
time: 624ms
memory: 39816kb
input:
200000 200000 535720938 467103996 857450438 172971807 714967349 587521411 299612773 913191463 178807897 661936283 790880177 161883029 24299945 457179067 314816794 183632306 607881293 211143843 900956623 913865574 820043720 588993518 487620852 859828820 273462389 315848062 600304728 176203396 8209093...
output:
546 590 723 815 911 1092 1234 1331 1383 1431 1546 1570 1606 1688 1775 1865 1924 1928 2018 2102 2146 2222 2283 2310 2367 2434 2509 2527 2528 2605 2643 2681 2694 2725 2773 2798 2815 2878 2915 2970 2982 3042 3095 3135 3152 3208 3232 3281 3331 3387 3433 3484 3539 3542 3585 3629 3634 3653 3664 3703 3732 ...
result:
ok 200000 numbers
Test #17:
score: 0
Accepted
time: 721ms
memory: 41948kb
input:
200000 200000 418010827 604423883 192956954 559085301 108906910 115024001 141877556 841543744 27045682 610839037 928860990 234831867 617103173 865529539 563610567 177230961 495469180 750201387 768726531 41804530 944099165 142126879 94620113 439606515 324619559 613464554 898613597 147922029 268493569...
output:
407 407 686 686 903 903 903 903 1040 1040 1169 1276 1276 1276 1373 1373 1392 1447 1487 1487 1576 1616 1726 1825 1927 2019 2084 2084 2084 2084 2106 2106 2183 2183 2236 2236 2236 2298 2323 2356 2356 2366 2366 2380 2380 2380 2380 2396 2448 2448 2448 2448 2448 2448 2463 2463 2506 2552 2552 2552 2581 263...
result:
ok 200000 numbers
Test #18:
score: 0
Accepted
time: 640ms
memory: 43688kb
input:
200000 200000 595268008 741743770 192026983 576602575 134250251 306090103 352738559 769896025 875283467 854709084 730405313 12813414 619971818 52541645 181000559 834393128 751653288 952822441 341529147 833306999 363121902 31696730 627990446 93013138 375776729 279677264 491889757 456077151 674608570 ...
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 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 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 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 200000 numbers
Test #19:
score: 0
Accepted
time: 474ms
memory: 33544kb
input:
200000 200000 57351658 34928223 909476925 655002892 208776997 515216130 -940368197 -966780776 138873074 -25753029 690457954 76716166 -527966744 -758131285 125842758 167172371 -19895937 -793760413 -335278551 -823237951 -41838836 -541480207 -316154446 -410768030 56117119 334108006 171479183 -612288695...
output:
99817 99816 99815 99815 99815 99815 99815 99816 99816 99816 99817 99817 99817 99817 99818 99817 99817 99817 99816 99816 99817 99818 99818 99818 99819 99819 99819 99818 99818 99818 99817 99817 99817 99818 99819 99819 99818 99818 99817 99817 99817 99817 99816 99817 99817 99817 99816 99815 99815 99815 ...
result:
ok 200000 numbers
Test #20:
score: 0
Accepted
time: 376ms
memory: 33632kb
input:
200000 200000 940054667 390362589 -478395896 -618391027 895421405 551206813 602560394 463954653 673459044 237334085 -366606958 -153513189 -667058939 -504728368 413102307 -649820697 969915721 662318697 -317194588 -54699391 741204407 -454839636 -607617414 -157425636 -259663722 602369466 677180729 8891...
output:
99961 99962 99961 99961 99962 99961 99960 99960 99959 99960 99960 99960 99960 99960 99960 99960 99960 99960 99959 99959 99959 99960 99960 99960 99961 99961 99961 99962 99962 99962 99962 99962 99962 99962 99962 99962 99962 99962 99962 99962 99962 99961 99962 99962 99963 99963 99963 99962 99962 99962 ...
result:
ok 200000 numbers
Test #21:
score: 0
Accepted
time: 547ms
memory: 43240kb
input:
200000 200000 441576 5072440 2023913 2954529 11190505 17748338 1815339 10941986 3382122 5828328 10116163 18360940 3182013 14192311 11727773 162330 9540059 17802468 4325749 4257913 5688641 19235717 10855976 5255755 5720967 7551311 7838288 9740660 1198385 13770386 928271 14554242 4144786 1289971 26775...
output:
141090 141091 141091 141090 141091 141091 141092 141093 141093 141092 141092 141092 141091 141091 141092 141092 141093 141094 141094 141094 141093 141093 141092 141092 141092 141093 141092 141091 141091 141090 141090 141091 141091 141091 141091 141090 141090 141090 141091 141091 141091 141091 141091...
result:
ok 200000 numbers
Extra Test:
score: 0
Extra Test Passed