QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#183936 | #4898. 基础图论练习题 | hos_lyric | 52 | 246ms | 11568kb | C++14 | 8.5kb | 2023-09-20 01:18:26 | 2023-09-20 01:18:26 |
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 <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#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")
////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
static constexpr unsigned M = M_;
unsigned x;
constexpr ModInt() : x(0U) {}
constexpr ModInt(unsigned x_) : x(x_ % M) {}
constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
ModInt pow(long long e) const {
if (e < 0) return inv().pow(-e);
ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
}
ModInt inv() const {
unsigned a = M, b = x; int y = 0, z = 1;
for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
assert(a == 1U); return ModInt(y);
}
ModInt operator+() const { return *this; }
ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
explicit operator bool() const { return x; }
bool operator==(const ModInt &a) const { return (x == a.x); }
bool operator!=(const ModInt &a) const { return (x != a.x); }
friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////
constexpr unsigned MO = 998244353;
using Mint = ModInt<MO>;
int root(vector<int> &uf, int u) {
return (uf[u] < 0) ? u : (uf[u] = root(uf, uf[u]));
}
bool connect(vector<int> &uf, int u, int v) {
u = root(uf, u);
v = root(uf, v);
if (u == v) return false;
if (uf[u] > uf[v]) swap(u, v);
uf[u] += uf[v];
uf[v] = u;
return true;
}
Int N;
int A, B;
vector<Int> D;
vector<int> X;
vector<Int> U, V;
vector<int> W;
vector<pair<int, int>> es;
namespace brute {
constexpr int F = 19;
vector<int> ufs[F];
// (u, v), (u + 1, v + 1), ..., (u + 2^f-1, v + 2^f-1)
int rec(int f, int u, int v) {
int ret = 0;
if (connect(ufs[f], u, v)) {
if (f) {
ret += rec(f - 1, u, v);
ret += rec(f - 1, u + (1 << (f-1)), v + (1 << (f-1)));
} else {
ret += 1;
}
}
return ret;
}
Mint run() {
for (int f = 0; f < F; ++f) {
ufs[f].assign(N, -1);
}
Mint ans = 0;
for (const auto &e : es) {
int num = 0;
if (e.second < A) {
const int a = e.second;
const int f = 31 - __builtin_clz(N - D[a]);
num += rec(f, 0, D[a]);
num += rec(f, N - D[a] - (1 << f), N - (1 << f));
} else {
const int b = e.second - A;
num += rec(0, U[b], V[b]);
}
// cerr<<e<<": "<<num<<endl;
ans += Mint(e.first) * num;
}
return ans;
}
} // brute
namespace slow {
Mint run() {
vector<int> as;
vector<vector<int>> bss(A + 1);
for (const auto &e : es) {
if (e.second < A) {
const int a = e.second;
as.push_back(a);
} else {
const int b = e.second - A;
bss[as.size()].push_back(b);
}
}
// cerr<<"as = "<<as<<endl;
// cerr<<"bss = "<<bss<<endl;
Mint ans = 0;
Int bef = N;
vector<Int> ds;
for (int i = 0; i <= A; ++i) {
{
sort(ds.begin(), ds.end());
ds.erase(unique(ds.begin(), ds.end()), ds.end());
vector<Int> us;
for (int j = 0; j <= i; ++j) {
for (const int b : bss[j]) {
us.push_back(U[b]);
us.push_back(V[b]);
}
}
auto vs = us;
// cerr<<"ds = "<<ds<<", us = "<<us<<endl;
Int off = 0;
using Entry = pair<Int, Int>;
priority_queue<Entry, vector<Entry>, greater<Entry>> que;
for (const Int d : ds) {
que.emplace(d, d);
}
ds.clear();
Int n = N;
Int now = 0;
for (; ; ) {
if (que.empty()) {
now += n;
break;
}
const Int d0 = que.top().first + off;
const Int save0 = que.top().second;
que.pop();
if (d0 == 0) {
continue;
}
ds.push_back(save0);
for (Int &v : vs) if (v < n) {
v %= d0;
}
if (que.empty()) {
now += d0;
break;
}
const Int d1 = que.top().first + off;
const Int q = n / d0;
const Int r = n % d0;
const Int s = d1 / d0;
n -= d0 * s;
if (q == s) {
now += (d0 - r);
}
off -= d0 * s;
if (d0 < n) {
que.emplace(d0 - off, save0);
}
}
// cerr<<" now = "<<now<<", vs = "<<vs<<endl;
auto ws = vs;
sort(ws.begin(), ws.end());
ws.erase(unique(ws.begin(), ws.end()), ws.end());
const int wsLen = ws.size();
map<Int, int> tr;
for (int k = 0; k < (int)us.size(); ++k) {
tr[us[k]] = lower_bound(ws.begin(), ws.end(), vs[k]) - ws.begin();
}
vector<int> uf(wsLen, -1);
for (int j = 0; j < i; ++j) {
for (const int b : bss[j]) {
if (connect(uf, tr[U[b]], tr[V[b]])) {
--now;
}
}
}
if (i > 0) {
ans += Mint(X[as[i - 1]]) * (bef - now);
}
for (const int b : bss[i]) {
if (connect(uf, tr[U[b]], tr[V[b]])) {
--now;
ans += W[b];
}
}
bef = now;
}
if (i < A) {
ds.push_back(D[as[i]]);
}
}
return ans;
}
} // slow
int main() {
for (; ~scanf("%lld%d%d", &N, &A, &B); ) {
D.resize(A);
X.resize(A);
for (int a = 0; a < A; ++a) {
scanf("%lld%d", &D[a], &X[a]);
}
U.resize(B);
V.resize(B);
W.resize(B);
for (int b = 0; b < B; ++b) {
scanf("%lld%lld%d", &U[b], &V[b], &W[b]);
}
es.resize(A + B);
for (int a = 0; a < A; ++a) {
es[a] = make_pair(X[a], a);
}
for (int b = 0; b < B; ++b) {
es[A + b] = make_pair(W[b], A + b);
}
sort(es.begin(), es.end());
cerr<<"N = "<<N<<", A = "<<A<<", B = "<<B<<endl;
// cerr<<"es = "<<es<<endl;
const Mint ans = slow::run();
printf("%u\n", ans.x);
#ifdef LOCAL
if(N<=200'000){
const Mint brt=brute::run();
if(brt!=ans)cerr<<"brt = "<<brt<<endl;
assert(brt==ans);
}
#endif
}
return 0;
}
详细
Subtask #1:
score: 4
Accepted
Test #1:
score: 4
Accepted
time: 246ms
memory: 10548kb
input:
161199 9 46510 147335 540442844 159493 801351455 149342 821625305 128476 843250712 95524 275754315 139315 106523502 93575 680460786 155498 328812257 146020 410466645 79992 141967 50596784 152210 68644 268349216 72549 96959 42994091 93869 27394 945120577 2909 81886 270684270 12735 35026 871917997 974...
output:
359714743
result:
ok 1 number(s): "359714743"
Test #2:
score: 0
Accepted
time: 229ms
memory: 10764kb
input:
168549 9 49402 160577 34610415 114623 670751010 74448 676966248 53782 845469137 130729 375561046 31610 261496571 134601 154875802 136129 905308676 166248 499420220 69637 72676 875637640 160442 125460 1269794 146261 61770 714794725 137610 1291 490170432 162092 81850 488118013 106400 48193 276190368 4...
output:
520439176
result:
ok 1 number(s): "520439176"
Test #3:
score: 0
Accepted
time: 191ms
memory: 10068kb
input:
127164 9 45109 56483 490066497 70966 229077054 87305 993081887 72423 442762798 80262 200507011 101712 162752728 67532 590730535 44956 565466274 124237 429166816 13030 8906 742024040 97259 101468 187678659 13401 4301 143856524 125750 80473 258719294 106155 10339 592121345 120034 92354 50915550 112430...
output:
211463174
result:
ok 1 number(s): "211463174"
Test #4:
score: 0
Accepted
time: 218ms
memory: 10440kb
input:
158784 9 48415 138305 177767002 147417 50196642 85527 776201932 144377 990389932 118355 310906417 145220 218744495 145002 132736644 51947 834751363 139733 839880491 158443 157692 159261414 111518 14927 747973081 37498 66196 69874791 11597 115114 22394413 16704 133459 109302190 112143 46551 813021872...
output:
151875883
result:
ok 1 number(s): "151875883"
Test #5:
score: 0
Accepted
time: 63ms
memory: 9960kb
input:
111371 0 45933 13298 59545 852258097 94111 54245 459369673 40744 23311 644404848 37039 92443 220984611 17374 43165 421794343 57652 57965 470479953 62977 14481 563172671 102144 3471 36594913 46628 43278 11508424 55965 80136 777230453 56962 35374 349098036 34825 27995 339605509 43021 17657 780921827 5...
output:
92500087
result:
ok 1 number(s): "92500087"
Subtask #2:
score: 0
Time Limit Exceeded
Dependency #1:
100%
Accepted
Test #6:
score: 0
Time Limit Exceeded
input:
191116 49595 45279 87483 815631830 153579 433065789 167569 346797140 98560 154881536 170720 13622837 133236 561208103 155537 421316363 140536 514298139 6005 986290017 154400 85233907 166826 351094521 174419 304435906 173900 61174962 112778 693574534 104503 745038995 134920 31228457 117606 662581798 ...
output:
result:
Subtask #3:
score: 6
Accepted
Test #11:
score: 6
Accepted
time: 0ms
memory: 4112kb
input:
569435269457904707 2 0 490445920091092693 772271583 144842828305643603 609043885
output:
884694794
result:
ok 1 number(s): "884694794"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
946929772456816659 2 0 589193907831915013 196301185 485768367910597533 207014034
output:
790540706
result:
ok 1 number(s): "790540706"
Test #13:
score: 0
Accepted
time: 0ms
memory: 4108kb
input:
693038683299151358 2 0 654733556025919068 724998910 450253521190874799 187460097
output:
122292064
result:
ok 1 number(s): "122292064"
Test #14:
score: 0
Accepted
time: 0ms
memory: 4128kb
input:
572269482188906358 2 0 545978502848607475 331750201 488577730099900109 477584735
output:
429885702
result:
ok 1 number(s): "429885702"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
984888155303961325 2 0 421568681423492040 823358650 324408005979881943 905919848
output:
551223124
result:
ok 1 number(s): "551223124"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
968068649251960108 2 0 932666179822285222 303897491 422068063538287737 405622211
output:
516717723
result:
ok 1 number(s): "516717723"
Test #17:
score: 0
Accepted
time: 0ms
memory: 4080kb
input:
973235486287221374 2 0 604729607242747292 566399250 440704799734330948 93237801
output:
772791524
result:
ok 1 number(s): "772791524"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
980842002786834388 2 0 921076927921054095 989436809 917078581302025088 354268450
output:
387335763
result:
ok 1 number(s): "387335763"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
584600268153835325 2 0 436736455094118542 788823700 379215887395241676 440751386
output:
178749302
result:
ok 1 number(s): "178749302"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
984888155303961325 2 0 421568681423492040 823358650 324408005979881943 905919848
output:
551223124
result:
ok 1 number(s): "551223124"
Subtask #4:
score: 18
Accepted
Dependency #3:
100%
Accepted
Test #21:
score: 18
Accepted
time: 146ms
memory: 11392kb
input:
569435269457904707 2 48002 490445920091092693 772271583 144842828305643603 609043885 71626464779726163 20936760728342582 933619218 254533877531926689 561120543297327423 444805145 102181371350776436 64807827761321835 63236550 442490347461393187 274703226312639148 379888813 153103619447430279 56932615...
output:
264605976
result:
ok 1 number(s): "264605976"
Test #22:
score: 0
Accepted
time: 114ms
memory: 11568kb
input:
504260032580621389 2 49361 270823699250720124 30858888 336528726133157676 686676838 411951311400351555 331964440631830249 849153007 395362490592741772 476242043133170955 233632950 183299785979517028 300783233878432816 890373397 101096990546501308 294220083765028120 482548478 30494794811726538 492575...
output:
374280020
result:
ok 1 number(s): "374280020"
Test #23:
score: 0
Accepted
time: 150ms
memory: 11540kb
input:
908984547406193258 2 49006 553146168947167785 921235648 439052241502823206 685482302 602040034167963673 319806281814227523 602421493 889680730869149610 662785644521343266 319100701 855861307841385482 123218837422189032 958395288 789474388061739888 886525713531875881 485625803 506682328285523072 8679...
output:
411258291
result:
ok 1 number(s): "411258291"
Test #24:
score: 0
Accepted
time: 73ms
memory: 10748kb
input:
645595087071518014 2 46364 502798671238091149 130131399 324145073511001064 249141640 529562079328876365 298584769486918994 793053817 104449532477780267 612956797119263913 599706657 537335025824879813 509591120306867932 422994501 3573858933523744 362779176725767538 466503134 355006270273722975 606167...
output:
3939553
result:
ok 1 number(s): "3939553"
Test #25:
score: 0
Accepted
time: 98ms
memory: 10932kb
input:
719221297460377128 2 47571 344669347369453785 109414971 630436210393683647 527587080 494442208767214644 568762326175380228 274970054 57477492106404787 655245493834324395 382109587 22155928017304041 59482593547715744 873161380 187440545343246007 190303544007160534 159038457 506940482480256741 6413591...
output:
70514973
result:
ok 1 number(s): "70514973"
Test #26:
score: 0
Accepted
time: 88ms
memory: 10424kb
input:
895088201401004405 2 45041 276028463639596405 456551182 805436189268999970 73771 21429629043534406 631368195310636941 265763227 662737085246639506 143087521945488388 635548439 377675072184922400 804129509385729008 716798383 350029179084366085 117553290957648227 20894738 122339684090997249 7205501057...
output:
559035760
result:
ok 1 number(s): "559035760"
Test #27:
score: 0
Accepted
time: 138ms
memory: 11152kb
input:
853901589698398947 2 47600 504553695105130092 847799116 138986940711272376 645918409 805868840752605206 78417023376575599 841040724 729516722093143233 218204564225574757 336393903 730920155682863361 695576676583032360 406662382 387801338291686723 202931704070108854 337663750 247673343610665743 24573...
output:
20383713
result:
ok 1 number(s): "20383713"
Test #28:
score: 0
Accepted
time: 144ms
memory: 10664kb
input:
670502957421329993 2 45217 483745611802893710 733999054 668071203574411469 828666336 420971137268931813 366553146611242395 965231439 287424331604163221 506949430264341972 601249827 149442959137057706 557729764807337099 145435283 24271514949210121 655375054865364550 969273095 570625553631888431 32471...
output:
937105664
result:
ok 1 number(s): "937105664"
Test #29:
score: 0
Accepted
time: 103ms
memory: 11512kb
input:
563845195733711553 2 48989 229866420401531786 558292747 545061569237416562 6907852 132266473456293640 75289038464304103 118029834 32731247863057693 356593250668739234 378210865 66114516634328274 92146176364809198 445824305 231042900349456054 325921825145329565 425319020 423843183122176900 5050925061...
output:
651838351
result:
ok 1 number(s): "651838351"
Test #30:
score: 0
Accepted
time: 123ms
memory: 10556kb
input:
804068805652796381 2 45790 713896086745970460 932094415 451836086076043686 180589234 797324209326094324 458554421458651867 300552452 666099368215435761 398615680976044224 517160772 93127604003167259 65073324216076012 364948453 746562120109527370 478791782647716593 625536788 584650813747492507 584407...
output:
91959720
result:
ok 1 number(s): "91959720"
Subtask #5:
score: 12
Accepted
Test #31:
score: 12
Accepted
time: 3ms
memory: 3864kb
input:
755526150476311190 942 0 492334667739348527 1 755523898623296976 1 532486636690994793 1 755526150476030559 1 755526150476249097 1 502164090270592200 1 657422656495814703 1 487200614853438190 1 311037325561173142 1 755526150475651155 1 125287404340238660 1 755524914808674090 1 755526150476177007 1 75...
output:
546044429
result:
ok 1 number(s): "546044429"
Test #32:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
507397654005748030 973 0 507391491616563534 1 486814015790119176 1 333131389050214032 1 363564475994643564 1 465930313898633808 1 139522156177690314 1 507395579080257474 1 86630001225723132 1 507395634795467574 1 507396923359845774 1 472957579895774142 1 211220548093936200 1 507397483302327114 1 507...
output:
873803086
result:
ok 1 number(s): "873803086"
Test #33:
score: 0
Accepted
time: 3ms
memory: 3816kb
input:
603106685583649335 921 0 550056634223640253 1 603106685583649293 1 603106685583647605 1 603106685583643690 1 603106685583647260 1 603106685583645101 1 603106685583206332 1 603106685583646490 1 579053271797467737 1 603106685567627560 1 392817087439609936 1 603106685583643465 1 603106685583648090 1 60...
output:
249400664
result:
ok 1 number(s): "249400664"
Test #34:
score: 0
Accepted
time: 3ms
memory: 3860kb
input:
548596182165075765 943 0 548596176080168583 1 548596182156180063 1 312480420249896937 1 548596163341594933 1 526283600729694623 1 548596158109050143 1 403131997716059924 1 434962771902913720 1 503166563025971068 1 334309818515550442 1 548596177929282553 1 548596181450546783 1 548596147814225823 1 54...
output:
315888763
result:
ok 1 number(s): "315888763"
Test #35:
score: 0
Accepted
time: 3ms
memory: 3868kb
input:
757339678164545873 914 0 639318686980737134 1 746121423482808728 1 757339678163450618 1 742690258664301578 1 615075436001700347 1 735156649863536078 1 748312116661086428 1 720777012721160772 1 733811525870561678 1 746526366212816378 1 743741354498887825 1 753440640705502328 1 735178291510182878 1 72...
output:
748030011
result:
ok 1 number(s): "748030011"
Test #36:
score: 0
Accepted
time: 3ms
memory: 4168kb
input:
678523609535069397 961 0 678523501457247993 1 678341707003179753 1 678213366219732921 1 596032992350559535 1 595323423910072641 1 178264171486256288 1 678331675351935897 1 353022445409011341 1 653752496830522075 1 662470342111950027 1 587709190707850701 1 678270056924891769 1 677027683908676175 1 67...
output:
562697340
result:
ok 1 number(s): "562697340"
Test #37:
score: 0
Accepted
time: 3ms
memory: 3900kb
input:
657959922343486841 902 0 650132742778059115 1 105135315791795180 1 438709014360864607 1 545602442587344080 1 657551739592023011 1 656791446287459707 1 657959922133303499 1 647469446648658309 1 657959922343384019 1 657959922221719769 1 336017444559583475 1 657959922253125629 1 655097797158940969 1 19...
output:
300994893
result:
ok 1 number(s): "300994893"
Test #38:
score: 0
Accepted
time: 3ms
memory: 3816kb
input:
545476271566415902 948 0 502943849064064720 1 545153141190505744 1 493528954491284005 1 487490221799012640 1 391805643829976272 1 545466964425150144 1 545474613254014704 1 545475659935859328 1 48415031136648176 1 545475230527923072 1 545472466214333424 1 545475176851931040 1 405305381846539616 1 393...
output:
621606394
result:
ok 1 number(s): "621606394"
Test #39:
score: 0
Accepted
time: 3ms
memory: 3864kb
input:
768089367882777564 903 0 768042195730743057 1 624180099065408353 1 677932298998893337 1 761912479820021969 1 373002333986242953 1 681859753068860049 1 768089367882777309 1 580672767835556559 1 768089367882750069 1 51197080622037114 1 737402458661389169 1 768089367882765501 1 707354099585711345 1 768...
output:
319523314
result:
ok 1 number(s): "319523314"
Test #40:
score: 0
Accepted
time: 3ms
memory: 3816kb
input:
803879216581914933 998 0 498552666676978841 1 803189592600095992 1 803577182309491044 1 803875534594601716 1 803827683448699636 1 803767099629307124 1 803775818980883188 1 803799950365214452 1 803816279020876020 1 803806021800931060 1 803585821604611604 1 695090981117645328 1 803690137369875484 1 68...
output:
867132754
result:
ok 1 number(s): "867132754"
Subtask #6:
score: 12
Accepted
Dependency #3:
100%
Accepted
Dependency #5:
100%
Accepted
Test #41:
score: 12
Accepted
time: 32ms
memory: 3952kb
input:
658450692215768892 966 184 215944253331969524 463889684 658450636472429991 583551110 658450692215733673 179443509 658450692215624997 605779678 508574445107762299 859274405 658450681194937638 515630669 63736085272552748 994573345 354907806666837319 932072760 658450692214054043 663256872 6584506911545...
output:
12943668
result:
ok 1 number(s): "12943668"
Test #42:
score: 0
Accepted
time: 32ms
memory: 3964kb
input:
503100602634994293 941 197 502254941823458923 410719580 502449274817977963 533547443 502177856576665963 308661716 503100602634994286 848364395 502374606833359723 403813521 500909455018842115 763372389 436423359815749426 878348769 502539379040627347 691350061 500478693279270763 227006141 502429907131...
output:
364124022
result:
ok 1 number(s): "364124022"
Test #43:
score: 0
Accepted
time: 35ms
memory: 3956kb
input:
794543759708235787 990 200 794543751390436516 498296758 710761081263791990 541764893 794543758436298068 338401430 764875891357270304 761817879 735614769808273484 635855135 794543754989372684 409779107 717851578458891300 765401991 161042388300387362 617871045 511627804824526915 940296882 794543756648...
output:
69328383
result:
ok 1 number(s): "69328383"
Test #44:
score: 0
Accepted
time: 32ms
memory: 3976kb
input:
565276290672233192 964 187 565276290670765530 537786598 565276290502116615 193903398 565276290671867680 489303416 383466025969347505 426331410 565276288985082995 229639082 535558729837813905 325909644 474196520248462440 639989576 307149486876119700 818820866 565276290671678355 504462133 565276290446...
output:
631847000
result:
ok 1 number(s): "631847000"
Test #45:
score: 0
Accepted
time: 30ms
memory: 3968kb
input:
719500283503014592 940 191 596954007460465466 459554486 711843970141183964 193724011 662050619203756685 326598696 687071628534410294 147562554 671522026560145754 166094666 632739715281611294 435823622 629554949383658196 880683852 719500283450265202 559607128 430055232270736641 937845392 644024279806...
output:
537913133
result:
ok 1 number(s): "537913133"
Test #46:
score: 0
Accepted
time: 31ms
memory: 3960kb
input:
746081052613716768 968 186 114806715755696720 513769389 746081051437216030 737208639 746081050913326390 761645235 610859457429446257 863358451 384587317556948678 937572929 745110336760534160 247865779 136264144005106400 510157400 746050759360662160 25053097 744815172303539440 141073649 7451915550759...
output:
802963512
result:
ok 1 number(s): "802963512"
Test #47:
score: 0
Accepted
time: 32ms
memory: 3920kb
input:
838569256262277534 902 194 368691841488556872 548966575 829187927329664760 439579643 599012418708046200 321256268 99251099043250440 385138871 666529761967066140 305621549 838569256260878142 77869183 242796476636375376 563943468 115450425805486200 223598230 473794040645928288 526038447 52249254896767...
output:
902343531
result:
ok 1 number(s): "902343531"
Test #48:
score: 0
Accepted
time: 30ms
memory: 4016kb
input:
760989644838376533 918 184 760989644837357739 253937074 760989644735019972 299540701 721179032823874952 367005016 737774529756321877 63616085 676404669053970597 413375592 760989644763128262 467319659 696835782280314477 162526593 760989638053297620 744413973 256689804086807511 609569539 6462443154065...
output:
255884156
result:
ok 1 number(s): "255884156"
Test #49:
score: 0
Accepted
time: 35ms
memory: 3912kb
input:
605066708578608907 985 195 605040377919406881 845020040 605066682441689774 600561672 605066708559869524 61659795 570731240318881512 736991447 605066708545791824 69236017 605066702556562799 451865546 605045604828879780 81156584 605066708578248274 113710627 520890466933562693 888100231 510935353837155...
output:
30494216
result:
ok 1 number(s): "30494216"
Test #50:
score: 0
Accepted
time: 32ms
memory: 3912kb
input:
707923123776380648 960 191 707923123776375484 799176622 164813810270485419 975427804 446662266871612830 721645063 706273141785672657 596852756 707923108287090339 101641673 466130775646175913 938132930 141563786833129006 981855402 111394344057775227 983059268 707923119233185773 27527747 6649052793931...
output:
37261270
result:
ok 1 number(s): "37261270"
Subtask #7:
score: 0
Time Limit Exceeded
Dependency #3:
100%
Accepted
Dependency #5:
100%
Accepted
Test #51:
score: 0
Time Limit Exceeded
input:
571630416836886394 47168 0 96863681397862733 975125142 356044822253140262 598706048 515453346882217082 780566337 310612673285348975 628963074 470413750105710996 521531320 485023891192396182 511014543 294586905153825661 925671185 571630416738335094 158726562 185789055211250703 954614799 3548394816997...
output:
result:
Subtask #8:
score: 0
Time Limit Exceeded
Dependency #5:
100%
Accepted
Test #61:
score: 0
Time Limit Exceeded
input:
716429171502522215 47121 48854 684206275836370608 1 447368400898092275 1 500447584334752997 1 380938825102517800 1 703571667242752149 1 432997187680148804 1 169070786477357537 1 702163195024687605 1 706006848814479885 1 714728181809868081 1 702992487375782988 1 695502249468972696 1 29949334130159091...
output:
result:
Subtask #9:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%