QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#427832 | #8769. Champernowne Substring | ucup-team087# | AC ✓ | 12ms | 4072kb | C++20 | 25.5kb | 2024-06-01 16:06:32 | 2024-06-01 16:06:32 |
Judging History
answer
#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
// https://codeforces.com/blog/entry/96344
#pragma GCC optimize("Ofast,unroll-loops")
// いまの CF だとこれ入れると動かない?
// #pragma GCC target("avx2,popcnt")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;
template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'000'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;
using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
#define vv(type, name, h, ...) \
vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) \
vector<vector<vector<type>>> name( \
h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...) \
vector<vector<vector<vector<type>>>> name( \
a, vector<vector<vector<type>>>( \
b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)
#define FOR_subset(t, s) \
for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define stoi stoll
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
int popcnt_mod_2(int x) { return __builtin_parity(x); }
int popcnt_mod_2(u32 x) { return __builtin_parity(x); }
int popcnt_mod_2(ll x) { return __builtin_parityll(x); }
int popcnt_mod_2(u64 x) { return __builtin_parityll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
template <typename T>
T floor(T a, T b) {
return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
T q = floor(x, y);
return {q, x - q * y};
}
template <typename T, typename U>
T SUM(const vector<U> &A) {
T sm = 0;
for (auto &&a: A) sm += a;
return sm;
}
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) \
sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()
template <typename T>
T POP(deque<T> &que) {
T a = que.front();
que.pop_front();
return a;
}
template <typename T>
T POP(pq<T> &que) {
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(pqg<T> &que) {
T a = que.top();
que.pop();
return a;
}
template <typename T>
T POP(vc<T> &que) {
T a = que.back();
que.pop_back();
return a;
}
template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
if (check_ok) assert(check(ok));
while (abs(ok - ng) > 1) {
auto x = (ng + ok) / 2;
(check(x) ? ok : ng) = x;
}
return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
FOR(iter) {
double x = (ok + ng) / 2;
(check(x) ? ok : ng) = x;
}
return (ok + ng) / 2;
}
template <class T, class S>
inline bool chmax(T &a, const S &b) {
return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
return (a > b ? a = b, 1 : 0);
}
// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
vc<int> A(S.size());
FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
return A;
}
template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
int N = A.size();
vector<T> B(N + 1);
FOR(i, N) { B[i + 1] = B[i] + A[i]; }
if (off == 0) B.erase(B.begin());
return B;
}
// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
vector<int> ids(len(A));
iota(all(ids), 0);
sort(all(ids),
[&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
return ids;
}
// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
vc<T> B(len(I));
FOR(i, len(I)) B[i] = A[I[i]];
return B;
}
#endif
#line 1 "library/other/io.hpp"
#define FASTIO
#include <unistd.h>
// https://judge.yosupo.jp/submission/21623
namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf
uint32_t pil = 0, pir = 0, por = 0;
struct Pre {
char num[10000][4];
constexpr Pre() : num() {
for (int i = 0; i < 10000; i++) {
int n = i;
for (int j = 3; j >= 0; j--) {
num[i][j] = n % 10 | '0';
n /= 10;
}
}
}
} constexpr pre;
inline void load() {
memcpy(ibuf, ibuf + pil, pir - pil);
pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
pil = 0;
if (pir < SZ) ibuf[pir++] = '\n';
}
inline void flush() {
fwrite(obuf, 1, por, stdout);
por = 0;
}
void rd(char &c) {
do {
if (pil + 1 > pir) load();
c = ibuf[pil++];
} while (isspace(c));
}
void rd(string &x) {
x.clear();
char c;
do {
if (pil + 1 > pir) load();
c = ibuf[pil++];
} while (isspace(c));
do {
x += c;
if (pil == pir) load();
c = ibuf[pil++];
} while (!isspace(c));
}
template <typename T>
void rd_real(T &x) {
string s;
rd(s);
x = stod(s);
}
template <typename T>
void rd_integer(T &x) {
if (pil + 100 > pir) load();
char c;
do
c = ibuf[pil++];
while (c < '-');
bool minus = 0;
if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
if (c == '-') { minus = 1, c = ibuf[pil++]; }
}
x = 0;
while ('0' <= c) { x = x * 10 + (c & 15), c = ibuf[pil++]; }
if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
if (minus) x = -x;
}
}
void rd(int &x) { rd_integer(x); }
void rd(ll &x) { rd_integer(x); }
void rd(i128 &x) { rd_integer(x); }
void rd(u32 &x) { rd_integer(x); }
void rd(u64 &x) { rd_integer(x); }
void rd(u128 &x) { rd_integer(x); }
void rd(double &x) { rd_real(x); }
void rd(long double &x) { rd_real(x); }
void rd(f128 &x) { rd_real(x); }
template <class T, class U>
void rd(pair<T, U> &p) {
return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T>
void rd_tuple(T &t) {
if constexpr (N < std::tuple_size<T>::value) {
auto &x = std::get<N>(t);
rd(x);
rd_tuple<N + 1>(t);
}
}
template <class... T>
void rd(tuple<T...> &tpl) {
rd_tuple(tpl);
}
template <size_t N = 0, typename T>
void rd(array<T, N> &x) {
for (auto &d: x) rd(d);
}
template <class T>
void rd(vc<T> &x) {
for (auto &d: x) rd(d);
}
void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
rd(h), read(t...);
}
void wt(const char c) {
if (por == SZ) flush();
obuf[por++] = c;
}
void wt(const string s) {
for (char c: s) wt(c);
}
void wt(const char *s) {
size_t len = strlen(s);
for (size_t i = 0; i < len; i++) wt(s[i]);
}
template <typename T>
void wt_integer(T x) {
if (por > SZ - 100) flush();
if (x < 0) { obuf[por++] = '-', x = -x; }
int outi;
for (outi = 96; x >= 10000; outi -= 4) {
memcpy(out + outi, pre.num[x % 10000], 4);
x /= 10000;
}
if (x >= 1000) {
memcpy(obuf + por, pre.num[x], 4);
por += 4;
} else if (x >= 100) {
memcpy(obuf + por, pre.num[x] + 1, 3);
por += 3;
} else if (x >= 10) {
int q = (x * 103) >> 10;
obuf[por] = q | '0';
obuf[por + 1] = (x - q * 10) | '0';
por += 2;
} else
obuf[por++] = x | '0';
memcpy(obuf + por, out + outi + 4, 96 - outi);
por += 96 - outi;
}
template <typename T>
void wt_real(T x) {
ostringstream oss;
oss << fixed << setprecision(15) << double(x);
string s = oss.str();
wt(s);
}
void wt(int x) { wt_integer(x); }
void wt(ll x) { wt_integer(x); }
void wt(i128 x) { wt_integer(x); }
void wt(u32 x) { wt_integer(x); }
void wt(u64 x) { wt_integer(x); }
void wt(u128 x) { wt_integer(x); }
void wt(double x) { wt_real(x); }
void wt(long double x) { wt_real(x); }
void wt(f128 x) { wt_real(x); }
template <class T, class U>
void wt(const pair<T, U> val) {
wt(val.first);
wt(' ');
wt(val.second);
}
template <size_t N = 0, typename T>
void wt_tuple(const T t) {
if constexpr (N < std::tuple_size<T>::value) {
if constexpr (N > 0) { wt(' '); }
const auto x = std::get<N>(t);
wt(x);
wt_tuple<N + 1>(t);
}
}
template <class... T>
void wt(tuple<T...> tpl) {
wt_tuple(tpl);
}
template <class T, size_t S>
void wt(const array<T, S> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) wt(' ');
wt(val[i]);
}
}
template <class T>
void wt(const vector<T> val) {
auto n = val.size();
for (size_t i = 0; i < n; i++) {
if (i) wt(' ');
wt(val[i]);
}
}
void print() { wt('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
wt(head);
if (sizeof...(Tail)) wt(' ');
print(forward<Tail>(tail)...);
}
// gcc expansion. called automaticall after main.
void __attribute__((destructor)) _d() { flush(); }
} // namespace fastio
using fastio::read;
using fastio::print;
using fastio::flush;
#if defined(LOCAL)
#define SHOW(...) \
SHOW_IMPL(__VA_ARGS__, SHOW4, SHOW3, SHOW2, SHOW1)(__VA_ARGS__)
#define SHOW_IMPL(_1, _2, _3, _4, NAME, ...) NAME
#define SHOW1(x) print(#x, "=", (x)), flush()
#define SHOW2(x, y) print(#x, "=", (x), #y, "=", (y)), flush()
#define SHOW3(x, y, z) print(#x, "=", (x), #y, "=", (y), #z, "=", (z)), flush()
#define SHOW4(x, y, z, w) \
print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w)), flush()
#else
#define SHOW(...)
#endif
#define INT(...) \
int __VA_ARGS__; \
read(__VA_ARGS__)
#define LL(...) \
ll __VA_ARGS__; \
read(__VA_ARGS__)
#define U32(...) \
u32 __VA_ARGS__; \
read(__VA_ARGS__)
#define U64(...) \
u64 __VA_ARGS__; \
read(__VA_ARGS__)
#define STR(...) \
string __VA_ARGS__; \
read(__VA_ARGS__)
#define CHAR(...) \
char __VA_ARGS__; \
read(__VA_ARGS__)
#define DBL(...) \
double __VA_ARGS__; \
read(__VA_ARGS__)
#define VEC(type, name, size) \
vector<type> name(size); \
read(name)
#define VV(type, name, h, w) \
vector<vector<type>> name(h, vector<type>(w)); \
read(name)
void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"
#line 2 "library/mod/modint_common.hpp"
struct has_mod_impl {
template <class T>
static auto check(T &&x) -> decltype(x.get_mod(), std::true_type{});
template <class T>
static auto check(...) -> std::false_type;
};
template <class T>
class has_mod : public decltype(has_mod_impl::check<T>(std::declval<T>())) {};
template <typename mint>
mint inv(int n) {
static const int mod = mint::get_mod();
static vector<mint> dat = {0, 1};
assert(0 <= n);
if (n >= mod) n %= mod;
while (len(dat) <= n) {
int k = len(dat);
int q = (mod + k - 1) / k;
dat.eb(dat[k * q - mod] * mint::raw(q));
}
return dat[n];
}
template <typename mint>
mint fact(int n) {
static const int mod = mint::get_mod();
assert(0 <= n && n < mod);
static vector<mint> dat = {1, 1};
while (len(dat) <= n) dat.eb(dat[len(dat) - 1] * mint::raw(len(dat)));
return dat[n];
}
template <typename mint>
mint fact_inv(int n) {
static vector<mint> dat = {1, 1};
if (n < 0) return mint(0);
while (len(dat) <= n) dat.eb(dat[len(dat) - 1] * inv<mint>(len(dat)));
return dat[n];
}
template <class mint, class... Ts>
mint fact_invs(Ts... xs) {
return (mint(1) * ... * fact_inv<mint>(xs));
}
template <typename mint, class Head, class... Tail>
mint multinomial(Head &&head, Tail &&... tail) {
return fact<mint>(head) * fact_invs<mint>(std::forward<Tail>(tail)...);
}
template <typename mint>
mint C_dense(int n, int k) {
static vvc<mint> C;
static int H = 0, W = 0;
auto calc = [&](int i, int j) -> mint {
if (i == 0) return (j == 0 ? mint(1) : mint(0));
return C[i - 1][j] + (j ? C[i - 1][j - 1] : 0);
};
if (W <= k) {
FOR(i, H) {
C[i].resize(k + 1);
FOR(j, W, k + 1) { C[i][j] = calc(i, j); }
}
W = k + 1;
}
if (H <= n) {
C.resize(n + 1);
FOR(i, H, n + 1) {
C[i].resize(W);
FOR(j, W) { C[i][j] = calc(i, j); }
}
H = n + 1;
}
return C[n][k];
}
template <typename mint, bool large = false, bool dense = false>
mint C(ll n, ll k) {
assert(n >= 0);
if (k < 0 || n < k) return 0;
if constexpr (dense) return C_dense<mint>(n, k);
if constexpr (!large) return multinomial<mint>(n, k, n - k);
k = min(k, n - k);
mint x(1);
FOR(i, k) x *= mint(n - i);
return x * fact_inv<mint>(k);
}
template <typename mint, bool large = false>
mint C_inv(ll n, ll k) {
assert(n >= 0);
assert(0 <= k && k <= n);
if (!large) return fact_inv<mint>(n) * fact<mint>(k) * fact<mint>(n - k);
return mint(1) / C<mint, 1>(n, k);
}
// [x^d](1-x)^{-n}
template <typename mint, bool large = false, bool dense = false>
mint C_negative(ll n, ll d) {
assert(n >= 0);
if (d < 0) return mint(0);
if (n == 0) { return (d == 0 ? mint(1) : mint(0)); }
return C<mint, large, dense>(n + d - 1, d);
}
#line 3 "library/mod/modint.hpp"
template <int mod>
struct modint {
static constexpr u32 umod = u32(mod);
static_assert(umod < u32(1) << 31);
u32 val;
static modint raw(u32 v) {
modint x;
x.val = v;
return x;
}
constexpr modint() : val(0) {}
constexpr modint(u32 x) : val(x % umod) {}
constexpr modint(u64 x) : val(x % umod) {}
constexpr modint(u128 x) : val(x % umod) {}
constexpr modint(int x) : val((x %= mod) < 0 ? x + mod : x){};
constexpr modint(ll x) : val((x %= mod) < 0 ? x + mod : x){};
constexpr modint(i128 x) : val((x %= mod) < 0 ? x + mod : x){};
bool operator<(const modint &other) const { return val < other.val; }
modint &operator+=(const modint &p) {
if ((val += p.val) >= umod) val -= umod;
return *this;
}
modint &operator-=(const modint &p) {
if ((val += umod - p.val) >= umod) val -= umod;
return *this;
}
modint &operator*=(const modint &p) {
val = u64(val) * p.val % umod;
return *this;
}
modint &operator/=(const modint &p) {
*this *= p.inverse();
return *this;
}
modint operator-() const { return modint::raw(val ? mod - val : u32(0)); }
modint operator+(const modint &p) const { return modint(*this) += p; }
modint operator-(const modint &p) const { return modint(*this) -= p; }
modint operator*(const modint &p) const { return modint(*this) *= p; }
modint operator/(const modint &p) const { return modint(*this) /= p; }
bool operator==(const modint &p) const { return val == p.val; }
bool operator!=(const modint &p) const { return val != p.val; }
modint inverse() const {
int a = val, b = mod, u = 1, v = 0, t;
while (b > 0) {
t = a / b;
swap(a -= t * b, b), swap(u -= t * v, v);
}
return modint(u);
}
modint pow(ll n) const {
assert(n >= 0);
modint ret(1), mul(val);
while (n > 0) {
if (n & 1) ret *= mul;
mul *= mul;
n >>= 1;
}
return ret;
}
static constexpr int get_mod() { return mod; }
// (n, r), r は 1 の 2^n 乗根
static constexpr pair<int, int> ntt_info() {
if (mod == 120586241) return {20, 74066978};
if (mod == 167772161) return {25, 17};
if (mod == 469762049) return {26, 30};
if (mod == 754974721) return {24, 362};
if (mod == 880803841) return {23, 211};
if (mod == 943718401) return {22, 663003469};
if (mod == 998244353) return {23, 31};
if (mod == 1045430273) return {20, 363};
if (mod == 1051721729) return {20, 330};
if (mod == 1053818881) return {20, 2789};
return {-1, -1};
}
static constexpr bool can_ntt() { return ntt_info().fi != -1; }
};
#ifdef FASTIO
template <int mod>
void rd(modint<mod> &x) {
fastio::rd(x.val);
x.val %= mod;
// assert(0 <= x.val && x.val < mod);
}
template <int mod>
void wt(modint<mod> x) {
fastio::wt(x.val);
}
#endif
using modint107 = modint<1000000007>;
using modint998 = modint<998244353>;
#line 2 "library/random/base.hpp"
u64 RNG_64() {
static uint64_t x_
= uint64_t(chrono::duration_cast<chrono::nanoseconds>(
chrono::high_resolution_clock::now().time_since_epoch())
.count())
* 10150724397891781847ULL;
x_ ^= x_ << 7;
return x_ ^= x_ >> 9;
}
u64 RNG(u64 lim) { return RNG_64() % lim; }
ll RNG(ll l, ll r) { return l + RNG_64() % (r - l); }
#line 6 "main.cpp"
bool match(string s, string t) {
if (len(s) != len(t)) return 0;
FOR(i, len(s)) {
if (s[i] == '?' || t[i] == '?' || s[i] == t[i]) continue;
return 0;
}
return 1;
}
using mint = modint998;
string solve_two(string A, string B) {
vc<string> cand;
ll n = len(A);
// i < k : 同じ
// i == k : d, d+1
// i > k : 9 -> 0
FOR(k, n) {
string x(n, '?');
bool ng = 0;
FOR(i, k) {
if (A[i] != '?') x[i] = A[i];
if (B[i] != '?') x[i] = B[i];
if (x[i] == '?') { x[i] = (i == 0 ? '1' : '0'); }
if (A[i] != '?' && x[i] != A[i]) ng = 1;
if (B[i] != '?' && x[i] != B[i]) ng = 1;
if (i == 0 && x[i] == '0') ng = 1;
}
if (ng) break;
if (A[k] == '9' || B[k] == '0') continue;
x[k] = (k == 0 ? '1' : '0');
if (A[k] != '?') x[k] = A[k];
if (B[k] != '?') x[k] = B[k] - 1;
if (k == 0 && x[k] == '0') continue;
if (A[k] != '?' && x[k] != A[k]) continue;
if (B[k] != '?' && x[k] != B[k] - 1) continue;
FOR(i, k + 1, n) {
if (A[i] != '?' && A[i] != '9') ng = 1;
if (B[i] != '?' && B[i] != '0') ng = 1;
x[i] = '9';
}
if (ng) continue;
cand.eb(x);
// SHOW(A, B, x);
}
if (cand.empty()) return "";
return MIN(cand);
}
// 桁数が一定
// 最初の数を返す OR empty
string solve_keta(vc<string> A) {
int K = len(A[0]);
// print();
// FOR(i, len(A)) SHOW(A[i]);
if (len(A) == 1) {
string x = A[0];
if (x[0] == '0') return "";
FOR(i, len(x)) {
if (x[i] != '?') continue;
x[i] = (i == 0 ? '1' : '0');
}
return x;
}
if (len(A) == 2) return solve_two(A[0], A[1]);
vc<string> cand;
// 1 の位を決め打つ
FOR(d, 10) {
bool ok = 1;
FOR(i, len(A)) {
ll d1 = (d + i) % 10;
if (A[i].back() == '0' + d1 || A[i].back() == '?') continue;
ok = 0;
break;
}
if (!ok) continue;
if (d + len(A) <= 10) {
// 繰り上がりなし
// 1 の位は valid に埋まった
// 他の位を決めましょう
string x(K, '?');
x.back() = '0' + d;
bool ng = 0;
FOR(j, K - 1) {
char c = [&]() -> int {
FOR(i, len(A)) {
if (A[i][j] == '?') continue;
return A[i][j];
}
return (j == 0 ? '1' : '0');
}();
x[j] = c;
if (j == 0 && c == '0') ng = 1;
FOR(i, len(A)) {
if (A[i][j] != x[j] && A[i][j] != '?') ng = 1;
}
}
if (ng) continue;
cand.eb(x);
continue;
}
string SMALL(K - 1, '?');
string LARGE(K - 1, '?');
FOR(i, len(A)) FOR(j, K - 1) {
if (A[i][j] == '?') continue;
if (d + i <= 9) {
SMALL[j] = A[i][j];
} else {
LARGE[j] = A[i][j];
}
}
bool ng = 0;
FOR(i, len(A)) FOR(j, K - 1) {
if (A[i][j] == '?') continue;
if (d + i <= 9) {
if (SMALL[j] != A[i][j]) ng = 1;
} else {
if (LARGE[j] != A[i][j]) ng = 1;
}
}
if (ng) continue;
string x = solve_two(SMALL, LARGE);
if (x.empty()) continue;
x += '0' + d;
cand.eb(x);
}
if (cand.empty()) return "";
return MIN(cand);
}
mint solve(string S) {
ll n = len(S);
string SMALL;
FOR(i, 1, 1100) { SMALL += to_string(i); }
FOR(i, len(SMALL) - n + 1) {
string x = SMALL.substr(i, n);
if (match(x, S)) return 1 + i;
}
// (最初の number, idx) について辞書順
pair<string, int> ANS;
auto upd = [&](string FIRST, int idx) -> void {
assert(len(FIRST) && FIRST[0] != '0');
if (ANS.fi.empty()) { ANS = {FIRST, idx}; }
if (len(ANS.fi) > len(FIRST)
|| (len(ANS.fi) == len(FIRST) && ANS.fi > FIRST)) {
ANS = {FIRST, idx};
}
if (ANS.fi == FIRST) { chmin(ANS.se, idx); }
};
/*
桁数が 2 種類ある場合
*/
FOR(K, 4, n) {
// K 桁、K+1 桁
string A(K, '9');
string B(K + 1, '0');
B[0] = '1';
string R;
FOR(10) {
R += B;
B.back()++;
}
R.resize(n);
string L;
FOR(10) {
FOR(i, len(A)) {
string x = A.substr(i);
x += L;
x += R;
x.resize(n);
if (match(x, S)) { upd(A, i); }
}
L = A + L;
A.back()--;
}
}
// すべてが K 桁
FOR(K, 4, n + 2) {
// 左から a 桁が最初の数由来である
FOR(a, 1, K + 1) {
if (a > n) continue;
vc<int> who(n);
FOR(i, a, n) { who[i] = (i >= K ? who[i - K] + 1 : 1); }
vc<string> dat(MAX(who) + 1);
FOR(i, n) { dat[who[i]] += S[i]; }
while (len(dat[0]) < K) dat[0] = '?' + dat[0];
while (len(dat.back()) < K) dat.back() += '?';
for (auto& sub: dat) assert(len(sub) == K);
string x = solve_keta(dat);
if (x.empty()) continue;
upd(x, K - a);
}
}
auto [X, idx] = ANS;
// SHOW(X, idx);
// X 未満の桁数の総和を求めよう
vc<mint> dp_c(2), dp_s(2);
FOR(i, len(X)) {
int x = X[i] - '0';
vc<mint> ndp_c(2), ndp_s(2);
FOR(a, 1, 10) {
if (i == 0) {
if (a < x) ndp_c[0] += 1, ndp_s[0] += 1;
if (a == x) ndp_c[1] += 1, ndp_s[1] += 1;
} else {
ndp_c[0] += 1, ndp_s[0] += 1;
}
}
FOR(a, 10) {
if (a < x) {
ndp_c[0] += dp_c[0] + dp_c[1];
ndp_s[0] += dp_c[0] + dp_s[0] + dp_c[1] + dp_s[1];
}
if (a == x) {
ndp_c[0] += dp_c[0];
ndp_s[0] += dp_c[0] + dp_s[0];
ndp_c[1] += dp_c[1];
ndp_s[1] += dp_c[1] + dp_s[1];
}
if (a > x) {
ndp_c[0] += dp_c[0];
ndp_s[0] += dp_c[0] + dp_s[0];
}
}
swap(dp_c, ndp_c);
swap(dp_s, ndp_s);
}
mint ans = dp_s[0];
ans += idx;
ans += 1;
return ans;
}
void test() {
string S;
FOR(n, 1, 100100) S += to_string(n);
FOR(100000) {
int L = RNG(0, len(S));
ll n = len(S) - L;
chmin(n, 10);
n = RNG(1, n + 1);
string x = S.substr(L, n);
string y = S.substr(L, min<int>(len(S) - L, 20));
FOR(i, n) x[i] = (RNG(0, 3) ? x[i] : '?');
SHOW(x, y);
int idx = solve(x).val;
--idx;
SHOW(L, idx);
string t = S.substr(idx, n);
SHOW(t);
assert(idx <= L);
assert(match(S.substr(idx, n), x));
}
}
void solve() {
STR(S);
mint ANS = solve(S);
print(ANS);
}
signed main() {
// test();
// return 0;
INT(T);
FOR(T) solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 3ms
memory: 3692kb
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: 9ms
memory: 4004kb
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: 8ms
memory: 3932kb
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: 11ms
memory: 3820kb
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: 9ms
memory: 3932kb
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: 10ms
memory: 4024kb
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: 4ms
memory: 3748kb
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: 7ms
memory: 3820kb
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: 5ms
memory: 3760kb
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: 10ms
memory: 3636kb
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: 10ms
memory: 3644kb
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: 12ms
memory: 3752kb
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: 10ms
memory: 4060kb
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: 9ms
memory: 3792kb
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: 12ms
memory: 3844kb
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: 8ms
memory: 3768kb
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: 9ms
memory: 3852kb
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: 9ms
memory: 3752kb
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: 8ms
memory: 3760kb
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: 9ms
memory: 3792kb
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: 10ms
memory: 3860kb
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: 9ms
memory: 3816kb
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: 7ms
memory: 4056kb
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: 8ms
memory: 4020kb
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: 9ms
memory: 3764kb
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: 6ms
memory: 3764kb
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: 7ms
memory: 3820kb
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: 9ms
memory: 3856kb
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: 7ms
memory: 3756kb
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: 10ms
memory: 4060kb
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: 5ms
memory: 3620kb
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: 9ms
memory: 4072kb
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: 8ms
memory: 3792kb
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: 7ms
memory: 3644kb
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: 6ms
memory: 4016kb
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: 7ms
memory: 3764kb
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: 9ms
memory: 3756kb
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: 8ms
memory: 3756kb
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: 9ms
memory: 3720kb
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: 5ms
memory: 3756kb
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: 7ms
memory: 3764kb
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: 0
Accepted
time: 4ms
memory: 4052kb
input:
3 ?????7???8?9???88???????0 ?????8??81??????0?????0?? 43??3?????8??????5?????64
output:
6511870 83876 631294040
result:
ok 3 lines
Test #43:
score: 0
Accepted
time: 3ms
memory: 4012kb
input:
10 7065??900 1601725432900948614194 13?301?4485? ?0?30?90193966 ? 57601 3 28?6?4?1?580649335866 303734658?94906887919 5486279?0126415
output:
869952480 560492304 5119514 402485197 1 67691 3 181212387 863438453 498821339
result:
ok 10 lines
Test #44:
score: 0
Accepted
time: 4ms
memory: 3612kb
input:
10 532733?93636080874826 934?1993 40? 683107 2?094??9888328099919981?9 5?44?56?94251405121?7599 ?02?32?9790?673 6161??460799 16?7054450? 5946593703349248006315290
output:
314570428 608497 70 404424 651209690 95760237 662398886 342673403 984012448 483512414
result:
ok 10 lines
Test #45:
score: 0
Accepted
time: 4ms
memory: 3688kb
input:
10 1899844147618813661674 1032070325778 3418801997991791360?1900 8871?1?77 ?540?81?235?304005452?896 ?43??5?03?25500 414 87404?70487798590280088 762349?30610110 50887??0685420
output:
195760993 444984573 82268869 798589879 245708120 719063594 72 630583772 148328310 845140489
result:
ok 10 lines
Test #46:
score: 0
Accepted
time: 4ms
memory: 4008kb
input:
10 296?7622762670??92 ?681285?664626?361845 29138 07?10601 56??1266? 05?9288208002?07 51597511?97489923253 367?252 0016588591741958 568138?58999?863863838
output:
744026668 124694378 58038 47963096 3489645 219750854 720810819 7655463 417135271 251637508
result:
ok 10 lines
Test #47:
score: 0
Accepted
time: 4ms
memory: 3748kb
input:
10 2852373637 518201408 ?815381244?38796973??97 77772744 ??0?689792287991062846680 00848878 79885?173519?93? ?171111607577466 80?03880131632 911??353916575273591
output:
663885981 158310921 506422587 208471110 113057855 379912959 976059524 373720096 307768201 126749643
result:
ok 10 lines
Test #48:
score: 0
Accepted
time: 4ms
memory: 4048kb
input:
10 5122101220611 ???417?28?28??2??4126??8 08426264246852 9451924673234521391 5?9888303 37616?567866235?95 6?6 843219489538521?84 111353106595009747563604 5??911?109916
output:
755533481 248606495 309902294 438991742 680591860 494729513 110 476129430 917853385 316984281
result:
ok 10 lines
Test #49:
score: 0
Accepted
time: 4ms
memory: 4056kb
input:
10 19?03381360875 31?415955 767110??5?47554570? ?446232487?1498 996346542632999129619 0936?06 0103233792 7 11166750646?865684573878 8280588500887990266580
output:
799754647 826324875 149669020 711427822 492911429 6315445 228068922 7 324214143 969809573
result:
ok 10 lines
Test #50:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
10 10 752240200448?464?6656?426 70987325 759545???001173? 0?35643793?33?8?23 691?109?9844127499894418 31153?426055747 544685?36102?3153680 3335544230?56?32232253835 642858882
output:
10 371401947 194567876 212979877 799630119 515986133 225976452 7952926 654335766 270973177
result:
ok 10 lines
Test #51:
score: 0
Accepted
time: 3ms
memory: 3756kb
input:
10 630643?02814361248?602?80 12?632622 466330 31?6111 323546146964??5 3991?361931670 6456148418572594 954554764 640165689870307553?900 ?
output:
406656055 13331723 1716870 6316687 331905949 524301064 976040688 993444293 11963880 1
result:
ok 10 lines
Test #52:
score: 0
Accepted
time: 4ms
memory: 3756kb
input:
10 97196?27899738 508112737120 00?588?854803883?083 16660 22345744325 4769147750 10022??87879 2126842111?26869?82?71768 10634304?1311603?844?19? 87201109162139661?251
output:
898767864 916604216 755420839 72190 104653510 686759997 448865609 975125417 145301919 478301703
result:
ok 10 lines
Test #53:
score: 0
Accepted
time: 3ms
memory: 4016kb
input:
10 303601174? 3212783476965667602 ?36698?9692 82884 998?326 70722422 97920945221042945449224 ?33339 299995593559509519 15567
output:
945762134 990320951 612857520 133134 8177880 168270551 606929801 155584 772697983 66725
result:
ok 10 lines
Test #54:
score: 0
Accepted
time: 4ms
memory: 3784kb
input:
10 40?85787835957?70585 81544544915282625642112 38952808069121 2493741629 96976902396 ?572622?116363?06 4874660750659580 52?8?94?8?506?444444 85777354864863786 921?8
output:
302755563 923976637 574462970 207717339 49679396 646194969 675204454 112076870 860192059 43353
result:
ok 10 lines
Test #55:
score: 0
Accepted
time: 3ms
memory: 3764kb
input:
10 0426614050 5?5?455 336?342 786882064038?43430? 45307?1 58512?007674855834836856 5753968 ?1848103?880 09251?28955912925 ?7868595873
output:
155182935 1550 8285246 476234506 6906041 201458320 26668919 464785218 870497246 820688052
result:
ok 10 lines
Test #56:
score: 0
Accepted
time: 3ms
memory: 4056kb
input:
10 9947?174?82634?24 ?78752?68005??7559604?145 963 57 32200?5620?0 5134??653?? 5441494? 9313??9774787??5?3 ?861680?20 20
output:
157212918 364787346 1079 104 511081795 847705101 9350702 703431382 976644012 30
result:
ok 10 lines
Test #57:
score: 0
Accepted
time: 3ms
memory: 4052kb
input:
10 3?7?0727 3036?6663639610062960893 ??68?7 ?227?8 603811435?187068?9133 88722678?826009 845558 505511908 58161917 0408724059590405395
output:
74707351 741491094 2308 80026 740531889 1701239 266813 960654390 118422960 620810090
result:
ok 10 lines
Test #58:
score: 0
Accepted
time: 3ms
memory: 3764kb
input:
10 1 9786?57 0132?01492821913 954 1463191?214522912 72 59929 3?4?969?33833?16165 46149??46469214? 3?6969?16481264454240103
output:
1 9947395 77062876 1376 990656667 45 136887 733565119 700848889 606208376
result:
ok 10 lines
Test #59:
score: 0
Accepted
time: 2ms
memory: 3628kb
input:
10 ?7?954 0? 639016 4092734299044484 716656567824412117 1224494598 026?99330?80 0859687 8528340257 21698119599669088?86
output:
86628 11 70841 399928722 385872789 153146987 504287511 40669851 716307821 613877821
result:
ok 10 lines
Test #60:
score: 0
Accepted
time: 4ms
memory: 3864kb
input:
10 733038402487 71?14488?678589161238 ?5394924?1429 05690203874733065055 3574178878 3733581 421417710745 2277?626?2744994140?92462 2?3?7056911555589 9?955010
output:
955210647 863527529 649254496 195344313 804814988 8502397 876972012 952788847 513806697 12573959
result:
ok 10 lines
Test #61:
score: 0
Accepted
time: 3ms
memory: 3788kb
input:
10 8582030736875403 3798 334903035451959570 ?8580820607208?205 02302382076 029?699923372 896162892656?641 ?? 911285959883 83313
output:
184452874 14082 626937911 701544267 632396911 803447805 304045498 1 389855364 58057
result:
ok 10 lines
Test #62:
score: 0
Accepted
time: 3ms
memory: 3756kb
input:
10 ?93353?3? 4 5728 4497043019 33210200032?661263224 9 870356378 4?6676393773?7??439 13699466909862308211 5236127?57?86?
output:
156538 4 10320 370194838 448032907 9 273991855 555354569 38038789 201223290
result:
ok 10 lines
Test #63:
score: 0
Accepted
time: 2ms
memory: 3684kb
input:
10 3288 95782 780537575 00784305478087 2?31809592 3160?9110 2732137886635568 ?3701677361 485?244??1724 030318229708389907
output:
10425 136781 275976081 824636505 519277370 817329711 391522873 611634014 537615640 887785299
result:
ok 10 lines
Test #64:
score: 0
Accepted
time: 4ms
memory: 3752kb
input:
10 08028448172975020257621 3077?1?293359977791 9318947 789 8?2252?152230215 732 ?697143493?920600 62881694118481889 333858181958219?157640138 9?63?504?24??634744
output:
567008888 152929243 12152446 7 667391459 710 73916630 721280591 420929905 826761761
result:
ok 10 lines
Test #65:
score: 0
Accepted
time: 3ms
memory: 3760kb
input:
10 06 5?4133310?10138832 365669?0?3118888?38728816 2 92?5?787?85?98570190 40114? 532677 49059 11712772?27322228 01420508803443474?3044
output:
111 933602460 149409265 2 518780477 3452 1495412 2604 56019668 484025688
result:
ok 10 lines
Test #66:
score: 0
Accepted
time: 3ms
memory: 3756kb
input:
10 7053569 6 ?5?5400745 774624002017970795217 ?873 760452780284579?476?94 04?00075857?02029 0448646624956983283 87?404 896085913670
output:
23876829 6 309484934 134905439 1051 239906259 996655478 572674512 731816 86070407
result:
ok 10 lines
Test #67:
score: 0
Accepted
time: 3ms
memory: 3752kb
input:
10 758716?755 44802?8184102243703?572 406 09190188180048950131 5582257739112 147153851 667?077703107733?317616 467586?784522?37??6 75404?75 26210499237
output:
989043824 630906362 1108 966601769 238478115 106611970 454882023 141960910 941315 563086068
result:
ok 10 lines
Test #68:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
1 9287??0
output:
1610889
result:
ok single line: '1610889'
Test #69:
score: 0
Accepted
time: 1ms
memory: 4004kb
input:
1 ??941??0
output:
193887
result:
ok single line: '193887'
Test #70:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
1 9512??0
output:
2960889
result:
ok single line: '2960889'
Test #71:
score: 0
Accepted
time: 1ms
memory: 3724kb
input:
1 0?00???1??1
output:
489492
result:
ok single line: '489492'
Test #72:
score: 0
Accepted
time: 8ms
memory: 3760kb
input:
10 79999??989999999910000000 0001?00000000000?11?0?000 9999910??0??00?0000????00 9?99999?998999999999?9999 99???9999999100000?00?000 ?99?99?999??0?00?0?1?0??? 99910?00??00000?100000000 ??0??010?00?0000?00?0??1? 999?9????9998999?999999?9 ?00??010?0??0000001?0?0?0
output:
788888873 192200481 569251290 569134271 788888878 68888879 796889010 797019015 894834044 802664229
result:
ok 10 lines
Test #73:
score: 0
Accepted
time: 9ms
memory: 3796kb
input:
10 ?9999?799?9999?99??9??99? 999979999?989?999991?0000 9979999899999100000100?01 9989999?1000??1?0?0110?00 99?99?99999999?99910?000? ???999????99?10??????0?0? 9?97?9999?9999899?9?999?? 9?9999999999979999?999?99 99999997999999?9999999?99 9999999?9910000000?00?000
output:
628734839 68888871 488877 488882 796888995 488877 802544094 796888975 969232672 62697933
result:
ok 10 lines
Test #74:
score: 0
Accepted
time: 8ms
memory: 3820kb
input:
10 ?00001?0000000?10?0000002 9?9??99??9910??00?00??000 9?9999999999799999999?999 0000000?01000000?000?100? 0000000000000000011000000 9??9?9999?9799?9??9??9?99 9999999999999999910000000 0???0?000?0?0?1000?000?02 9??91?0?00001?000???100?0 999?9??99?9?9899999991000
output:
902934071 902934055 569248680 802544123 830780516 902934036 410768685 62697951 68888886 68888869
result:
ok 10 lines
Test #75:
score: 0
Accepted
time: 8ms
memory: 3760kb
input:
10 000?0000000000000000000?0 99999910000000000?0000000 ???0?0000?????0000100?0?0 9999?1?00?0?000?0?0?0?0?0 00000?01?0000000??1?000?0 9?999999?100?00?00000000? 0?000?000?0?0?00?0?10??00 99998999999100?0?01000?0? 8?9999?1?00000?00000?100? 9?0000000000?000?0000011?
output:
626142615 62697937 902935055 802544115 902934078 574985038 902934067 5888879 5888883 62697942
result:
ok 10 lines
Test #76:
score: 0
Accepted
time: 8ms
memory: 3752kb
input:
10 ???00?000??0?0100000000?0 997?9??999??9999999?0000? 99979999999999?9899999999 9?99999799999998999999991 9??9999?0?00000000000?0?0 99?99?999910?000?00000?0? 99?97?99?9?????9??????0?1 799999?999999999998999999 000000000?0?0011?00?00000 9999100000001000000110000
output:
802544118 148888871 569251265 788888866 569251288 802544110 5888873 830780459 493811785 68888886
result:
ok 10 lines
Test #77:
score: 0
Accepted
time: 9ms
memory: 4024kb
input:
10 000??1????0??00?0??1000?0 000000000000?011000000000 99999999???9?999??9??9?9? 9?9?9?9?9?998??9??9??9999 7?999?99999100?0?1?000?1? 000?00?01?0000?0?00????0? ?9?89??9??9?10?00000???00 0??00010??00000000?001100 00?10?0000?0?0?00?0000110 99999?9?99999979999999999
output:
5888892 493811785 788888088 68888743 488879 62697956 788888878 493811778 494848652 488544804
result:
ok 10 lines
Test #78:
score: 0
Accepted
time: 8ms
memory: 3980kb
input:
10 00?1?00000?0?0?0?0??0?011 ?000000001000000?00?000?0 ?99??9999899?99??0??0?0?0 000?0??0??0??01??000?0000 99999999999?99?9979999?99 9999999999999999999910000 9999100000000001000000000 00?0??001??0??00?0000??00 999999999???100000??00000 ?1?0???000?0?0000?0?0??0?
output:
62698050 509811768 488875 62698059 456883465 689005292 62697939 796889030 796889001 493811767
result:
ok 10 lines
Test #79:
score: 0
Accepted
time: 8ms
memory: 4024kb
input:
10 9799998999991000001000011 989999?100000?00?0?1000?? 99?9?99?99999910000000000 ?9?9?9?999999????99?989?9 ?9979?99899999??00?0?0000 99899?99999999?0000??0?00 7999?8999?91?00001?000??0 0010000000000000110000000 ??000?000?0?0100?0?000000 999989?9991000?01?0001100
output:
488878 488883 802544106 996757714 488876 802544106 488879 574985060 796889013 488880
result:
ok 10 lines
Test #80:
score: 0
Accepted
time: 8ms
memory: 3860kb
input:
10 ??999?9?9???????1000????0 ?00?0?0??00?????1100?0000 9?99????9?9999?99?9??99?0 000000000000?1?000?000000 99?99989999???99999999999 79999999899999999100000?0 9?899999100?0010000110000 ?0000000000000?00000?011? 00000?000000?01?00?00?000 ??00?0?000?0???0?10000?0?
output:
488874 788888891 788880872 569251296 802434102 788888873 488882 626142618 574985048 62697948
result:
ok 10 lines
Test #81:
score: 0
Accepted
time: 8ms
memory: 3792kb
input:
10 9999999?00000000001000000 979999989???991?0???0100? ?989?99910??0010000110000 ?0????100000000???0110?00 ????99?99991?0?0?0??0???0 9??99??10?00010?0?1?0???2 8?9999991000000010000?0?? 00?0110?0?0000?0??0?000?0 0??00000?0000?000?00?00?? ?9999899??910?00010??01?0
output:
62697936 5888876 488882 569251303 68888879 488883 68888882 802544139 569251296 488879
result:
ok 10 lines
Test #82:
score: 0
Accepted
time: 8ms
memory: 3816kb
input:
10 110000?000000000?0?000000 000?0?01?00?0?0?00??1?0?? 999100?000000000000100000 9999999???00?0000000010?0 9989999910000010000?10000 9799999999?99989999999999 999999999??999999999?1?00 0?00??00???0000???00?0000 ?????7???????99?9?99999?? 9?899?9910000010000??0?0?
output:
277390220 802544136 493811765 802544111 488882 569251267 802544099 788888891 5768868 488882
result:
ok 10 lines
Test #83:
score: 0
Accepted
time: 8ms
memory: 3688kb
input:
10 9?9999?89??9999??9?9?100? 99?99?9999999989??9999999 ?0???1??00?0?000??00?0000 98??9?910?0?01000??10??0? 100000000000000000100000? 0000000000001?00000000001 9997999999999999989999999 0?0000??01?00?0??000??00? 000?0000?000000?011000000 999?999998999999999991000
output:
700110815 607279110 62697959 488883 410768702 796889014 574985015 62697955 902934068 802544099
result:
ok 10 lines
Test #84:
score: 0
Accepted
time: 9ms
memory: 3756kb
input:
10 999?999998999999999991000 999?????9?9?99999????9?99 99?999?99999??9??10???0?0 ?99?1??0?00??1000?0?0??00 99?99910?0000000000000100 ?9999999910000?0000010000 ??999979?99??8?9?99?91000 9999999999899999999999999 9?99999999999999?000?000? 0000??1?00000?000?100?00?
output:
802544099 68882576 62697926 788888886 493811762 62697934 68888869 574971033 952035858 62697958
result:
ok 10 lines
Test #85:
score: 0
Accepted
time: 9ms
memory: 3764kb
input:
10 7???989?99?10000?10000??0 9??7??999?99999?9?8?99999 9991?00000010000001100000 8999?9999999?999999910000 9910000000000010000000000 9?999999?9?0000000?001?00 ?999999999999??999999999? ?9?9?999?9????99??9???9?? 9999?999?99??991000?0?00? 999?9999?100?0010??011000
output:
488879 791594144 68888887 36112986 802544118 62697933 796887810 38849 62697928 488881
result:
ok 10 lines
Test #86:
score: 0
Accepted
time: 10ms
memory: 4056kb
input:
10 00??00000?1000?000???1000 79?99999999999?9999999?99 9???9??999999?999999?999? 99?999?9999?999?9?9?98999 99?99?9?999999?1000000000 99?9????1??00??0??0?0?000 999?9999?9998999999???999 99?99??99??9?99??99??99?? 989?99?9999999999910??000 000000?0?1100000?00?00000
output:
62697944 574982230 68888813 174770934 902934051 788888882 546427758 488839 715133352 493811790
result:
ok 10 lines
Test #87:
score: 0
Accepted
time: 9ms
memory: 3640kb
input:
10 899?999991?0000?001000?0? 9999?999?9??9?9991?00?00? 9?7999?99999?9?9999899?99 9999997999999989999999910 ?99?99?999??9999???99999? 999979999?989999?99100000 0000?0000000??000000?1000 00000000?0100000000?00000 ?9?99?99????9?????00???00 9999899999991000000010000
output:
788888881 5888873 861957371 788888867 68888255 68888871 293459707 493811774 483884 68888878
result:
ok 10 lines
Test #88:
score: 0
Accepted
time: 9ms
memory: 3760kb
input:
10 999?89?99?99100?00001?000 0?0???01??0??00?00000110? ??00?00000?00???00?0???00 ?999?89?9?9999???00?0?000 9999999998?9?999?99?99999 9??9?9?99??99??9??0?0?0?0 91000?00??0000001100?0002 ?999899?99?999?999??00000 ?0010000??00????0?0?0001? ?99999999899999?9999?1000
output:
68888878 569266698 62697944 708888877 511632988 68888873 68888889 960942281 903934157 802544099
result:
ok 10 lines
Test #89:
score: 0
Accepted
time: 8ms
memory: 3788kb
input:
10 ?99?1??00????000000000000 0000?00000?01?00?000????0 9???99?9????9100???0?0000 0000?0000000010?000000000 ??99???9??9999??910000??? ?99??99?999?9??999??9?9?? 999910000000?0000?0100000 91?????000?0?000?0??0??0? 9?99999999999100000000000 99999?00000?1000001?00??0
output:
689005308 788888895 802544107 569251296 148168876 5888828 574985043 788888889 802544107 5888885
result:
ok 10 lines
Test #90:
score: 0
Accepted
time: 9ms
memory: 3820kb
input:
10 999999?999999999999999999 ?999???9910??0000?0?00?0? 00??00?0?0?000????000?010 000000000001100000000000? ?100?00?0?1000000?11?000? ??999?999?999??999?9?99?9 ?9999?9?9?9??98??????999? 000000?0000000000110?0000 99?9?99999??99?9998?99999 ?99?9?9998?999991?0?00?1?
output:
665348937 902934057 797019024 796889027 788888889 68888813 68882568 802544126 68888864 5888874
result:
ok 10 lines
Test #91:
score: 0
Accepted
time: 8ms
memory: 3820kb
input:
10 9999999999999999899?9999? 9991?0?00?010??000???0000 999?99?99??7????9?9?9??9? 9?7?99??8??9??9??00????0? 0000000100000000000011000 9100??00000?0?0000?001000 999910000?000100000001100 ?0????0??0100?00???0?00?0 ???9100?0?0?100000011?000 79999??99999910000?010000
output:
410768668 68888887 781688862 1088875 569251302 278388146 788888886 912934069 68888886 5888877
result:
ok 10 lines
Test #92:
score: 0
Accepted
time: 8ms
memory: 4028kb
input:
10 999999?9999100?0???0?00?0 0???0?0?000?000000?00?00? 0000000000000100000000000 8?999999991000?000?01?000 0000000000001000000000000 ??0000000000000??0?001000 9999999799999999999999999 999999997?999999999?99999 9999989999999999999999999 100000?000001000000000011
output:
802544109 569251298 569251296 902934056 569251297 494848634 198747558 802543879 335532518 802544120
result:
ok 10 lines
Test #93:
score: 0
Accepted
time: 9ms
memory: 3764kb
input:
10 9999??9?9?998999?9999?999 0000000000000110000?00000 9?9?998999??9???00?0?0??? 9999999?9?99999?9997?999? 9799998999??100000?000011 ?9991???0000???????00??0? 0?010000000000?0000?11000 ?0?0?0000?0?000000?10?000 99??9991000?000???10??00? 00?0?0000?0110?000?000000
output:
788888796 574985063 68888876 62697903 488878 788888886 410768717 902934067 62697936 569251311
result:
ok 10 lines
Test #94:
score: 0
Accepted
time: 6ms
memory: 4052kb
input:
10 ?999??999989??99999999?99 9999999999991000000000000 9999799998999991000001000 999989??9????9999?000?0?? 9999?9999?999997999??999? ?9?99999?99?9999?10?00000 99??1??000?1???????00?002 99979999989999?9100?00010 ?9999999?9999999991000000 ?00000?00?00000?00?00?100
output:
802543998 796889001 488875 893934052 703544082 788888873 5888886 5888874 902934048 796889017
result:
ok 10 lines
Test #95:
score: 0
Accepted
time: 8ms
memory: 3820kb
input:
10 999??9?99999??991??000?0? 000?0??0?00?01???0?000?0? 999998????99??0?0?0?01?00 9989999991000000100000110 00??00?0000000000?00000?0 0?000?00000?100?000000??? 001000?000000000000110000 ??00?000?0?000?0??0010??0 9989?9?91?000010000?10000 ??998999?99?99?9999999999
output:
902934050 62697951 68888877 5888881 410768703 62697953 410768718 495411774 488882 960942274
result:
ok 10 lines
Test #96:
score: 0
Accepted
time: 9ms
memory: 3816kb
input:
10 ?0?00?00?00?0??0?0?0???00 0??0?0??????0?000???????? 999899999999999999?999999 99?989??991?0000100001100 ?9?9999999??991?00??0?000 99999?0000000??01000?000? 110000000000?000000000?00 ?9?999????9???999?9991?00 ???9?9??0?000????100?00?0 ???0?0000?011000000000??2
output:
62697943 5888893 574984902 488880 802544106 62697938 277390220 68888869 902934059 796889027
result:
ok 10 lines
Test #97:
score: 0
Accepted
time: 0ms
memory: 4020kb
input:
10 99?9999?8789 99??97855?9 ????8????7?771?7??? ??999????9? 5?9??19??1?952????01 ?96??9???1??69??99 95??9???97 ???9??????? 8?2849?9?99?972 ????8??9??7??????0?
output:
920250048 671348453 2192 2857 19678 1087069 3272 6 957376112 30836
result:
ok 10 lines
Test #98:
score: 0
Accepted
time: 6ms
memory: 3820kb
input:
10 999?9?99999989?9??9????9 ????9?9?????999??60???0 777?7?779780781?8?7837?4 ?99??81?9?9 ?0??0?00?000?0 9?997?????9??98404??99 ??5???85?8?85?8?????6??? 7579?9??8?79?99 9?983?9??999??9370?00?0 99998????9?3?0?00?0?
output:
812934044 10088874 2221 1083478 68888890 358359098 414304 452168153 584125087 1688879
result:
ok 10 lines
Test #99:
score: 0
Accepted
time: 3ms
memory: 3716kb
input:
10 ?0577005?70?? 9????2?699998 ?89???11?1314151617 ?97??9?9?89?9?9?9?000 ???0?????? 199???9???0?0? ?99?85?7??9??4??? ??1???9???19 ?99?0?0000? 363000?036?0?
output:
339176 124888748 7 68888873 8 6532886 32488786 39847 5888887 71792892
result:
ok 10 lines
Test #100:
score: 0
Accepted
time: 6ms
memory: 3756kb
input:
10 ????998???9?1??0????? 9???9999???? ?998949999?99?9500???? 19??819?992????? 99??9??4?4????9 99?9739999?83999999 0000033??00 ?97?5999984?9?99946000004 45??????94????1 ?7????999??????99???????
output:
43878 34883 909990526 88880 805093711 26888871 19888912 31088873 1261 38803
result:
ok 10 lines
Test #101:
score: 0
Accepted
time: 4ms
memory: 4048kb
input:
10 ??5??9?5????9?5?5???? ????9???71????99?8?0 ?7912?9?9?9 ?00??02??? ?999999860??99?9999?0 99??95?00?00? ????9??99??4??9??9?9 ???????72???9???? ?7???9869999 999999?390
output:
2924858 789788053 141672189 490093 140059421 33888885 238839 776 338878 141644531
result:
ok 10 lines
Test #102:
score: 0
Accepted
time: 6ms
memory: 3752kb
input:
10 ??39???3?8?5?99?540?4??01 ?99??30??00?????30 97992???8992999?9 9?9??9?0??0??3???0 ???999999?3???0000 ?77???879??9800?0???0? ????79679?99?9? ??79976479?8?47??9?4800?6 ???971??999?????9999? ?69?9?????
output:
215875 71291287 68398874 12195399 228888880 388878 148726321 3776872 69688869 182
result:
ok 10 lines
Test #103:
score: 0
Accepted
time: 4ms
memory: 3760kb
input:
10 9?99???25?????9?8???9 ??9?988????99981?00? ???99?00?0?? 2??8?????1 ??1???9??2 ???9???259??8???9? ?77??????? 8449?999?500?00? 7973??98?97?93????3?8 ?37223?2239?2?022?1?2
output:
169644874 636888876 185 44 39883 984473 143 30388882 187877 7839
result:
ok 10 lines
Test #104:
score: 0
Accepted
time: 3ms
memory: 3752kb
input:
10 ???5???0??????5 1?999????9?8?49 ??889?09192?3949??6 9997768?9987689?9 ??07?0???? ?????991?00? 997?49999????9999650?00 00006?9?00?? 000000420?0 ?????1???????????
output:
1393 788872 165 52718872 210 2883 44388873 12188934 148888923 5
result:
ok 10 lines
Test #105:
score: 0
Accepted
time: 5ms
memory: 3752kb
input:
10 99897???99???0?98?0?? ??9?????4?49? ???49??5????3???55? ??000??00?????? ?9??????5?99??9? 49749?499??05 9??8?????99??????0?000 7?9??9???99? 2??726??????2??027??27 ??3?7?6????6??????0
output:
5768881 63856 85 38889 38688 1381 438877 30850 9678 70875
result:
ok 10 lines
Test #106:
score: 0
Accepted
time: 6ms
memory: 3684kb
input:
10 984?82??9?9? 9?????98?2????3?6?0???6? ?72??????7992?80023801 86??9?670? ???7??9?98???79? ?759859960060160? ????82????? 739?773928??9297393073?3? ?99?9?8???7??9?9?9?? ?9?92???0??0?0???????0??
output:
33763581 1844876 107878 25565 547674 1682 43 358525 704689595 148888886
result:
ok 10 lines
Test #107:
score: 0
Accepted
time: 2ms
memory: 3812kb
input:
10 ???69?99993 ?1????????0????0???0????? ??729?29930?30?30?3?3 4???4??84??95000?001?0? ?7698????0??0?70 6?????1???19???????? ???9????9?????? ??999?995?0????? 20?9??9??6?09?999 ?99?869?????7????007000??
output:
148883845 2889 781 18878 1982 3677 166 12853885 125223497 47888878
result:
ok 10 lines
Test #108:
score: 0
Accepted
time: 4ms
memory: 3628kb
input:
10 ?????30????????3?9?? ?1??????0????2? 3?99?3199?3?9993?0? 29??2999?0 99863629?9?9 9??875????9??9??? 2??662986??99663?066?01 973??98??9 9??82??9????0 98??9??2500?2??
output:
40422 23 148875 10882 624286113 52018879 320377 143878 134381 113883
result:
ok 10 lines
Test #109:
score: 0
Accepted
time: 4ms
memory: 3636kb
input:
10 9????599?0???1 81??9???15000001?00??? ???9??7?9????9???9????? 972???999??1?9? 918?919892? 999?99?2?8?00 2??9??72?????? 74?????4?9??? ????2?18?????22? 9?98?09999
output:
1682 9388882 38081 76888671 34563 986445354 52486 87607 7758 548880
result:
ok 10 lines
Test #110:
score: 0
Accepted
time: 4ms
memory: 4024kb
input:
10 9??999843?9?99?9???60 ??669??97??6?9 99?149999?99150 ?????8952??95300?53?? ???????????9???? 4?79?99??84?7999? 9?9???04??9??9???5?0????? 9??89??0??? 00?00042??00?00 5????5????
output:
562626047 4065469 240644525 465379 18 326734791 141284878 184 788889269 96
result:
ok 10 lines
Test #111:
score: 0
Accepted
time: 4ms
memory: 3796kb
input:
10 ?????????????3???5?6??28 ??????0006 ?9??????000 ?9?999??31??9??9?93???00 719819???02?1????0320? 399999997?3999??9 2?349?8243?99 9??00000?80 ??09?6?109?6?109?681100? ?778?99999?778??99?9
output:
24 22885 2883 41558282 483 909956625 15933876 11488889 3975473 832317961
result:
ok 10 lines
Test #112:
score: 0
Accepted
time: 5ms
memory: 3636kb
input:
10 9?1999?9???99?9??0 ?9??99?46???99???9? 9999896?99999 0???99??0??9???9?????? 63??00?2?30 ????????999??3?? 401?9?9?4015000?4??50?0? ??99?9????00?0???5?000 99?9?9???9? 999??93?99??89939?9999
output:
12888874 148126415 66788878 548835 89928892 506879 310088882 72888883 169 362933962
result:
ok 10 lines
Test #113:
score: 0
Accepted
time: 2ms
memory: 3704kb
input:
10 ?????1???1? ????9??????????0 ?????7????9???9 ?9?9??31?9??9???1?00? ?9?999?953?0?0 ???6?9?9????96???9?? 41?9?4?0???20 5?999?9987??999??9 ??39?083901 00000?008000000?1
output:
5 176 160 93768877 648344531 86934 59886 911489295 408389 101178420
result:
ok 10 lines
Test #114:
score: 0
Accepted
time: 6ms
memory: 3796kb
input:
10 ?9??89???????????0??0?0?? 9957840?00? ?437?8?3???4?92?4?0??44? ??54?854?955?0?5?15?0?550 ?9??7211???9?21?999992 9????3?9???4?? ?9?9?7?140?????00??1?0 989?00000?890?00??? 29??72???999?2?1299 987??999999
output:
38881 451608888 131076 20880 158488869 1082 295871925 911178418 92886651 208422761
result:
ok 10 lines
Test #115:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
10 ?97698?9970?7?? 9976???99?9?? ??0000???0?? 3?7?3????? 99??8?998?899?98??00 ??0?0?000???600?00??1 ?????9??0?07??? ???????????????????2?9? 6?09999?998467?99 ?99?899???8999?9?00?0
output:
1981 797888679 38889 901 5228875 722697945 26883 449 750106308 5288874
result:
ok 10 lines
Test #116:
score: 0
Accepted
time: 4ms
memory: 3932kb
input:
10 9?????9??99??399??? ?9?99?99917?00000091 99??9?2???9?9? ??9999?8?8??999?9? 93??0000?0?0 ?8??????????5 999900???900001 ???999?86???????????0 ?891011??1?14151 76????9????
output:
188837 746897112 12883288 708088875 19888889 86 5288887 12882490 7 1713
result:
ok 10 lines
Test #117:
score: 0
Accepted
time: 4ms
memory: 3980kb
input:
10 2172182?922?2? ?????99??7???9?9???? 6?298??729?767?00??7 99972?87?9999?824 ?????41?0?0000? ?7??9999?? ?0?80???9?1?81??1 ???97499???9999?00005?001 ???1?0???????? 8????930?0?
output:
541 388426 4492679 929868378 788888929 6588874 2311 238875 187 11244
result:
ok 10 lines
Test #118:
score: 0
Accepted
time: 5ms
memory: 3704kb
input:
10 60??????9?60?9??? ?9?2???0??? ?898899900??19?290? 781?999999???19?99? ??19??88?9988819??????? ??99981????????0000????00 ?08?20?2?102 ?8?43?9???9??4?000???03?? 79???9??5?79?9 ???495?515??354555??7?85?
output:
289335 487 2583 906445148 5180872 6588877 7723 346825229 967657 85
result:
ok 10 lines
Test #119:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
10 1?????899?1? ?9???0??00??????05???0 7655?99865509 7?795?8779?99?796?077960 3?0?????98330?9??? 99?????00???0? ?7??79808182? ?3?????4???4??? ?770?8709??1???10? 97?8000000?3
output:
48381 907934063 44745875 4566477 154375 2884 144 63 27280 541422771
result:
ok 10 lines
Test #120:
score: 0
Accepted
time: 2ms
memory: 3760kb
input:
10 8?79??????99?888???9?8?? 5?5?00?00005??8000 799998??999?00?0????00? ?1?0000??? 24?92450??? 87?88?909???9?????9??? 99?7?99?????992000 999?3?0?0000?????000? ?998?4899999?14??? 99?97118999999?118999
output:
54888097 227472152 488879 488889 8686 164 88876 60644534 231644524 806445335
result:
ok 10 lines
Test #121:
score: 0
Accepted
time: 5ms
memory: 4048kb
input:
10 ???????0?0 ?739????3??9?9?0????4 ?9998?39299999993?30 999?9859?99?9?60000000 8??9999?999??00? ?072?60????09286102 37?9999?987??59?99?9? 999?35?99??9? ???99?50?99 7340?99999?983403999?
output:
185 2288876 980408399 468888876 780888881 131927 196315488 148888372 243879 676353125
result:
ok 10 lines
Test #122:
score: 0
Accepted
time: 3ms
memory: 3980kb
input:
3 3?????????2???9???????3?? ????5??????????0???6????5 ?3????????9??8???????1??0
output:
771 519212 8058869
result:
ok 3 lines
Test #123:
score: 0
Accepted
time: 4ms
memory: 3756kb
input:
3 6????71??9???1??????1?00? ?9?????9???98?99????0??01 ?????9850000????5????0?0?
output:
10788870 12818873 395912362
result:
ok 3 lines
Test #124:
score: 0
Accepted
time: 3ms
memory: 3640kb
input:
3 5?86876539067021235786876 ?868765390670212357868765 8687653906702123578687653
output:
998244352 0 1
result:
ok 3 lines
Test #125:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
10 0 1 2 3 4 5 6 7 8 9
output:
11 1 2 3 4 5 6 7 8 9
result:
ok 10 lines
Test #126:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
10 00 11 22 33 44 55 66 77 88 99
output:
191 12 34 56 78 100 122 144 166 169
result:
ok 10 lines
Test #127:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
1 0992
output:
7287
result:
ok single line: '7287'
Test #128:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
1 0?9920
output:
89386
result:
ok single line: '89386'
Test #129:
score: 0
Accepted
time: 6ms
memory: 3764kb
input:
10 ?27?99???????9?????0?12?? 9954???999?9?407?999?9??0 ?9??9?9?30???00??3??0??0? 00??0170?0?00?0270?00000? 88952?88962788972788?8278 9?956?????99?6509?9?9?6?0 99?9????79?499??84?9?98?0 ?99?3?319???8?93???999?93 ?709?67?9???0??87??9??1?0 9????0?9??80?9???????????
output:
7785876 920444600 60644530 10028547 1562262 755857085 5798869 432874809 343869 974827
result:
ok 10 lines