QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#81755 | #5566. And Xor Tree | yosupo | AC ✓ | 1246ms | 26908kb | C++20 | 5.7kb | 2023-02-26 11:15:36 | 2023-02-26 11:15:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; (i) < (int)(N); (i)++)
#define all(x) begin(x), end(x)
#define pb push_back
using ll = long long;
const int K = 26;
const int MOD = 998244353;
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int N; cin >> N;
vector<int> a(N);
rep(u, N) cin >> a[u];
vector<vector<int>> G(N);
rep(i, N - 1) {
int x, y;
cin >> x >> y;
x--; y--;
G[x].pb(y);
G[y].pb(x);
}
vector<int> ps;
vector<int> par(N);
vector<int> xsum(N);
vector<int> sz(N, 1);
auto dfs_sz = [&](auto self, int u, int p) -> void {
for (int v: G[u]) if (v != p) {
self(self, v, u);
sz[u] += sz[v];
}
};
dfs_sz(dfs_sz, 0, -1);
auto dfs = [&](auto self, int u, int p) -> void {
par[u] = p;
xsum[u] ^= a[u];
sort(G[u].begin(), G[u].end(), [&](int a, int b) { return sz[a] > sz[b]; });
for (int v: G[u]) if (v != p) {
xsum[v] = xsum[u];
self(self, v, u);
}
ps.pb(u);
};
dfs(dfs, 0, -1);
{
vector<int> _a(N);
rep(u, N) _a[u] = a[ps[u]];
a = _a;
}
{
vector<int> _xsum(N);
rep(u, N) _xsum[u] = xsum[ps[u]];
xsum = _xsum;
}
{
vector<int> ips(N);
rep(u, N) ips[ps[u]] = u;
vector<int> _par(N);
rep(u, N) {
int p = par[ps[u]];
_par[u] = p == -1 ? -1 : ips[p];
}
par = _par;
}
auto calc_A = [&]() -> int {
ll A = 0;
rep(i, K) for (int j = i; j < K; j++) {
int mask = 1<<i | 1<<j;
vector<int> dp(N);
ll pair = 0;
rep(u, N) if ((a[u] & mask) == mask) {
dp[u]++;
int p = par[u];
if (p != -1 && ((a[p] & mask) == mask)) {
dp[p] += dp[u];
} else {
pair += (ll)dp[u] * dp[u];
}
}
ll coef = 1LL<<(i + j);
if (i < j) coef *= 2;
A = (A + (coef % MOD) * (pair % MOD)) % MOD;
}
return A;
};
auto calc_O = [&]() -> int {
ll O = 0;
vector<ll> unko(K);
rep(i, K) {
int mask = 1<<i;
vector<int> dp(N);
rep(u, N) if ((a[u] & mask) == 0) {
dp[u]++;
int p = par[u];
if (p != -1 && ((a[p] & mask) == 0)) {
dp[p] += dp[u];
} else {
unko[i] += (ll)dp[u] * dp[u];
}
}
}
rep(i, K) for (int j = i; j < K; j++) {
int mask = 1<<i | 1<<j;
vector<int> dp(N);
ll pair = 0;
rep(u, N) if ((a[u] & mask) == 0) {
dp[u]++;
int p = par[u];
if (p != -1 && ((a[p] & mask) == 0)) {
dp[p] += dp[u];
} else {
pair += (ll)dp[u] * dp[u];
}
}
pair = (ll)N * N - unko[i] - unko[j] + pair;
ll coef = 1LL<<(i + j);
if (i < j) coef *= 2;
O = (O + (coef % MOD) * (pair % MOD)) % MOD;
}
return O;
};
auto calc_X = [&]() -> int {
ll X = 0;
rep(u, N) X = (X + (ll)a[u] * a[u]) % MOD;
rep(i, K) for (int j = i; j < K; j++) {
ll pair = 0;
vector<int> dp00(N);
vector<int> dp01(N);
vector<int> dp10(N);
vector<int> dp11(N);
rep(u, N) {
int s = xsum[u] >> i & 1;
int t = xsum[u] >> j & 1;
if (s == 0 && t == 0) dp00[u]++;
if (s == 0 && t == 1) dp01[u]++;
if (s == 1 && t == 0) dp10[u]++;
if (s == 1 && t == 1) dp11[u]++;
}
rep(u, N) {
int p = par[u];
if (p == -1) continue;
if ((a[p]>>i & 1) == 0 && (a[p]>>j & 1) == 0) {
pair += (ll) dp00[p] * dp11[u];
pair += (ll) dp01[p] * dp10[u];
pair += (ll) dp10[p] * dp01[u];
pair += (ll) dp11[p] * dp00[u];
}
if ((a[p]>>i & 1) == 0 && (a[p]>>j & 1) == 1) {
pair += (ll) dp01[p] * dp11[u];
pair += (ll) dp00[p] * dp10[u];
pair += (ll) dp11[p] * dp01[u];
pair += (ll) dp10[p] * dp00[u];
}
if ((a[p]>>i & 1) == 1 && (a[p]>>j & 1) == 0) {
pair += (ll) dp10[p] * dp11[u];
pair += (ll) dp11[p] * dp10[u];
pair += (ll) dp00[p] * dp01[u];
pair += (ll) dp01[p] * dp00[u];
}
if ((a[p]>>i & 1) == 1 && (a[p]>>j & 1) == 1) {
pair += (ll) dp11[p] * dp11[u];
pair += (ll) dp10[p] * dp10[u];
pair += (ll) dp01[p] * dp01[u];
pair += (ll) dp00[p] * dp00[u];
}
dp00[p] += dp00[u];
dp01[p] += dp01[u];
dp10[p] += dp10[u];
dp11[p] += dp11[u];
}
ll coef = 1LL<<(i + j);
coef *= 2;
if (i < j) coef *= 2;
X = (X + (coef % MOD) * (pair % MOD)) % MOD;
}
return X;
};
cout << calc_A() << ' ' << calc_O() << ' ' << calc_X() << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3448kb
input:
2 14 2 2 1
output:
208 592 488
result:
ok 3 number(s): "208 592 488"
Test #2:
score: 0
Accepted
time: 2ms
memory: 3416kb
input:
5 3 9 14 7 12 4 1 4 3 4 5 3 2
output:
769 4627 1697
result:
ok 3 number(s): "769 4627 1697"
Test #3:
score: 0
Accepted
time: 2ms
memory: 3500kb
input:
12 10 3 8 13 6 2 3 14 1 5 10 6 10 1 6 2 2 10 9 7 2 9 9 11 3 7 8 2 5 7 4 7 12 2
output:
825 20705 12035
result:
ok 3 number(s): "825 20705 12035"
Test #4:
score: 0
Accepted
time: 2ms
memory: 3480kb
input:
30 32801019 1273274 2323119 14425862 32092066 22290080 15455084 19574448 4526740 27594543 3658782 9257878 22401128 5963736 706870 13234322 9580299 9425537 17909690 18353460 18131515 22136066 4793282 33069117 20273677 26180519 20627197 29911588 7973224 9100209 22 18 2 22 17 4 24 15 16 7 10 28 13 18 1...
output:
757036499 252895272 733168443
result:
ok 3 number(s): "757036499 252895272 733168443"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
30 11503772 8033740 29372041 2256306 9206137 21358999 10590073 32436961 4177802 29856979 20948609 4707854 31448621 2696795 15106750 24929447 6675044 770382 3722038 8519836 20335445 6611343 6893393 25734370 9173706 25112646 31364954 14985714 23467442 26306654 23 16 1 12 1 23 1 5 1 3 21 29 1 9 30 23 8...
output:
750883512 46071048 459411691
result:
ok 3 number(s): "750883512 46071048 459411691"
Test #6:
score: 0
Accepted
time: 2ms
memory: 3460kb
input:
30 31105279 31657085 12942070 25834607 6776453 15458523 22972175 3401013 22061546 22749555 9609098 6742476 23362270 30930626 32654073 10799458 3216117 17428426 12133396 3212780 2907687 6672016 30083635 9298079 30313296 1533085 20726228 14132855 23133361 10125182 1 23 22 24 19 14 30 27 23 25 28 19 18...
output:
910017491 180975027 410008337
result:
ok 3 number(s): "910017491 180975027 410008337"
Test #7:
score: 0
Accepted
time: 2ms
memory: 3416kb
input:
30 22517652 22513403 6876452 22945430 30946451 119035 24925625 6401967 22685834 17651682 824202 23721991 15441280 32086694 19293801 15452784 30358447 33285012 18365338 26388048 32652294 29744842 2549846 27932191 19024552 14188732 3093578 29957613 19741035 30227635 9 10 10 26 28 10 17 10 10 1 10 7 10...
output:
983106656 641601403 153621673
result:
ok 3 number(s): "983106656 641601403 153621673"
Test #8:
score: 0
Accepted
time: 2ms
memory: 3476kb
input:
30 8564727 12582316 24000913 12969299 28516767 27772991 3753294 10920451 7015146 10544258 23039123 25756613 7354929 26766093 3286693 1322796 26899520 16388624 26776696 21080992 15224536 29805514 25740088 11495900 6609710 24163603 26009284 29104753 19406954 14046163 10 15 27 25 23 6 7 10 17 23 26 2 6...
output:
939301515 161037129 79376169
result:
ok 3 number(s): "939301515 161037129 79376169"
Test #9:
score: 0
Accepted
time: 154ms
memory: 4360kb
input:
12345 24004116 19105913 21692479 2078415 21040625 8901488 19649203 20478000 25313498 13099006 4280365 30603300 11844299 20169164 18097227 8243141 27856677 27634823 26494031 25498740 26186027 3960928 24313759 8940627 1240197 3737229 8298566 5542601 33377729 22097350 27368304 24339714 19536589 1737287...
output:
798077116 667474820 858066633
result:
ok 3 number(s): "798077116 667474820 858066633"
Test #10:
score: 0
Accepted
time: 112ms
memory: 4520kb
input:
12345 2754190 24488410 22025025 16263121 1262966 3713169 3261678 22318804 21095687 23018221 16702015 7316968 7128058 21629679 9244291 11551470 23621968 32093818 12848521 29231598 19624139 19654615 5341224 30903697 23498610 29556273 19015865 10223525 2312209 17450522 20058008 2781597 1718198 17351172...
output:
965894127 80187402 198802507
result:
ok 3 number(s): "965894127 80187402 198802507"
Test #11:
score: 0
Accepted
time: 153ms
memory: 4752kb
input:
12345 25049310 31078874 32793834 1358067 7115036 6314042 23074235 20352452 1747568 28039747 4296783 17050794 18143256 12016662 25708729 19454956 2468375 31723070 8550413 23124082 3097012 6970917 10959076 8128076 19576315 17247900 14136284 30814507 16746554 15179863 32070678 6741222 19212421 1403503 ...
output:
649954019 186496731 592042026
result:
ok 3 number(s): "649954019 186496731 592042026"
Test #12:
score: 0
Accepted
time: 140ms
memory: 4408kb
input:
12345 19765988 24709032 27308638 6399891 33307074 2836084 5154820 20036707 8918607 11173330 28124692 16892346 17413221 2578198 25882242 30334356 30251956 28202378 15118425 16857894 28933696 4563177 1054262 25951574 14659296 630758 23864523 2687294 10151873 22176419 32958814 22704301 32268514 2874682...
output:
945817569 399136172 983223939
result:
ok 3 number(s): "945817569 399136172 983223939"
Test #13:
score: 0
Accepted
time: 138ms
memory: 4408kb
input:
12345 25235369 32409296 16577707 10506904 10105788 24746366 23185930 6651950 1577232 12258183 3812906 17542217 11167595 10637837 17592750 15481205 22023147 14936483 33127371 19535086 10272637 33509587 33130698 842025 24335718 18469528 25311369 28164171 23996862 24649956 24112379 23094960 7333872 105...
output:
598800114 168765706 840788900
result:
ok 3 number(s): "598800114 168765706 840788900"
Test #14:
score: 0
Accepted
time: 764ms
memory: 19564kb
input:
100000 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554...
output:
599403331 599403331 592779175
result:
ok 3 number(s): "599403331 599403331 592779175"
Test #15:
score: 0
Accepted
time: 559ms
memory: 12484kb
input:
100000 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554...
output:
599403331 599403331 940355720
result:
ok 3 number(s): "599403331 599403331 940355720"
Test #16:
score: 0
Accepted
time: 671ms
memory: 12200kb
input:
100000 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554...
output:
599403331 599403331 195796025
result:
ok 3 number(s): "599403331 599403331 195796025"
Test #17:
score: 0
Accepted
time: 669ms
memory: 23472kb
input:
100000 0 7 9 5 1 7 10 10 6 8 7 9 8 4 4 9 4 0 5 5 6 5 3 10 10 8 4 6 6 10 5 5 0 9 9 1 0 5 6 7 3 4 6 2 9 1 6 2 2 5 3 4 6 8 9 2 7 9 8 4 4 8 3 6 2 3 9 2 1 10 1 4 8 1 2 3 4 3 7 3 8 7 1 7 6 2 4 3 1 1 4 10 9 1 4 7 10 8 6 7 3 4 3 2 3 9 2 4 8 1 0 7 6 10 7 6 10 4 0 3 1 9 9 10 4 7 3 5 9 7 7 0 1 0 7 7 0 0 10 5 1...
output:
6272790 826570561 366867132
result:
ok 3 number(s): "6272790 826570561 366867132"
Test #18:
score: 0
Accepted
time: 582ms
memory: 12476kb
input:
100000 5 5 5 2 10 7 6 5 10 2 4 8 5 3 0 1 4 5 2 10 7 3 1 6 6 9 2 10 7 0 1 1 9 9 0 10 4 5 1 0 1 4 0 1 5 5 7 10 10 2 7 5 1 8 3 9 1 8 4 6 10 1 2 1 1 3 8 9 4 9 9 5 10 4 5 10 0 8 1 7 6 0 7 1 7 2 5 5 5 0 10 0 3 4 4 1 7 1 3 7 5 1 7 3 1 1 10 8 2 5 6 1 1 6 1 4 7 7 6 2 7 2 3 9 5 8 8 7 0 0 5 9 3 4 10 4 5 10 2 3...
output:
59437106 515109706 493900500
result:
ok 3 number(s): "59437106 515109706 493900500"
Test #19:
score: 0
Accepted
time: 684ms
memory: 12264kb
input:
100000 6 5 8 7 3 8 2 3 9 2 1 4 0 9 4 7 3 7 3 0 1 2 1 0 10 3 9 0 7 7 1 2 2 0 9 10 10 1 6 0 4 9 5 2 3 9 9 9 9 10 1 2 2 8 8 2 5 5 9 0 0 5 7 0 6 3 9 3 9 9 10 4 3 8 7 3 10 1 8 0 9 6 9 2 7 5 5 5 6 10 10 5 8 2 2 7 8 7 1 3 6 5 10 10 3 1 10 5 7 5 10 5 3 9 3 7 1 9 1 2 6 0 9 7 0 9 3 2 9 5 2 4 1 1 4 6 3 7 6 0 7...
output:
8580777 995149946 277944493
result:
ok 3 number(s): "8580777 995149946 277944493"
Test #20:
score: 0
Accepted
time: 1222ms
memory: 12192kb
input:
100000 25678544 27546359 13609363 16572751 26227484 19673087 15046177 19185100 25752071 27910619 13103766 2123908 28666607 17541483 13904828 16607953 14452906 5252647 5259540 23626212 9945088 28578967 27191118 6866239 26663470 6905050 15039186 32054587 27430756 28406048 26067514 9046403 6811976 7666...
output:
12670402 725063240 105070793
result:
ok 3 number(s): "12670402 725063240 105070793"
Test #21:
score: 0
Accepted
time: 1190ms
memory: 12176kb
input:
100000 28206435 16625917 8248542 11586750 10524242 31787490 3861921 20475280 23730219 19996730 33199732 160221 14785540 31940231 692622 16930585 7869780 6967886 13245897 616955 19997303 7440536 32534307 17820414 17827118 7371378 16822077 30294753 16460572 20875629 17665503 9979688 22562378 17959966 ...
output:
925701666 984427798 944657916
result:
ok 3 number(s): "925701666 984427798 944657916"
Test #22:
score: 0
Accepted
time: 1193ms
memory: 12768kb
input:
100000 22268931 8556974 3314184 17844919 9137433 2658104 28859905 27079547 12576008 7540998 129089 32659215 26053407 25620015 26114894 9888598 15529664 23072255 3452677 21849508 23817695 21478003 31710997 9225536 9610119 30589629 20513154 3018217 1689173 9530822 2239780 18418254 28958459 31145127 67...
output:
258383457 987490084 68659675
result:
ok 3 number(s): "258383457 987490084 68659675"
Test #23:
score: 0
Accepted
time: 1166ms
memory: 14252kb
input:
100000 13067828 6413900 32156224 1731226 25707499 22108677 32933389 2402696 20541657 30138829 1853213 23787543 16298952 12048738 9192365 30081991 341894 1430053 8122938 16735741 27166562 22223774 27799049 29004929 1481651 3007478 19631008 14473727 6878801 13428859 1752395 25575046 32034586 32290335 ...
output:
856204945 49968571 317716893
result:
ok 3 number(s): "856204945 49968571 317716893"
Test #24:
score: 0
Accepted
time: 1169ms
memory: 21384kb
input:
100000 32472608 25056897 8765351 23010240 19685724 11646820 30027457 17055823 26802695 13452430 19591821 8220022 9461670 12894729 30917535 33500061 20884223 30548159 17411088 4168276 22960798 17872641 14824446 29143244 26068817 18286851 5479946 22679132 3057837 13705565 2372568 28859133 108934 18708...
output:
548617418 697398995 137817943
result:
ok 3 number(s): "548617418 697398995 137817943"
Test #25:
score: 0
Accepted
time: 1193ms
memory: 14428kb
input:
100000 27371699 23908719 33300439 25198876 24785561 28176220 25215067 29812656 26574235 29588462 24722738 23965944 33491655 30043622 32149171 32307265 24867695 30263814 30821647 24244358 25717680 30651002 27921660 27872187 26921012 24864514 33125879 26885329 24735180 26894770 31369707 26118248 31979...
output:
142199186 432883935 676695755
result:
ok 3 number(s): "142199186 432883935 676695755"
Test #26:
score: 0
Accepted
time: 1213ms
memory: 18024kb
input:
100000 13343567 11028495 1416918 8004555 10087853 5778897 738213 8129561 10156959 5392536 2390899 13241282 5902355 8090960 6790384 10011971 7236763 12779048 3765935 11632284 7368175 3632658 8944042 8574675 10286951 262982 8624573 2365041 2858881 6562495 8548903 5760515 6396513 12112060 8736268 64976...
output:
454285144 323855811 778352219
result:
ok 3 number(s): "454285144 323855811 778352219"
Test #27:
score: 0
Accepted
time: 1181ms
memory: 23824kb
input:
100000 4998886 1479543 4859961 344417 30132545 13552230 5983224 24802917 8085925 30622617 797775 1500978 9978736 3916577 2150377 4187443 16446262 25191265 29355490 20556133 7649597 21400464 19204171 20787930 24699902 6698554 25908904 33256760 29088426 31557568 10190961 31971127 11665315 29930707 150...
output:
361936885 56019316 658516325
result:
ok 3 number(s): "361936885 56019316 658516325"
Test #28:
score: 0
Accepted
time: 1168ms
memory: 12200kb
input:
100000 7496972 21794915 6870843 28976698 8080059 21277030 4349114 10740348 18655835 16586071 18420902 2123819 28102592 21833690 6205787 359814 3437167 32467303 4577322 4855517 27588644 6020552 658390 28214551 10782540 3447455 5924633 13366317 31058316 20884958 24192800 19216813 31604280 2184268 2739...
output:
843704360 327453766 595261393
result:
ok 3 number(s): "843704360 327453766 595261393"
Test #29:
score: 0
Accepted
time: 931ms
memory: 12644kb
input:
100000 22454991 9887396 20652489 26993757 12128185 21090427 28971601 13379045 12405672 25313867 33199644 33150638 19077747 24241190 17998915 5914847 1530004 6285668 28029635 18260511 30993320 14462240 20328187 1939485 14369523 31811257 31688239 367881 8939481 19000915 27835912 1217560 17079910 67218...
output:
258589952 730583337 618220146
result:
ok 3 number(s): "258589952 730583337 618220146"
Test #30:
score: 0
Accepted
time: 947ms
memory: 12692kb
input:
100000 28225506 5428313 27211885 27034720 30214372 2420269 3700250 3575985 29919087 28093261 33524323 4689287 2935659 29994491 29394952 22723727 2387476 30221290 30162014 20295205 22501497 17580227 30764497 517086 30239230 22513827 13068892 16532224 1011419 2157211 7333394 26629893 16803482 22719279...
output:
74401615 207277496 203086987
result:
ok 3 number(s): "74401615 207277496 203086987"
Test #31:
score: 0
Accepted
time: 940ms
memory: 12544kb
input:
100000 6329308 18817848 14008799 3335169 15010436 13663925 25837154 24632580 25858794 30138741 1289198 28079750 8599911 29355030 31731058 23742215 33214107 16213791 25766494 27731758 633834 10017654 11918120 25547334 25921530 17873639 23258567 6952636 5004087 23599268 26544699 20092579 20796495 9040...
output:
289328892 577895044 8419339
result:
ok 3 number(s): "289328892 577895044 8419339"
Test #32:
score: 0
Accepted
time: 915ms
memory: 12604kb
input:
100000 25734088 3906412 24172357 24614183 8988661 3202068 22931222 5731276 32119832 13452342 19027806 12512229 1762629 30201022 19901796 27160285 20202005 11777464 1500212 15164293 29982502 5666521 32497949 25685649 16954265 33153013 9107505 15158041 1183123 23875974 27164872 23376666 22425276 29013...
output:
873230456 604472060 234307639
result:
ok 3 number(s): "873230456 604472060 234307639"
Test #33:
score: 0
Accepted
time: 970ms
memory: 12480kb
input:
100000 1870224 25377243 14049762 21421356 29894710 21947007 16034094 8591564 28638188 30463420 6382279 11937662 14353212 7196635 14985506 24599687 23595297 18346170 27801188 19239935 3751821 20453964 10495721 7862609 16624100 32808724 5868479 32579005 21714815 3096750 18402600 19816151 3239467 30703...
output:
473726701 649449397 521471652
result:
ok 3 number(s): "473726701 649449397 521471652"
Test #34:
score: 0
Accepted
time: 1234ms
memory: 19708kb
input:
100000 8519659 22356419 23417838 27839243 10194778 19213678 2180027 20247927 266924 26934895 29906828 21361974 18036850 3855446 19944029 27430228 13202607 16282441 26877916 18627250 5225310 14918275 6469356 32840321 29625066 24509137 33410082 28057803 18663092 22807827 27546699 11116266 19718545 138...
output:
380843366 710268988 696479853
result:
ok 3 number(s): "380843366 710268988 696479853"
Test #35:
score: 0
Accepted
time: 896ms
memory: 12420kb
input:
100000 5390997 12699687 32607639 15361750 9956943 27608455 12230897 4036574 20819187 26775697 1936900 31798658 22411325 7135504 32779157 14288041 20351642 9437347 25323614 17311052 1327534 13971775 31315338 19915000 21549264 17064875 13369657 27380048 11289481 27901442 2203906 32515721 11292697 1464...
output:
280716894 60663756 667880837
result:
ok 3 number(s): "280716894 60663756 667880837"
Test #36:
score: 0
Accepted
time: 478ms
memory: 26908kb
input:
100000 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554...
output:
599403331 599403331 798823842
result:
ok 3 number(s): "599403331 599403331 798823842"
Test #37:
score: 0
Accepted
time: 639ms
memory: 12516kb
input:
100000 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554...
output:
599403331 599403331 255715031
result:
ok 3 number(s): "599403331 599403331 255715031"
Test #38:
score: 0
Accepted
time: 1081ms
memory: 15740kb
input:
100000 8590792 8583249 8542828 8603742 8583647 8683523 8591925 8614548 8556269 8612842 8566047 8511247 8517840 8600757 8553066 8570641 8652279 8607521 8537453 8578318 8665187 8567270 8561270 8652016 8687502 8602858 8631507 8571696 8609829 8526945 8621991 8681334 8518526 8604032 8611764 8586492 86978...
output:
268941125 800292402 777023082
result:
ok 3 number(s): "268941125 800292402 777023082"
Test #39:
score: 0
Accepted
time: 883ms
memory: 12620kb
input:
100000 8604107 8586225 8674661 8658154 8508015 8549618 8510272 8664539 8660989 8645768 8637688 8573102 8621602 8545412 8515944 8609163 8519350 8682590 8582274 8566994 8558970 8597149 8601183 8683421 8574526 8669484 8587180 8671672 8502923 8638920 8572428 8593553 8518310 8635420 8674640 8601748 85412...
output:
428208260 763320188 138792686
result:
ok 3 number(s): "428208260 763320188 138792686"
Test #40:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
30 6234681 11561148 26432564 2073235 7930132 32459803 21911735 15420986 12295587 11759365 1469367 4037790 16696984 7856749 18615243 21784516 23892233 21259288 32313157 21016557 9764350 8641300 33375627 29722168 12915087 10066579 19749751 20432494 10816887 530826 2 10 20 2 25 27 21 10 1 26 4 12 15 14...
output:
982567 927606509 919947876
result:
ok 3 number(s): "982567 927606509 919947876"
Test #41:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
30 14470268 3846949 14594852 16185002 27783756 6723260 18535189 1092638 10752954 23467883 17883245 5498670 31804534 4140201 10385435 27182390 33342390 23441192 18674956 26360041 16720112 10230160 7032600 25312491 19282025 17456258 23114305 28389290 7733549 292842 23 30 7 28 30 28 28 17 1 28 5 25 20 ...
output:
900495236 498560762 917606587
result:
ok 3 number(s): "900495236 498560762 917606587"
Test #42:
score: 0
Accepted
time: 2ms
memory: 3420kb
input:
30 4345742 26317802 22523005 23238127 22469537 7718722 6656583 29224648 7584255 32772198 28843018 6873169 23051243 3701600 32425830 31320015 25665113 13828526 20619188 31427534 14604014 5363335 398059 29075844 27921591 4918731 6621452 10610881 29308234 7324828 6 4 27 20 11 15 9 18 3 9 22 30 30 20 13...
output:
359554215 949742309 969659321
result:
ok 3 number(s): "359554215 949742309 969659321"
Test #43:
score: 0
Accepted
time: 2ms
memory: 3436kb
input:
30 31427937 30131126 22042976 16245277 13231132 20642418 22951543 27335536 20220651 12667346 25633583 15398095 6041641 25220688 18837893 4103288 18928035 16912362 5653573 27541675 32326578 30737746 22415737 15101645 31857275 23106455 18770854 4077166 5378730 2232343 30 14 8 30 30 9 22 30 30 24 15 25...
output:
441776336 936094079 843157592
result:
ok 3 number(s): "441776336 936094079 843157592"
Test #44:
score: 0
Accepted
time: 2ms
memory: 3388kb
input:
30 21303539 19047804 29971258 23290210 7916786 21637880 11073065 21912987 17060144 21963468 3038798 16780659 30834461 24774150 7323729 8249104 11242566 7299568 7597676 32609296 30210352 25870793 15781195 18864998 6942410 10569056 2269808 19844997 26953416 9272521 21 10 17 4 26 25 11 3 15 30 7 20 13 ...
output:
352170112 411854636 466175279
result:
ok 3 number(s): "352170112 411854636 466175279"
Test #45:
score: 0
Accepted
time: 139ms
memory: 4356kb
input:
12345 14801569 5933061 26028269 1714713 13277164 7943996 6503576 18577798 27004034 13730597 30216477 22677111 16964022 24879317 13438544 5917139 15778451 19451833 15839527 24070463 27458061 21508791 5704025 24196772 19431151 2097066 6685767 7314891 28666638 3513292 20700528 5735116 21525333 27306396...
output:
706698813 374417416 492268412
result:
ok 3 number(s): "706698813 374417416 492268412"
Test #46:
score: 0
Accepted
time: 109ms
memory: 4464kb
input:
12345 28801364 5815686 8857200 21761716 31846025 5801523 22653346 10430376 15414713 27283921 8026364 20867315 3710531 25839703 12881790 21002783 29934260 10313374 15129476 27340447 25332645 4682410 31140097 30086964 610835 19140117 20850302 28131105 3348139 10021960 6430595 29561884 27194631 3073633...
output:
879957773 190290171 483883963
result:
ok 3 number(s): "879957773 190290171 483883963"
Test #47:
score: 0
Accepted
time: 148ms
memory: 4712kb
input:
12345 3046237 22905022 1770536 12445487 12628777 15426602 29323569 26234497 29705878 29986029 8071054 22563099 11797550 3726882 23005388 6434570 32113808 20098188 32658426 17666872 28713227 18483111 30688951 3715310 14935036 6003750 24041653 28817708 4118222 17216799 14184038 8515606 29892494 278609...
output:
668867527 474562433 504968143
result:
ok 3 number(s): "668867527 474562433 504968143"
Test #48:
score: 0
Accepted
time: 138ms
memory: 4404kb
input:
12345 19247314 31151940 19452778 21151646 33231948 3831914 25100921 26974167 19675728 12532269 21037357 13902280 15720356 11778683 19601926 15195702 27676835 1625282 12649177 5968990 25688631 1949542 19133027 439430 17488737 1782750 24673407 6622431 4243883 2072899 20778761 9624833 28329869 6398525 ...
output:
120809545 235255702 652915328
result:
ok 3 number(s): "120809545 235255702 652915328"
Test #49:
score: 0
Accepted
time: 127ms
memory: 4376kb
input:
12345 2082678 21250509 23135213 7143855 24432006 20311781 10894423 20659987 3962021 10376226 10895811 3179387 24041481 19508689 22566556 20359911 16948527 11795 20830433 15292300 28812210 14888587 24106917 18445111 8404896 2209838 8553339 8846789 8889413 20275307 23038785 12955368 18419805 1727932 2...
output:
228374620 845221184 897336426
result:
ok 3 number(s): "228374620 845221184 897336426"
Test #50:
score: 0
Accepted
time: 604ms
memory: 23704kb
input:
100000 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554...
output:
599403331 599403331 603772213
result:
ok 3 number(s): "599403331 599403331 603772213"
Test #51:
score: 0
Accepted
time: 507ms
memory: 12452kb
input:
100000 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554...
output:
599403331 599403331 513997556
result:
ok 3 number(s): "599403331 599403331 513997556"
Test #52:
score: 0
Accepted
time: 701ms
memory: 12136kb
input:
100000 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554431 33554...
output:
599403331 599403331 712477225
result:
ok 3 number(s): "599403331 599403331 712477225"
Test #53:
score: 0
Accepted
time: 790ms
memory: 21944kb
input:
100000 1 6 5 1 10 7 0 0 3 0 6 1 6 10 5 2 8 5 3 7 5 5 0 10 0 9 0 4 4 7 9 5 10 3 6 6 7 5 2 10 7 5 10 2 7 9 9 6 0 0 10 3 6 7 4 2 2 4 6 5 0 4 5 10 4 1 5 6 9 9 5 3 3 6 6 1 3 9 0 1 4 1 0 4 3 9 3 0 7 10 5 0 2 8 8 3 2 3 8 2 0 8 1 5 2 1 6 0 3 5 4 6 9 6 2 5 2 10 10 7 6 1 0 10 8 3 3 7 0 10 6 0 8 3 6 4 0 3 0 10...
output:
6259133 827157110 284626207
result:
ok 3 number(s): "6259133 827157110 284626207"
Test #54:
score: 0
Accepted
time: 634ms
memory: 12504kb
input:
100000 5 1 6 8 10 6 10 4 9 10 8 8 7 9 0 1 4 3 2 5 6 2 1 7 7 2 8 3 9 10 7 1 8 9 10 9 6 1 5 9 9 8 10 6 5 7 6 3 7 2 10 7 5 7 6 2 6 4 4 10 5 3 7 3 2 3 8 3 9 3 6 7 2 5 5 2 10 8 7 1 3 5 0 9 5 2 10 4 3 5 8 5 6 2 0 0 9 1 2 1 5 8 7 8 0 0 9 4 4 1 7 4 5 4 0 8 2 6 0 10 0 10 3 5 9 6 3 3 7 8 1 1 8 6 9 6 1 2 0 10 ...
output:
187695354 994097247 613713099
result:
ok 3 number(s): "187695354 994097247 613713099"
Test #55:
score: 0
Accepted
time: 710ms
memory: 12148kb
input:
100000 6 5 4 10 6 1 1 1 5 6 3 7 4 0 5 7 6 3 8 4 8 3 10 1 7 5 6 9 5 7 6 5 2 1 0 8 2 7 2 4 1 10 4 8 9 0 1 10 3 1 4 3 10 3 10 2 4 4 3 8 3 1 9 0 6 5 6 7 6 1 3 9 9 5 7 4 9 7 5 9 9 1 9 8 4 5 3 10 5 1 1 3 1 9 6 6 7 2 7 8 7 5 8 3 1 0 6 9 2 4 6 4 9 4 1 3 6 1 7 2 0 4 0 5 10 1 10 5 3 5 1 7 8 5 2 7 10 6 8 1 1 8...
output:
7143570 87208189 360369968
result:
ok 3 number(s): "7143570 87208189 360369968"
Test #56:
score: 0
Accepted
time: 1227ms
memory: 12248kb
input:
100000 24316637 32811296 7768378 17646267 10821933 130155 30668179 18192971 28623974 22873593 27421767 24454544 1932523 14553042 12185653 12481539 28368503 22356853 25221641 5416419 20505243 31668165 26080230 11056204 30802985 8393268 13124988 15281798 28185090 9242925 28804011 31555985 12224447 267...
output:
54700991 852536543 406909330
result:
ok 3 number(s): "54700991 852536543 406909330"
Test #57:
score: 0
Accepted
time: 1225ms
memory: 12212kb
input:
100000 12579310 12892176 1829773 18688223 25417979 28004709 24707646 28602171 28810531 9729496 22814662 32433276 5402273 10517600 26166325 27785626 30581855 11007396 27549436 32570603 2293701 22325619 5992331 11811136 23784939 8221971 32640058 6140883 9981580 10176382 13045199 324075 27755273 769664...
output:
59674594 349705535 289203619
result:
ok 3 number(s): "59674594 349705535 289203619"
Test #58:
score: 0
Accepted
time: 1230ms
memory: 12788kb
input:
100000 3586316 19938469 27509972 25339609 32949010 19171595 19471562 27470343 15397654 3758329 26718052 7500571 19308243 17450486 21885091 11440026 21996757 28171935 8382430 17159902 14377285 15814079 19345553 21283985 6378460 14533193 15908539 23064585 23718421 28977285 12219458 11126359 22429564 1...
output:
912682225 657321194 331099260
result:
ok 3 number(s): "912682225 657321194 331099260"
Test #59:
score: 0
Accepted
time: 1163ms
memory: 14988kb
input:
100000 17034639 4694757 8986507 7096241 27871002 19830202 12807692 22814968 14133132 945686 25852552 31742621 26048719 2038582 21379769 17152009 27285849 30574813 23825922 28748191 27348116 8982556 29847698 27867548 9236065 30082422 16369352 101015 23058348 11457099 31116968 21480821 32196798 225601...
output:
983568236 145599354 766967539
result:
ok 3 number(s): "983568236 145599354 766967539"
Test #60:
score: 0
Accepted
time: 1189ms
memory: 22032kb
input:
100000 26061451 13790716 13091836 8119071 3131888 8420420 3132306 28947792 30864270 20709700 8899548 107674 15248632 15283587 5634850 18517085 25411777 19868391 33370330 25385497 353284 17253196 4667305 18277185 33426251 25023344 1245149 18620503 22049794 15593292 8621741 28237261 7740201 21072373 4...
output:
496052817 312698200 510633738
result:
ok 3 number(s): "496052817 312698200 510633738"
Test #61:
score: 0
Accepted
time: 1175ms
memory: 15092kb
input:
100000 27052810 30341725 24798329 25343108 23610134 30127706 32068345 26029854 25504277 29245774 28745424 27200477 27325013 28802723 30471209 26374804 32207612 24571572 28585793 33338698 28115200 24133459 26145514 27182777 29127086 29731140 25561226 24824272 32919204 24385216 32880025 24056754 27157...
output:
900558098 592187694 253658409
result:
ok 3 number(s): "900558098 592187694 253658409"
Test #62:
score: 0
Accepted
time: 1181ms
memory: 17528kb
input:
100000 13546456 12929388 4004410 10700369 6737543 6083780 6864863 7662477 8415698 877189 4977638 11196218 13545466 410872 2133014 3769298 1143289 6068434 6218277 2905055 10767681 4148757 350801 1111112 11343695 2044582 6623938 7290330 7506937 6245364 10996487 6750980 6271174 7510868 13114743 9267323...
output:
950234329 217788332 338782615
result:
ok 3 number(s): "950234329 217788332 338782615"
Test #63:
score: 0
Accepted
time: 1232ms
memory: 21124kb
input:
100000 24072740 30374827 15646085 14627145 19038016 14602182 11675864 9402219 8161965 4848948 919718 12094032 32981477 31311907 5034170 8566910 10895956 11415999 8406902 7277343 20828384 22335650 5765987 10460941 15547288 13342584 33301246 13837729 8304820 10623166 8364820 16146919 7378584 26389323 ...
output:
65210246 41216215 969885982
result:
ok 3 number(s): "65210246 41216215 969885982"
Test #64:
score: 0
Accepted
time: 1246ms
memory: 12308kb
input:
100000 22549488 22854487 13152093 31136584 12171815 19456095 26720245 28073852 21925827 17271418 1840797 31174370 24733031 7156704 1345788 7761600 25956180 32160777 22299787 7975723 2711650 10296429 15974037 17827137 21451203 18019144 15650235 16616269 25146065 27759276 17108863 6022367 27466364 992...
output:
914901244 55490711 500711043
result:
ok 3 number(s): "914901244 55490711 500711043"
Test #65:
score: 0
Accepted
time: 1002ms
memory: 12680kb
input:
100000 2622629 18275892 15328410 20046424 11189616 24048582 1042288 21895961 23208356 17711148 29534744 21679481 31552046 33232165 21446387 25365239 6831476 8085542 30108868 14785330 14476396 12219426 12763392 2459354 33410815 10747473 420226 3093666 28489739 32035793 21066012 15565992 10948683 2384...
output:
941849660 618167733 965061205
result:
ok 3 number(s): "941849660 618167733 965061205"
Test #66:
score: 0
Accepted
time: 1043ms
memory: 12688kb
input:
100000 10549920 21747113 6401841 13947875 22456197 5408376 24273158 19573372 12611811 29061099 26557489 10541039 2457640 32403974 25471714 23908059 5761815 25213761 8176658 3937326 12162611 25096273 8957500 2828864 7050056 27106896 20368754 306307 11451494 2288270 30684140 28987416 28492621 26965689...
output:
344652735 671332268 58937926
result:
ok 3 number(s): "344652735 671332268 58937926"
Test #67:
score: 0
Accepted
time: 921ms
memory: 12524kb
input:
100000 22418227 18193393 10344580 26422309 23914876 29719147 6101482 17212664 22114785 7665768 15098500 24346155 15208854 30872947 18959511 26955932 24364123 33134245 6032330 7376455 17242051 15761681 20504108 3938993 11761568 31408829 13330327 18617239 11363200 19477913 12796390 4674102 14791948 30...
output:
797777442 518631263 708170653
result:
ok 3 number(s): "797777442 518631263 708170653"
Test #68:
score: 0
Accepted
time: 893ms
memory: 12488kb
input:
100000 31445167 27281161 14449910 27445267 32738385 18309365 29988462 23345488 5291492 27429653 31708247 26265767 4408767 10571841 3214463 28321137 22489923 22427694 15584930 4021953 23801522 24024257 28869954 27911253 2397194 26357943 31760554 3582551 10354902 23622297 23863786 11430414 23889911 28...
output:
556510486 804987598 264035100
result:
ok 3 number(s): "556510486 804987598 264035100"
Test #69:
score: 0
Accepted
time: 924ms
memory: 12508kb
input:
100000 25889447 9266953 4246031 4134459 5274669 19403906 3779021 6616248 33473055 4680193 3968506 28797860 14380662 1343971 17502075 25886400 7937782 11202034 28746948 5062670 30110578 11947597 20873489 11132666 28120991 17810991 10542840 1570801 15170236 29087977 26225877 22218168 17911412 15551484...
output:
480119882 192969280 285677586
result:
ok 3 number(s): "480119882 192969280 285677586"
Test #70:
score: 0
Accepted
time: 1216ms
memory: 21348kb
input:
100000 27985940 2895373 13581186 28245318 16358746 21794498 23224135 3124819 31956665 6973227 24455771 8714708 6104928 18286822 3956055 15687061 13734536 20567514 29946775 6335447 17670008 5817505 1524352 31368658 16996203 2398321 7546156 30469594 21777469 19581795 31853571 4151247 19008959 13528056...
output:
50987764 803871890 895670750
result:
ok 3 number(s): "50987764 803871890 895670750"
Test #71:
score: 0
Accepted
time: 922ms
memory: 12484kb
input:
100000 29802775 15333737 2181132 17752633 2595399 26596095 15318972 338848 23705132 6804600 27496496 25418408 21058544 21873318 16423959 33006422 10776361 20361614 16732519 4120773 26952330 28983882 16623662 32032191 29561713 6866600 18350373 18202666 28634693 4492047 16160197 10214304 29541659 2698...
output:
596183656 641029336 72173485
result:
ok 3 number(s): "596183656 641029336 72173485"
Test #72:
score: 0
Accepted
time: 655ms
memory: 23672kb
input:
100000 33554430 33554431 33554430 33554431 33554430 33554431 33554431 33554430 33554431 33554430 33554430 33554430 33554430 33554431 33554430 33554431 33554431 33554430 33554430 33554430 33554430 33554431 33554430 33554430 33554431 33554430 33554431 33554431 33554431 33554431 33554431 33554430 33554...
output:
501795575 625032932 203802976
result:
ok 3 number(s): "501795575 625032932 203802976"
Test #73:
score: 0
Accepted
time: 548ms
memory: 12532kb
input:
100000 33554430 33554430 33554431 33554430 33554430 33554431 33554430 33554430 33554431 33554431 33554430 33554430 33554430 33554431 33554431 33554430 33554430 33554430 33554431 33554431 33554430 33554431 33554430 33554430 33554431 33554431 33554431 33554430 33554431 33554431 33554430 33554430 33554...
output:
896369334 211540264 568135009
result:
ok 3 number(s): "896369334 211540264 568135009"
Test #74:
score: 0
Accepted
time: 1073ms
memory: 14196kb
input:
100000 8550598 8533480 8675647 8642172 8698582 8581718 8651209 8521456 8617273 8542962 8651903 8673480 8654418 8663575 8550111 8513279 8641189 8517647 8523099 8694729 8631275 8569875 8661868 8510818 8540696 8690808 8647618 8605760 8551756 8674721 8580647 8578514 8689308 8581414 8563094 8660885 86282...
output:
441700583 253049058 683664459
result:
ok 3 number(s): "441700583 253049058 683664459"
Test #75:
score: 0
Accepted
time: 892ms
memory: 12584kb
input:
100000 8563913 8615952 8607479 8588226 8677129 8501992 8544238 8571447 8521992 8575888 8577722 8681157 8583498 8662408 8512989 8605981 8562440 8646895 8542602 8537582 8525058 8599754 8622284 8542223 8627721 8557434 8577973 8651557 8644851 8586695 8505766 8570230 8634912 8587484 8625970 8542465 86174...
output:
181984273 383164391 749963257
result:
ok 3 number(s): "181984273 383164391 749963257"
Test #76:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
1 2542257
output:
436712727 436712727 436712727
result:
ok 3 number(s): "436712727 436712727 436712727"