QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#637146 | #8769. Champernowne Substring | nhuang685 | WA | 659ms | 3868kb | C++23 | 10.4kb | 2024-10-13 10:11:00 | 2024-10-13 10:11:01 |
Judging History
answer
/**
* @author n685
* @brief
* @date 2024-10-12 11:22:13
*
*
*/
#include "bits/stdc++.h"
#ifdef LOCAL
#include "dd/debug.h"
#else
#define dbg(...) 42
#define dbg_proj(...) 420
#define dbg_rproj(...) 420420
void nline() {}
void bar() {}
void start_clock() {}
void end_clock() {}
#endif
using i128 = __int128_t;
template <class T> constexpr T INF = T{};
template <> constexpr int INF<int> = 0x3f3f3f3f; // 1061109567
template <> constexpr int64_t INF<int64_t> = 0x3f3f3f3f3f3f3f3f; // 4557430888798830399
template <>
constexpr i128 INF<i128>
= i128{INF<int64_t>} << 64 | INF<int64_t>; // 84069761239290679208598432424319205183
constexpr int MOD = 998'244'353;
constexpr int MXLG = 25;
constexpr std::array<i128, MXLG + 1> p10 = []() {
std::array<i128, MXLG + 1> ans{};
ans[0] = 1;
for (int i = 1; i <= MXLG; ++i) {
ans[i] = ans[i - 1] * 10;
}
return ans;
}();
int log10(i128 val) {
for (int i = 0; i <= MXLG; ++i) {
if (val < p10[i]) {
return i - 1;
}
}
return MXLG;
}
i128 pos(i128 val) {
int lg = log10(val);
i128 ans = 0;
for (int i = lg; i >= 0; --i) {
ans += (i + 1) * (val - p10[i] + 1);
val = p10[i] - 1;
}
return ans;
}
std::string to_string(i128 val) {
if (val <= std::numeric_limits<uint64_t>::max()) {
return std::to_string(static_cast<uint64_t>(val));
}
std::string ans;
while (val > 0) {
ans += static_cast<char>('0' + val % 10);
val /= 10;
}
std::reverse(ans.begin(), ans.end());
return ans;
}
i128 stoi128(const std::string& s) {
i128 ans = 0;
for (char c : s) {
assert(c != '?');
ans = 10 * ans + (c - '0');
}
return ans;
}
bool match(const std::string& s, const std::string& ls) {
int n = static_cast<int>(s.size());
for (int i = 0; i < n; ++i) {
if (s[i] != '?' && ls[i] != '?' && s[i] != ls[i]) {
return false;
}
}
return true;
}
constexpr int MX = 100000;
void solve() {
std::string s;
std::cin >> s;
int n = static_cast<int>(s.size());
i128 ans = INF<i128>;
// starts from 1..10^5
for (i128 i = 1; i <= MX; ++i) {
int lg = log10(i);
for (int st = -lg; st <= 0; ++st) {
std::string ls;
for (i128 val = i; static_cast<int>(ls.size()) + st < n; ++val) {
ls += to_string(val);
}
if (match(s, ls.substr(-st))) {
ans = std::min(ans, pos(i - 1) + 1 - st);
}
}
}
// includes power of 10
for (int lg = 5; lg <= MXLG; ++lg) {
for (int p = -lg; p < n; ++p) {
int st = p;
i128 fi = p10[lg];
while (st > 0) {
st -= lg;
--fi;
}
std::string ls;
for (i128 val = fi; static_cast<int>(ls.size()) + st < n; ++val) {
ls += to_string(val);
}
if (match(s, ls.substr(-st))) {
ans = std::min(ans, pos(fi - 1) + 1 - st);
}
}
}
// one number
{
std::string ls = s;
for (int i = 1; i < static_cast<int>(ls.size()); ++i) {
if (ls[i] == '?') {
ls[i] = '0';
}
}
int off = 0;
if (ls[0] == '0') {
++off;
ls.insert(ls.begin(), '1');
} else if (ls[0] == '?') {
ls[0] = '1';
}
ans = std::min(ans, pos(stoi128(ls) - 1) + off + 1);
}
// no carry
for (int lg = 5; lg <= MXLG; ++lg) {
int wi = lg + 1;
for (int pl = 0; pl < wi; ++pl) {
int pr = (wi - (n + pl) % wi) % wi;
int sz = n + pr;
std::string ss = std::string(pl, '?') + s + std::string(pr, '?');
std::string ls(wi, '?');
bool g = true;
for (int i = 0; i < sz; i += wi) {
for (int j = 0; j < wi; ++j) {
if (ss[i + j] == '?') {
continue;
}
if (j == wi - 1) {
int dv = ss[i + j] - '0';
if (dv < i / wi || (ls[j] != '?' && ls[j] - '0' != dv - i / wi)
|| dv + (sz - i) / wi - 1 >= 10)
{
g = false;
break;
}
ls[j] = static_cast<char>(dv - i / wi + '0');
} else {
int dv = ss[i + j] - '0';
if ((j == 0 && dv == 0) || (ls[j] != '?' && ls[j] != ss[i + j])) {
g = false;
break;
}
ls[j] = ss[i + j];
}
}
}
if (g && ls[0] != '0') {
if (ls[0] == '?') {
ls[0] = '1';
}
for (int i = 1; i < wi; ++i) {
if (ls[i] == '?') {
ls[i] = '0';
}
}
ans = std::min(ans, pos(stoi128(ls) - 1) + pl + 1);
}
}
}
// carry
for (int lg = 5; lg <= MXLG; ++lg) {
int wi = lg + 1;
for (int pl = 0; pl < wi; ++pl) {
int pr = (wi - (n + pl) % wi) % wi;
int sz = n + pr;
std::string ss = std::string(pl, '?') + s + std::string(pr, '?');
for (int cpos = wi; cpos < sz; cpos += wi) {
for (int cw = 1; cw < wi; ++cw) {
std::string ls(wi, '?');
ls[wi - 1] = static_cast<char>(10 - cpos / wi + '0');
for (int i = wi - cw; i < wi - 1; ++i) {
ls[i] = '9';
}
bool g = true;
for (int i = 0; i < cpos; i += wi) {
for (int j = 0; j < wi; ++j) {
if (ss[i + j] == '?') {
continue;
}
if (j == wi - 1) {
int dv = ss[i + j] - '0';
if (dv < i / wi || (ls[j] != '?' && ls[j] - '0' != dv - i / wi)) {
g = false;
break;
}
ls[j] = static_cast<char>(dv - i / wi + '0');
} else {
int dv = ss[i + j] - '0';
if (j >= wi - cw && dv != 9) {
g = false;
break;
}
if (j == wi - cw - 1 && dv == 9) {
g = false;
break;
}
if ((j == 0 && dv == 0) || (ls[j] != '?' && ls[j] != ss[i + j])) {
g = false;
break;
}
ls[j] = ss[i + j];
}
}
}
if (!g) {
continue;
}
for (int i = cpos; i < sz; i += wi) {
for (int j = 0; j < wi; ++j) {
if (ss[i + j] == '?') {
continue;
}
if (j == wi - 1) {
int dv = ss[i + j] - '0';
int od = dv - i / wi + 10;
if (ls[j] - '0' != od) {
g = false;
break;
}
ls[j] = static_cast<char>(od + '0');
} else {
int dv = ss[i + j] - '0';
if (j >= wi - cw) {
if (dv != 0) {
g = false;
break;
}
dv = 9;
} else if (j == wi - cw - 1) {
if (dv == 0) {
g = false;
break;
}
--dv;
}
if ((j == 0 && dv == 0) || (ls[j] != '?' && ls[j] != dv + '0')) {
g = false;
break;
}
ls[j] = static_cast<char>(dv + '0');
}
}
}
if (g && ls[0] != '0') {
if (ls[0] == '?') {
ls[0] = '1';
}
for (int i = 1; i < wi - cw; ++i) {
if (ls[i] == '?') {
ls[i] = '0';
}
}
ans = std::min(ans, pos(stoi128(ls) - 1) + pl + 1);
}
}
}
}
}
dbg(to_string(ans));
#ifdef LOCAL
i128 l = 1, r = static_cast<i128>(2e25);
while (l < r) {
i128 mid = l + (r - l) / 2;
if (pos(mid) + 1 >= ans) {
r = mid;
} else {
l = mid + 1;
}
}
dbg(to_string(l));
#endif
std::cout << static_cast<int>(ans % MOD) << '\n';
}
int main() {
#ifndef LOCAL
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
#endif
int t;
std::cin >> t;
for (int i = 0; i < t; ++i) {
dbg(i + 1);
solve();
bar();
}
}
详细
Test #1:
score: 100
Accepted
time: 289ms
memory: 3864kb
input:
9 0 ???1 121 1?1?1 ??5?54?50?5?505?65?5 000000000000 ?2222222 ?3????????9??8???????1??0 9?9??0????????????2
output:
11 7 14 10 314159 796889014 7777 8058869 38886
result:
ok 9 lines
Test #2:
score: 0
Accepted
time: 629ms
memory: 3520kb
input:
10 0000000000000000000000000 0000000?002100000000000?0 6999?999?999999989?999999 0???0?1000?0??000?????0?1 9??9?999998?9?999999100?0 96?9997999?8999991????010 99?99??999999999??????99? ?0?0000?00000000?0210?0?0 99?999?999?99?9??999?9?9? 9?????9?99?99??9??99??9??
output:
545305036 574985081 788888865 5889591 902934046 488873 902034054 830780534 68888820 5882870
result:
ok 10 lines
Test #3:
score: 0
Accepted
time: 623ms
memory: 3636kb
input:
10 23573?0208935200503593500 08?9?1188980?661?18161467 22000103111010?24490??02? 4?129184?3644311331226625 9014217281609919609168?18 27809?1808?34646796569990 5116137658333853138917519 8778798398090800698?93888 742?9472125?9529272277272 5260238541343?22235629222
output:
108802929 797951281 758593545 919282423 660254768 34219412 452740345 687192108 692870314 277899385
result:
ok 10 lines
Test #4:
score: 0
Accepted
time: 635ms
memory: 3572kb
input:
10 98898918898?0109088100808 ???08?9???1??????88?????? 8?1???????0118????00???8? ??1880????1?8???111101108 ???????11??1????0???000?? ?9?01???0????9????8???9?? ???1?1?????1????90?0????0 ??8?????????18?9????????? 8????91?8???????????????9 ??0????1?????9??8?909???0
output:
397005130 796170672 681417627 201652995 493829373 76730467 798698896 6434 43334 443792
result:
ok 10 lines
Test #5:
score: 0
Accepted
time: 627ms
memory: 3568kb
input:
10 012003??1?0?591??0?30?30? 1000?0?1100000?731?101211 ?0?11?80101111?1??1328??? 411410110174?154311111111 20005??141101015?0?1?0??1 5??81010????10???237300?0 ?3605?3611014?09?446?6313 1110015171261071000007001 991?11162011?0191117?0410 ?200500??003??60??01900?2
output:
900307781 839110958 981675858 995851013 389598828 122551361 79267861 295093505 388362258 286706944
result:
ok 10 lines
Test #6:
score: 0
Accepted
time: 626ms
memory: 3868kb
input:
10 ?150?7??2???902??0?80?70? 1??????11??????001?1?1017 ???12???1?5111?1??3?0???? 61165?11?196?376621133111 0???0??1041?5?20???1????1 0???3?2?????1????70?0???? ?7????7?11?48????98???747 1420?2717247207100?0?8??1 001?13185031??301119??71? ?5??0??????7??0????10???5
output:
864484608 74700832 681727245 536368659 226329329 975189011 448648057 967696005 376743109 173528449
result:
ok 10 lines
Test #7:
score: 0
Accepted
time: 418ms
memory: 3576kb
input:
10 2??0?0??4??3 ??0?64?5???1???? ??????????01???0017???0 1147???1?1? 07?060????0?? 0706457?760130 ??4????3???4? 199?0?19?0?2262880 3675036117 032?????8?0??00??
output:
6099056 69020130 488979 68978070 41928 657141248 909 87550531 643195723 982967061
result:
ok 10 lines
Test #8:
score: 0
Accepted
time: 623ms
memory: 3636kb
input:
10 1004024914000141171664179 4112700045099296212010057 2000700072177165003008355 5147124088080418420102215 0111131163261117111189161 0000000507001000083001045 4616130013212189231581163 6370033693059001070063068 2600011505817800101005111 8171898166180081571808187
output:
492541635 485994730 881341707 302237585 319228799 682761479 494203217 307458184 948671187 770194561
result:
ok 10 lines
Test #9:
score: 0
Accepted
time: 466ms
memory: 3572kb
input:
10 9999??1?24109 9961?9?99?9?17??9?9981?9 ?55139?310? 01060999911010?100001 ????1???0???0 1999?9?9??1?1?99 ?6?098?????0?91?06? ??9?9?9920 1009??99?9?83011009 ?08815?9?290?6??8159992?
output:
701914982 502544507 838514018 198720051 210 1088344 69369676 88485 208314295 325404847
result:
ok 10 lines
Test #10:
score: 0
Accepted
time: 628ms
memory: 3800kb
input:
10 ???9?9????9??1????0?00?0? ?19??5?6705?2006?7?705420 ?8?99??9?10????00?000???? 26??9???8??1862?9?99???1? ?1?811????119911?1801?0?1 99?0?7?400?????0?7???0??0 9981?80?15??9?99??9??8?2? 87??9787249?8724?98725008 ?1???1??7??9?????7??9???? 529999810002?2999991000??
output:
488877 578261397 68888881 922387376 922701699 750962293 869492708 5123872 795205985 107899748
result:
ok 10 lines
Test #11:
score: 0
Accepted
time: 632ms
memory: 3632kb
input:
10 ?????????????0??0?0?0??0? ?7??1???99???991?070??000 30???7??????8???1??????1? ??45??9?99?9??50????0?09? ?6???0?????9????6?6???0?0 1?????71??811??12?0?2???? ?0???0???0???0??0?0?????0 1????999?8???1?8??0?0?088 0??3?000?81?0?030??0181?0 ????9?9??99??0??0?81???00
output:
38878 974988866 7995940 207215288 789434908 3675 2915 656463525 46595272 162777032
result:
ok 10 lines
Test #12:
score: 0
Accepted
time: 639ms
memory: 3640kb
input:
10 ???????2?6?9?99????9??6?? ?9?9??6???9?9??2????0?6?? ?13?11?1????7?1??????1?99 ??9???9011??00?999?9??1?? 0?0?1??0?2?00????1??110?2 ?6?301?1818??9??????11??? ?1????8?????99??2???????2 ?9?????4????9?9??73?49??? ???9?7????98??9?????????? ?96??9?7?????????99????9?
output:
785875062 118488877 347574749 926770730 39160338 299823179 6742876 217198712 548872 438872
result:
ok 10 lines
Test #13:
score: 0
Accepted
time: 631ms
memory: 3572kb
input:
10 ???97??0?99???07?99?00800 ?99??3?04??9??310??000?3? 2????1?1?????001???1??632 ??1???????????39?????9??? 0???5?60?9???????9?2????0 9??99?9?93?191???9??99993 9733?98???993?1?03?101331 9??07?30000207?3?0?1?0703 ?9?86?00?00086??0?00????0 ????1?99??181?9????8??00?
output:
5944871 70013524 400601421 40868 35709572 642051114 154378 753914535 641178416 83376873
result:
ok 10 lines
Test #14:
score: 0
Accepted
time: 630ms
memory: 3616kb
input:
10 9?20?0???0???00???01?0??0 9?9?1?9???19??97????????? ??9????1?1??00?0??1?9???? 9??6168??9?9?9??6?9??998? 9??963702???9?9?9?9???0?? 9?????????9?9??8?9???9?9? ?07????0??0?????0????0??? 9???9????1???9?99?9???1?9 5?8??99???????89??999?9?7 ????9?74???9?9???????????
output:
690644535 1083462 798698973 995370331 446157661 5882928 530890 148240876 882732928 69688682
result:
ok 10 lines
Test #15:
score: 0
Accepted
time: 638ms
memory: 3516kb
input:
10 9??9?53??000?3?0?????0?0? ?8???9??72???9????28??9?? 999?9180?0??????????0???? 9?99???00??0?0?????0????? 9?????9??000?????0????00? ?999???99?0?????0???????? ?????0?0??5?80???00?????? 9??????????????5?9??9??9? ?????9?????8?9?999??????0 ???????61??9?9????9??????
output:
35988885 854409694 510644532 488886 488882 38881 789346093 1059429 438873 5952561
result:
ok 10 lines
Test #16:
score: 0
Accepted
time: 659ms
memory: 3800kb
input:
10 ?199???9??5?999??9965?9?9 ????0??????9??5?????????? ??????????0?0?00??1????0? 7????9?1?????0??????????? ???????0???????????60???? ????9??????0??9????4????? ????????????????????????? ????0??20?0??????????0??? ????0???????????????????? ????999??999??????????0?2
output:
885690430 167 488883 2883 39174 782884 1 88923 7 148888874
result:
ok 10 lines
Test #17:
score: 0
Accepted
time: 627ms
memory: 3836kb
input:
10 ?86399?86??99864000864?01 ????998??99??0?5???5?02?? 769999??9?999???????0???? ??89?6?8?8???99?1?0???9?? ??9??71?2099?9?8?32?99999 9?99853?99?999?400000?05? 9??????9??99?9??10??00??0 07908???????11?129?3?14?? 976?9???9?6?006?0?????63? ??76?????9?9???????9???6?
output:
5072877 18879 4088877 298375 119956628 755911464 5888874 2612 24080 334377
result:
ok 10 lines
Test #18:
score: 0
Accepted
time: 636ms
memory: 3632kb
input:
10 ?529???2987??9?753?075?01 72?9???29??9??0?0??30??01 9984?99999??200?00?42?00? 9???????999???1????????1? 9?9?869?99?999?0????00070 7?5989599?60?960196?296?3 ??418??1894190??91419??19 ??????????999????99??9??? 99?9989759999?99??0?0?00? ?????????8????9???9?????1
output:
365375 1688877 324888879 68976879 199422758 37281 15640 2849 686934051 6438
result:
ok 10 lines
Test #19:
score: 0
Accepted
time: 627ms
memory: 3864kb
input:
10 79?95?9?969??99?6??0009?9 7?9??9?8?999?9?900???0?0? ??6??6?86?7699??7700?7?7? ????8?0?99?92??0?0?????0? 99?99?8499?9??995?????0?0 7???82?3?21?????1?14???4? 7??879?081?28?8?8??6?78?? 9?99999?9?3?00?000?30000? 1?9?1998199920?0?00?2?0?2 ?4???84???????????????1??
output:
66760875 61888875 3955076 12958878 395911462 7441 144 272934057 6878 2423
result:
ok 10 lines
Test #20:
score: 0
Accepted
time: 631ms
memory: 3572kb
input:
10 87??9?88?1999??72000?87?? ?0???5?998????9?1?????0?? ??99719?99????9?9?920?0?? ??9??82?9999??3?000????00 ??????????100??1?00???0?? ?74918?91?4?2??9?1??2249? 77????9?????????8??????0? 75???????2?99???????5?4?? 9???9?9?9?9?0?9?0?9?0??5? 8?7999??938000000?800??01
output:
59928876 243875 1040873 14988877 38880 18560 2283 3203277 36880 292888881
result:
ok 10 lines
Test #21:
score: 0
Accepted
time: 638ms
memory: 3644kb
input:
10 10?9?9?8?10??9??9??1000?0 ???7?3??99???9986?4???99? ?9?4???????????9???????04 ??????9??????7????0???0?? ??1??4?????419?4?2004?2?1 999???7??9?9???000??80000 ???9???4??????0???40??0?0 ?5?????5??????????7????4? ????8?????????0??000???0? ??????7??????????9?????0?
output:
887888873 275445479 5952172 5678 209875 11488878 72092077 1515 488880 6790
result:
ok 10 lines
Test #22:
score: 0
Accepted
time: 625ms
memory: 3616kb
input:
10 9?7?9?8?9891???1????9???9 7?1?9?8914??9915?0????0?1 ????19?????????2??3?0???? ?9?99729?????9?99930?0?03 9?9???64????99??8?6??9?9? ?9?7?41????4?199?9?42?0?? 15?99997???99??????99999? 0999?7??099??8?7??9?9???? 7689999??97?768??99??9??? 39??9??9?4??00?000400?000
output:
6839 5378877 483 1688872 248146848 29828872 109688866 125688868 226398760 494155822
result:
ok 10 lines
Test #23:
score: 0
Accepted
time: 631ms
memory: 3668kb
input:
10 399?972?999?82?999?924000 ?4???9??99?87485???9????? ??2????9?99?98?56??9??999 99998?7?999?9995800000?00 ?68???0?17???7??????7???? ?????7???????3?????3????? 4974??4?95005??50?503??4? ????79??0?80??0?8??????0? 4????9????9999?????9?999? ?????99???8?99??926???00?
output:
15688870 470575554 195644357 987205107 125 268 1381 2283 148888849 305300167
result:
ok 10 lines
Test #24:
score: 0
Accepted
time: 629ms
memory: 3576kb
input:
10 ??98?9??0???130?????04??? 713999998139999991?0?00?0 97?691?99866919?99???20?? 9?79?99?8??9?99910?009100 3?99?7?9999839?99?4?0000? ?756856???05715?2??35??5? 65?9?9?9?8??00???038660?0 ????9??????99?9?????009?? 973?899?3???99?7?00037900 ??8??9999??9?9999?99???0?
output:
783 100888873 524248872 5348875 2288872 1592 613847821 5883474 2162876 820490516
result:
ok 10 lines
Test #25:
score: 0
Accepted
time: 632ms
memory: 3868kb
input:
10 ??7?9?99?699????000007000 ???9?????9??9???????????? ?99???99????000??0?0?000? ?4????4?9???9??4??0?4???? ??1????????2????0???0?027 ????????????91??????100?? 99999?25299?99?252999??92 79999779999??9?99?8??0?0? ??82???9999??0???0??0?0?0 ?????63?9??9??90????????0
output:
4088875 177 5888879 213380 802547346 489428 169400160 4688872 228888879 6563611
result:
ok 10 lines
Test #26:
score: 0
Accepted
time: 626ms
memory: 3832kb
input:
10 999?9?73????9??8??9?9??99 99?9746?9??9984?4999?9??6 ??9??9?96????00??0?6?5??? 79??7?99987?99980?0??0?0? ??997?99??9??9999?9??0?00 ?349??234???????99?3??002 ?986999999?70??00?0700??? 99?9999?300???0???00???0? ???8?0??9???????4??00???3 7?646988646998?4700864?01
output:
682400159 80911455 53005937 388875 12888871 1298872 548888879 60644530 2306880 5077077
result:
ok 10 lines
Test #27:
score: 0
Accepted
time: 628ms
memory: 3636kb
input:
10 78??0?11?13141?161718192? ?72??9?0???23?343536?7383 ??3?7??????0399604?0?0401 ???8699??0701?0?703704705 7???83?1?9???321???0032?? 99?????9?999?8000?0?780?0 39?9739??839999???0?4?00? ?7?99???9?87?9?????9971?? ???3?????99????40??4??2?0 9??9??9?9????????????????
output:
7 44 290875 1983 246321677 612888878 188875 11784159 14879 2582
result:
ok 10 lines
Test #28:
score: 0
Accepted
time: 628ms
memory: 3632kb
input:
10 ??9?9997786??99??878?1999 999?9?9991?00??00???0000? ??7??6???9820?999??2?7?0? 4??4??49??0?5??5????3??35 22?99999?9972220???0000?? ??9?9?97??9?9998???????92 7299??9998?9999?999300??0 9999?9?7??99999?9?21?00?0 ????9??????91????0??009?2 51?97519?8519995?0??5?0??
output:
644073681 902934057 154488871 932 334783669 148888866 592400165 113539810 63701138 248875
result:
ok 10 lines
Test #29:
score: 0
Accepted
time: 626ms
memory: 3576kb
input:
10 ?9?8????8????????0906??9? 1?7?187???7??0?7???72?7?? ?09???????3?9?????00?1??? 9?9?9???6????0?016??00??1 9?49?????4??9?????????0?? 35?????02?35029??0??3?03? 5?9998?5799999?8??009580? 7?198??998?0?8?018?0?8203 ?9869??99???????0?????9?? 7?59????9?60?76????0???0?
output:
334325 29760 143875 330644530 12223247 164025 65948877 31681 541608879 29281
result:
ok 10 lines
Test #30:
score: 0
Accepted
time: 633ms
memory: 3804kb
input:
10 ?????97?7?9?9?7???99???60 ????9??9?????????8??99??? 5999??????9?9???????9?9?9 ??1??9??9????0??????8???? ???85?88569?5??8??185728? ?9??999??9?9?00???????100 999?9425??0?0004??00?0?0? 9?87779999?997780000000?7 ?9??8?3?9???????8???????? 9?9???????9????????02?0??
output:
53208869 2569 40882569 75288880 33159 38878 460870412 822318049 971281 178
result:
ok 10 lines
Test #31:
score: 0
Accepted
time: 635ms
memory: 3524kb
input:
10 ?7837?8?????8?8????38?838 98??1??9??9?1?1????????1? ?28???0???2?3343?36????39 39?9?????400?0??0?4???00? ???2?59?9?8??59???82??00? 4497??9???9945?045??4???4 ?99?99?7??0??0?0????0?0?? ??5?859?????1??28??8648?? ???99?????99????????003?? 5659?565?856599?66?05?60?
output:
32400 780096962 45 150644529 645368872 16878 62378885 2463 12818895 271875
result:
ok 10 lines
Test #32:
score: 0
Accepted
time: 632ms
memory: 3804kb
input:
10 9999??6????9?9??7?0??0??? ??7????????4?9?3????0???? 489?974?999848??99?????04 999998119?99?999120?00?0? ??997?9?99?98392?9?9?3?30 12?9?9412??99413000?413?0 979?999?99999910??0?010?0 77787?8???828?84?58?8?888 ?9??1????9?8??9999992?00? ???????7???99?9???8?1?9?9
output:
393644523 1713475 2828872 906445344 303288869 64779878 5888876 144 148888870 897346131
result:
ok 10 lines
Test #33:
score: 0
Accepted
time: 632ms
memory: 3572kb
input:
10 97??9???98???9?9?9??00??0 ??9???????8??8??????????? ?4????4??8???9???9?0??9?? 37???37???37???3??0?3???1 ??753?999?53???9954??0?0? 2??28????3????2?2??????2? 1??9?521?99???15000?2???0 9986?4999?999??50??000062 ?????2???2???290?2?0???03 2??7??9???9??500?5??2????
output:
76888872 427 63375 57426 36688873 572 35393878 495983344 10481 8878
result:
ok 10 lines
Test #34:
score: 0
Accepted
time: 628ms
memory: 3640kb
input:
10 9?99??99?99????000?????0? 26?999999???99999?9?27?00 ?????????845??????30?0??? 3?9?9?86?099??9631?000063 9?98?3729?99?3730?0?437?0 ?6?8??97???017??7037????? 7??697?7?7273?47??6777?7? ????9????????????????9??? ?64??664??6?42?66???6???? 99999986?99?999?9??0??000
output:
5888878 932780045 2606874 493688875 338728878 1983 125 165 72091 992472046
result:
ok 10 lines
Test #35:
score: 0
Accepted
time: 633ms
memory: 3576kb
input:
10 ????????6??????????6?7??? 6?99?8?9??88??9??8?000??? ???9?95??????0?0590???00? 7?????????????????780?057 9?72?8?98?289?9??90??22?? 4?????4??8??39?4?4?0???01 ??75???98????9?????00600? 8315783?5?8315?831??8??6? ?9999??9999998?99?999910? ???4??9??4?99?94?0000?900
output:
104 5108873 988960763 523555 1262875 210875 3488875 404675 788888868 2828875
result:
ok 10 lines
Test #36:
score: 0
Accepted
time: 629ms
memory: 3800kb
input:
10 ??99???9?????10?0???1???? ?????????10?????1???2?0?? 86941??99?9??42?00000?9?2 790?90991?91191?9139??9?? ????0???940?1??????6????1 78???9??8808499???085?000 ?39?3?9?0???14?24???0??0? 999?9??4???9?9998?4???99? 739?399?004014?2?03404405 ?38?999?99?239?00?00?8?39
output:
5888877 2881 428272875 2613 905290 635688873 1083 920488967 1083 751948592
result:
ok 10 lines
Test #37:
score: 0
Accepted
time: 628ms
memory: 3668kb
input:
10 ?????9?8?9?999?70????87?? ???????8??9???8??99??9??0 3?3839?041?24???4?46?74?? ?5?9????59???55??0??59??? 763??9?99?7?63???9?998?63 ?9???8099??80?9??8?00???1 9???99?????????????0??0?0 ?99?98?5?999999758???0007 9??1?9???1?999120000?2??0 ?99?99??8?3739?99??99??74
output:
12887970 5222871 64 824338 655320220 974874 38874 721422757 608876 392585249
result:
ok 10 lines
Test #38:
score: 0
Accepted
time: 627ms
memory: 3632kb
input:
10 ?9799999?9??99910000??10? ???2?33?9?33033???3?????? 9739999?8?9?999940?000?40 ?????73??8??4???3?0????0? 9?????9???????????00????? 97?99???3??9994??000?0??0 ?60?8??69?0?06?716072607? 2?9972???8299?9??00030001 3????9???1???????5??4???? ?976???69??7?0?7??1?????0
output:
5888875 12201 26888874 159324 473 2288876 23161 138875 64 26879
result:
ok 10 lines
Test #39:
score: 0
Accepted
time: 633ms
memory: 3576kb
input:
10 ?1?99?9999????0??00200?00 ?99?735999983599?993600?? ?9999999?9??????00?9200?? ?7??1898?0189?7??90?7?190 597?9?5996?06?1?02?03?04? 3??7?6??3???3??0369???92? ?8?4???999?9??0??00???5?? ?2?9?982????????00??30?0? 9?9?9978?000?00??8?0000?0 ?????????????????4472?4??
output:
690644527 24088871 120490528 4100276 1681 13638 951678409 1268877 24073703 8662
result:
ok 10 lines
Test #40:
score: 0
Accepted
time: 625ms
memory: 3524kb
input:
10 ?????6??16????4?????7???9 99?99?4???00?00?40?000?0? 7?2??98????9?2?09??2?09?? 9?9997?229999??8????999?? ????????98?????94????400? 835399?999?5?000?00?5?0?0 7????10?1??10???310??05?? ?799?7?99?0?080??8??28003 ?999?819?999992??0??????0 ??9??9?6??99?9966???00?66
output:
105 909956649 1214277 960644332 458875 80155821 185 30881 148888876 516888875
result:
ok 10 lines
Test #41:
score: 0
Accepted
time: 631ms
memory: 3624kb
input:
10 19??001?8?0??????02?0??0? 7????99?8??9??999?0???00? ??745??0??????????0?????? ???9??9???998???99??9???0 ??60???6087?6097??1??561? ???9?99??98???9?99?????0? ?9999998?3999?99????000?? 09??6?099?60?9?9601???601 82999????????????9?9??3?0 ?899?999?7?8999999984?99?
output:
490075 76168873 493361 61958870 366925 148168726 150644520 3494874 11698870 971404269
result:
ok 10 lines
Test #42:
score: -100
Wrong Answer
time: 192ms
memory: 3644kb
input:
3 ?????7???8?9???88???????0 ?????8??81??????0?????0?? 43??3?????8??????5?????64
output:
6505570 83876 631294040
result:
wrong answer 1st lines differ - expected: '6511870', found: '6505570'