QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#699358 | #9536. Athlete Welcome Ceremony | ucup-team896# | AC ✓ | 91ms | 120416kb | C++23 | 14.8kb | 2024-11-02 08:31:21 | 2024-11-02 08:31:22 |
Judging History
answer
/* _ _ _ _ __ __ __
/ \ _ _ | |_ | |__ ___ _ __ _ ___ _ __ ___ | | __ / /_ / /_ / /_
/ _ \ | | | | | __| | '_ \ / _ \ | '__| (_) / __| | '_ ` _ \ | |/ / | '_ \ | '_ \ | '_ \
/ ___ \ | |_| | | |_ | | | | | (_) | | | _ | (__ | | | | | | | < | (_) | | (_) | | (_) |
/_/ \_\ \__,_| \__| |_| |_| \___/ |_| (_) \___| |_| |_| |_| |_|\_\ \___/ \___/ \___/
[Created Time: 2024-11-02 08:23:35]
[Last Modified Time: 2024-11-02 08:30:57] */
#ifdef LOCAL
#include<bits/stdc++.h>
#include"debug.h"
#else
#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
#define D(...) ((void)0)
#endif
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
namespace FastIO
{
#define USE_FastIO
// ------------------------------
// #define DISABLE_MMAP
// ------------------------------
#if ( defined(LOCAL) || defined(_WIN32) ) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifdef LOCAL
inline void _chk_i() {}
inline char _gc_nochk() { return getchar(); }
inline char _gc() { return getchar(); }
inline void _chk_o() {}
inline void _pc_nochk(char c) { putchar(c); }
inline void _pc(char c) { putchar(c); }
template < int n > inline void _pnc_nochk(const char *c) { for ( int i = 0 ; i < n ; i++ ) putchar(c[i]); }
#else
#ifdef DISABLE_MMAP
inline constexpr int _READ_SIZE = 1 << 18; inline static char _read_buffer[_READ_SIZE + 40], *_read_ptr = nullptr, *_read_ptr_end = nullptr; static inline bool _eof = false;
inline void _chk_i() { if ( __builtin_expect(!_eof, true) && __builtin_expect(_read_ptr_end - _read_ptr < 40, false) ) { int sz = _read_ptr_end - _read_ptr; if ( sz ) memcpy(_read_buffer, _read_ptr, sz); char *beg = _read_buffer + sz; _read_ptr = _read_buffer, _read_ptr_end = beg + fread(beg, 1, _READ_SIZE, stdin); if ( __builtin_expect(_read_ptr_end != beg + _READ_SIZE, false) ) _eof = true, *_read_ptr_end = EOF; } }
inline char _gc_nochk() { return __builtin_expect(_eof && _read_ptr == _read_ptr_end, false) ? EOF : *_read_ptr++; }
inline char _gc() { _chk_i(); return _gc_nochk(); }
#else
#include<sys/mman.h>
#include<sys/stat.h>
inline static char *_read_ptr = (char *)mmap(nullptr, [] { struct stat s; return fstat(0, &s), s.st_size; } (), 1, 2, 0, 0);
inline void _chk_i() {}
inline char _gc_nochk() { return *_read_ptr++; }
inline char _gc() { return *_read_ptr++; }
#endif
inline constexpr int _WRITE_SIZE = 1 << 18; inline static char _write_buffer[_WRITE_SIZE + 40], *_write_ptr = _write_buffer;
inline void _chk_o() { if ( __builtin_expect(_write_ptr - _write_buffer > _WRITE_SIZE, false) ) fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout), _write_ptr = _write_buffer; }
inline void _pc_nochk(char c) { *_write_ptr++ = c; }
inline void _pc(char c) { *_write_ptr++ = c, _chk_o(); }
template < int n > inline void _pnc_nochk(const char *c) { memcpy(_write_ptr, c, n), _write_ptr += n; }
inline struct _auto_flush { inline ~_auto_flush() { fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout); } } _auto_flush;
#endif
#define println println_ // don't use C++23 std::println
template < class T > inline constexpr bool _is_signed = numeric_limits < T >::is_signed;
template < class T > inline constexpr bool _is_unsigned = numeric_limits < T >::is_integer && !_is_signed < T >;
#if __SIZEOF_LONG__ == 64
template <> inline constexpr bool _is_signed < __int128 > = true;
template <> inline constexpr bool _is_unsigned < __uint128_t > = true;
#endif
inline bool _isgraph(char c) { return c >= 33; }
inline bool _isdigit(char c) { return 48 <= c && c <= 57; } // or faster, remove c <= 57
constexpr struct _table {
#ifndef LOCAL
int i[65536];
#endif
char o[40000]; constexpr _table() :
#ifndef LOCAL
i{},
#endif
o{} {
#ifndef LOCAL
for ( int x = 0 ; x < 65536 ; x++ ) i[x] = -1; for ( int x = 0 ; x <= 9 ; x++ ) for ( int y = 0 ; y <= 9 ; y++ ) i[x + y * 256 + 12336] = x * 10 + y;
#endif
for ( int x = 0 ; x < 10000 ; x++ ) for ( int y = 3, z = x ; ~y ; y-- ) o[x * 4 + y] = z % 10 + 48, z /= 10; } } _table;
template < class T, int digit > inline constexpr T _pw10 = 10 * _pw10 < T, digit - 1 >;
template < class T > inline constexpr T _pw10 < T, 0 > = 1;
inline void read(char &c) { do c = _gc(); while ( !_isgraph(c) ); }
inline void read_cstr(char *s) { char c = _gc(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) *s++ = c, c = _gc(); *s = 0; }
inline void read(string &s) { char c = _gc(); s.clear(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) s.push_back(c), c = _gc(); }
template < class T, bool neg >
#ifndef LOCAL
__attribute__((no_sanitize("undefined")))
#endif
inline void _read_int_suf(T &x) { _chk_i(); char c; while
#ifndef LOCAL
( ~_table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)] ) if constexpr ( neg ) x = x * 100 - _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; else x = x * 100 + _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; if
#endif
( _isdigit(c = _gc_nochk()) ) if constexpr ( neg ) x = x * 10 - ( c & 15 ); else x = x * 10 + ( c & 15 ); }
template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ) if ( c == 45 ) { _read_int_suf < T, true >(x = -( _gc_nochk() & 15 )); return; } _read_int_suf < T, false >(x = c & 15); }
template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ); _read_int_suf < T, false >(x = c & 15); }
inline void write(bool x) { _pc(x | 48); }
inline void write(char c) { _pc(c); }
inline void write_cstr(const char *s) { while ( *s ) _pc(*s++); }
inline void write(const string &s) { for ( char c : s ) _pc(c); }
template < class T, bool neg, int digit > inline void _write_int_suf(T x) { if constexpr ( digit == 4 ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _write_int_suf < T, neg, digit / 2 >(x / _pw10 < T, digit / 2 >), _write_int_suf < T, neg, digit / 2 >(x % _pw10 < T, digit / 2 >); }
template < class T, bool neg, int digit > inline void _write_int_pre(T x) { if constexpr ( digit <= 4 ) if ( digit >= 3 && ( neg ? x <= -100 : x >= 100 ) ) if ( digit >= 4 && ( neg ? x <= -1000 : x >= 1000 ) ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _pnc_nochk < 3 >(_table.o + ( neg ? -x : x ) * 4 + 1); else if ( digit >= 2 && ( neg ? x <= -10 : x >= 10 ) ) _pnc_nochk < 2 >(_table.o + ( neg ? -x : x ) * 4 + 2); else _pc_nochk(( neg ? -x : x ) | 48); else { constexpr int cur = 1 << __lg(digit - 1); if ( neg ? x <= -_pw10 < T, cur > : x >= _pw10 < T, cur > ) _write_int_pre < T, neg, digit - cur >(x / _pw10 < T, cur >), _write_int_suf < T, neg, cur >(x % _pw10 < T, cur >); else _write_int_pre < T, neg, cur >(x); } }
template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void write(T x) { if ( x >= 0 ) _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x); else _pc_nochk(45), _write_int_pre < T, true, numeric_limits < T >::digits10 + 1 >(x); _chk_o(); }
template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void write(T x) { _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x), _chk_o(); }
template < size_t N, class ...T > inline void _read_tuple(tuple < T... > &x) { read(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _read_tuple < N + 1, T... >(x); }
template < size_t N, class ...T > inline void _write_tuple(const tuple < T... > &x) { write(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _pc(32), _write_tuple < N + 1, T... >(x); }
template < class ...T > inline void read(tuple < T... > &x) { _read_tuple < 0, T... >(x); }
template < class ...T > inline void write(const tuple < T... > &x) { _write_tuple < 0, T... >(x); }
template < class T1, class T2 > inline void read(pair < T1, T2 > &x) { read(x.first), read(x.second); }
template < class T1, class T2 > inline void write(const pair < T1, T2 > &x) { write(x.first), _pc(32), write(x.second); }
template < class T > inline auto read(T &x) -> decltype(x.read(), void()) { x.read(); }
template < class T > inline auto write(const T &x) -> decltype(x.write(), void()) { x.write(); }
template < class T1, class ...T2 > inline void read(T1 &x, T2 &...y) { read(x), read(y...); }
template < class ...T > inline void read_cstr(char *x, T *...y) { read_cstr(x), read_cstr(y...); }
template < class T1, class ...T2 > inline void write(const T1 &x, const T2 &...y) { write(x), write(y...); }
template < class ...T > inline void write_cstr(const char *x, const T *...y) { write_cstr(x), write_cstr(y...); }
template < class T > inline void print(const T &x) { write(x); }
inline void print_cstr(const char *x) { write_cstr(x); }
template < class T1, class ...T2 > inline void print(const T1 &x, const T2 &...y) { write(x), _pc(32), print(y...); }
template < class ...T > inline void print_cstr(const char *x, const T *...y) { write_cstr(x), _pc(32), print_cstr(y...); }
inline void println() { _pc(10); }
inline void println_cstr() { _pc(10); }
template < class ...T > inline void println(const T &...x) { print(x...), _pc(10); }
template < class ...T > inline void println_cstr(const T *...x) { print_cstr(x...), _pc(10); }
} using FastIO::read, FastIO::read_cstr, FastIO::write, FastIO::write_cstr, FastIO::println, FastIO::println_cstr;
template < auto P_ > class MontgomeryModInt
{
using S = decltype(P_); static_assert(is_same_v < S, int > || is_same_v < S, long > || is_same_v < S, long long >);
static_assert(P_ & 1 && 0 < P_ && P_ < ( (S)1 << ( sizeof(S) * 8 - 2 ) ));
using U = conditional_t < is_same_v < S, int >, unsigned, unsigned long long >; using D = conditional_t < is_same_v < S, int >, unsigned long long, __uint128_t >;
inline constexpr static U uinv(U x) { U y = x; for ( int i = is_same_v < S, int > ? 4 : 5 ; i-- ; ) y *= 2 - x * y; return y; }
constexpr static U P = P_, P2 = P << 1, R = -uinv(P), R2 = -(D)P % P; static_assert(P * R == -1);
inline constexpr static U reduce(D x) { return ( x + (U)x * R * (D)P ) >> ( sizeof(U) * 8 ); }
inline constexpr MontgomeryModInt(U x, int) : v(x) {} U v;
public:
inline constexpr static S mod() { return P; }
inline constexpr MontgomeryModInt() : v(0) {}
inline constexpr MontgomeryModInt(const MontgomeryModInt &x) : v(x.v) {}
template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr MontgomeryModInt(T x) : v(reduce((D)R2 * ( numeric_limits < T >::is_signed && x < 0 ? ( ( x + P < 0 ) && ( x %= P ), x + P ) : ( ( sizeof(T) > sizeof(U) && x >= (T)1 << sizeof(U) ) && ( x %= P ), x ) ))) {}
inline constexpr S val()const { U x = reduce(v); return ( x - P ) >> ( sizeof(U) * 8 - 1 ) ? x : x - P; }
template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > explicit inline constexpr operator T()const { return val(); }
inline constexpr friend bool operator==(const MontgomeryModInt &x, const MontgomeryModInt &y) { return x.val() == y.val(); }
inline constexpr friend bool operator!=(const MontgomeryModInt &x, const MontgomeryModInt &y) { return x.val() != y.val(); }
inline constexpr MontgomeryModInt &operator=(const MontgomeryModInt &x) & { v = x.v; return *this; }
inline constexpr MontgomeryModInt &operator++() & { return *this += 1; }
inline constexpr MontgomeryModInt operator++(int) & { MontgomeryModInt x = *this; *this += 1; return x; }
inline constexpr MontgomeryModInt &operator--() & { return *this -= 1; }
inline constexpr MontgomeryModInt operator--(int) & { MontgomeryModInt x = *this; *this -= 1; return x; }
inline constexpr MontgomeryModInt operator-()const { return MontgomeryModInt(v ? P2 - v : 0, 0); }
inline constexpr MontgomeryModInt &operator+=(const MontgomeryModInt &x) & { v += x.v, ( v - P2 ) >> ( sizeof(U) * 8 - 1 ) || ( v -= P2 ); return *this; }
inline constexpr MontgomeryModInt &operator-=(const MontgomeryModInt &x) & { v -= x.v, v >> ( sizeof(U) * 8 - 1 ) && ( v += P2 ); return *this; }
inline constexpr MontgomeryModInt &operator*=(const MontgomeryModInt &x) & { v = reduce((D)v * x.v); return *this; }
inline constexpr MontgomeryModInt &operator/=(const MontgomeryModInt &x) & { return *this *= x.inv(); }
inline constexpr friend MontgomeryModInt operator+(MontgomeryModInt x, const MontgomeryModInt &y) { return x += y; }
inline constexpr friend MontgomeryModInt operator-(MontgomeryModInt x, const MontgomeryModInt &y) { return x -= y; }
inline constexpr friend MontgomeryModInt operator*(MontgomeryModInt x, const MontgomeryModInt &y) { return x *= y; }
inline constexpr friend MontgomeryModInt operator/(MontgomeryModInt x, const MontgomeryModInt &y) { return x /= y; }
template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr MontgomeryModInt qpow(T y)const { MontgomeryModInt x = *this, z = 1; while ( y ) { if ( y & 1 ) z *= x; if ( y >>= 1 ) x *= x; } return z; }
template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr friend MontgomeryModInt qpow(const MontgomeryModInt &x, T y) { return x.qpow(y); }
inline constexpr MontgomeryModInt inv()const { return qpow(P - 2); }
inline constexpr friend MontgomeryModInt inv(const MontgomeryModInt &x) { return x.inv(); }
inline friend istream &operator>>(istream &is, MontgomeryModInt &x) { S y; is >> y, x = y; return is; }
inline friend ostream &operator<<(ostream &os, const MontgomeryModInt &x) { return os << x.val(); }
#ifdef USE_FastIO
inline void read() & { S x; ::read(x), *this = x; }
inline void write()const { ::write(val()); }
#endif
}; using MI = MontgomeryModInt < 1000000007 >; // 1000000007 1145141919810000037
constexpr int N = 300;
int n, m, q, x, y, z; char s[309]; MI dp[309][309][4], dq[309][309][4], res[309][309][309];
int main()
{
read(n, q), read_cstr(s + 1), ***dp = 1;
For(i, 1, n)
{
For(j, 0, m) For(k, 0, m - j) copy(dp[j][k], dp[j][k] + 4, dq[j][k]),
fill(dp[j][k], dp[j][k] + 4, 0);
For(j, 0, m) For(k, 0, m - j) For(p, 0, 3) if ( dq[j][k][p] )
if ( s[i] != '?' ) { if ( p != s[i] - 'a' + 1 ) dp[j][k][s[i] - 'a' + 1] += dq[j][k][p]; }
else For(q, 1, 3) if ( p != q ) dp[j + ( q == 1 )][k + ( q == 2 )][q] += dq[j][k][p];
m += s[i] == '?';
}
For(i, 0, m) For(j, 0, m - i) res[i][j][m - i - j] = accumulate(dp[i][j], dp[i][j] + 4, MI(0));
For(i, 1, N) For(j, 0, N) For(k, 0, N) res[i][j][k] += res[i - 1][j][k];
For(i, 0, N) For(j, 1, N) For(k, 0, N) res[i][j][k] += res[i][j - 1][k];
For(i, 0, N) For(j, 0, N) For(k, 1, N) res[i][j][k] += res[i][j][k - 1];
while ( q-- ) read(x, y, z), println(res[x][y][z]);
return 0;
}
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 60ms
memory: 118532kb
input:
6 3 a?b??c 2 2 2 1 1 1 1 0 2
output:
3 1 1
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 57ms
memory: 116516kb
input:
6 3 ?????? 2 2 2 2 3 3 3 3 3
output:
30 72 96
result:
ok 3 lines
Test #3:
score: 0
Accepted
time: 62ms
memory: 116308kb
input:
1 1 ? 0 1 1
output:
2
result:
ok single line: '2'
Test #4:
score: 0
Accepted
time: 52ms
memory: 116440kb
input:
10 10 acab?cbaca 0 2 0 1 1 2 4 2 3 1 1 1 3 5 1 0 5 2 2 2 0 1 2 5 4 3 0 1 1 3
output:
0 1 1 1 1 0 1 1 1 1
result:
ok 10 lines
Test #5:
score: 0
Accepted
time: 60ms
memory: 118348kb
input:
10 10 ?c?c?cbac? 10 5 1 5 8 7 9 2 6 5 7 1 5 2 6 5 6 5 5 10 3 9 1 10 2 5 9 1 2 9
output:
16 16 11 16 11 16 16 5 11 0
result:
ok 10 lines
Test #6:
score: 0
Accepted
time: 66ms
memory: 118404kb
input:
50 100 ?abacbacab?cbcbcb?acabcbabcbcacbababc?caba?acacbca 8 3 8 2 4 8 8 7 3 0 9 2 10 8 7 7 6 5 4 10 2 6 9 3 3 6 6 9 10 8 2 5 8 8 1 0 3 5 0 1 0 6 5 0 8 6 5 5 1 7 9 7 7 10 4 7 5 6 6 4 10 1 2 4 1 7 10 0 8 7 6 3 1 9 1 4 7 2 8 4 0 8 6 1 5 10 4 5 8 2 5 8 4 4 5 9 5 2 1 1 10 9 4 10 1 8 4 3 8 9 9 8 0 1 0 8 0...
output:
8 8 8 0 8 8 6 8 8 8 8 0 0 0 1 8 4 8 8 8 2 4 1 8 1 6 0 2 8 6 8 8 1 4 2 8 8 0 0 8 2 0 8 8 8 4 8 8 8 8 2 0 0 4 8 8 1 8 7 6 7 0 8 8 8 0 4 7 8 4 0 8 0 4 8 8 8 7 8 4 7 2 8 8 8 0 2 2 8 8 8 4 4 0 8 0 8 8 1 1
result:
ok 100 lines
Test #7:
score: 0
Accepted
time: 52ms
memory: 118640kb
input:
50 100 b????????bca?????c?b??ca?acac?b?b???ca?ab???a?a??? 35 43 36 12 49 47 7 11 34 38 44 22 42 17 10 49 8 38 18 26 44 6 18 14 28 29 6 48 32 47 29 15 48 1 5 33 24 17 18 10 27 32 19 10 34 2 23 9 14 24 39 46 12 34 9 49 26 21 8 46 43 43 3 31 16 2 8 27 7 24 41 35 17 25 31 0 13 47 24 31 23 33 40 30 36 39...
output:
34272000 31599360 497244 34272000 17637520 12290752 34272000 93044 415832 34272000 34272000 0 34272000 16360704 27933952 0 34272000 33886976 7896832 12290752 718 24 0 34272000 34272000 0 34272000 34272000 34272000 32254720 0 5666944 34256640 34272000 34272000 12290752 30493248 34256640 20630016 0 10...
result:
ok 100 lines
Test #8:
score: 0
Accepted
time: 52ms
memory: 116344kb
input:
100 1000 c?cbababcabacbacbacacbacabcbabababacababcbcab?cbabacbacbcbcacbab?bcabcbcababcacbabacbcb?babcbab?baca 13 11 4 4 17 20 14 5 2 16 14 15 8 12 17 19 5 11 5 17 12 20 7 6 19 10 1 6 5 0 13 1 9 7 17 1 20 4 16 11 12 18 19 2 16 18 1 11 19 16 3 7 1 0 6 9 16 6 9 16 6 20 7 0 16 20 1 2 8 16 5 20 18 14 18 ...
output:
16 15 14 16 16 16 16 16 8 2 16 8 16 16 16 16 16 2 16 16 16 0 1 16 16 5 1 5 16 16 16 16 16 15 16 13 16 15 2 16 16 1 8 16 16 16 15 0 16 15 16 16 16 16 8 8 16 16 16 16 16 16 8 16 16 1 8 8 16 16 1 16 1 0 16 2 2 16 7 16 16 8 16 16 16 16 1 16 14 16 16 16 16 5 16 16 14 16 11 16 15 11 2 1 8 16 16 7 16 5 16 ...
result:
ok 1000 lines
Test #9:
score: 0
Accepted
time: 59ms
memory: 117204kb
input:
100 1000 ?????c??????????????????????????b???a????a?????????????????????????c???????????????????????????????? 43 38 20 27 40 32 39 27 33 28 50 43 50 3 46 38 46 14 42 48 10 45 25 28 49 10 49 38 17 42 41 49 22 41 18 44 46 47 25 17 44 35 34 43 22 47 42 32 32 44 40 36 41 24 45 38 45 49 44 18 42 34 32 43...
output:
490475656 143989836 119661929 707864467 10104 219100551 479284703 764218529 903846231 659694548 204287063 105920502 191779504 182802705 215438611 938692318 797581204 903917420 893995828 287222624 578695829 95654849 457810426 709349795 85961844 923330494 783007506 111119718 295402274 241594071 551680...
result:
ok 1000 lines
Test #10:
score: 0
Accepted
time: 67ms
memory: 118680kb
input:
100 1000 c???cacacbcab?cb?acb???ac?bab?bcbcbc?c?bcbcaba??b?ba?c?aca?a?bac?cbcbcba??ca?b????ac?baba?ab?cba?c?c 99 70 32 52 98 84 12 78 77 84 8 87 16 36 0 48 70 100 25 4 15 95 54 35 33 35 90 20 4 69 6 11 76 27 96 48 16 24 18 99 48 1 43 54 35 9 81 75 27 58 52 50 94 14 29 67 27 59 68 53 42 31 46 12 90 2...
output:
380160 380160 226896 64156 0 380160 92 380160 380160 92 0 380160 379648 0 380160 22500 380160 380160 380160 380160 380160 226896 380160 380160 226896 0 380160 380160 380160 380160 152672 380160 5624 226896 380160 380160 379648 0 380160 380160 366848 380160 226896 380160 92 374912 5624 380160 380160 ...
result:
ok 1000 lines
Test #11:
score: 0
Accepted
time: 56ms
memory: 117204kb
input:
300 100000 abcacacbabacbcababcacacb?babacbcbacbcababcbcbabcacbcbacacabacacacbacbcbcacbabacbcbcbabcacbababcabcabcabababacbcacbacabcbacbacacacbababababacbcababcbcacacbcbabacabcabababcabacbcbcbabcabacbabacacbcbcacacacbcabcbabcbcabababababcacabcabababcbcbcbcbcabacbabacbabcacbcababacacbcbababababcacacaba...
output:
1 2 2 2 2 1 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 1 2 2 2 2 1 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 100000 lines
Test #12:
score: 0
Accepted
time: 55ms
memory: 117276kb
input:
300 100000 bcacbacacabacacbacacbabcabcacabcabcbcaba?cacbabcbacbabcbacacabacabcbacabcacacbcbabcbcabcabacbacbacabacabababcbcbcbabcbacbacabcacacabacbcbababcbcabacbabcbabacabcbabcbababababcbcbabacbacacbcabcabcbcbcbcabacabacacacbcbacabacbabca?acacbcacacbcbabacbcbcabca?babcacbc?acbacabacbcbcbcbacabababacb...
output:
4 4 4 4 0 4 4 4 4 4 4 4 4 4 0 1 3 3 4 4 4 1 4 0 4 0 4 4 4 4 4 4 4 0 4 1 1 4 4 0 4 3 4 4 4 4 4 4 4 3 4 1 1 3 4 0 4 4 3 4 4 4 4 4 4 4 4 4 4 0 4 4 4 3 4 3 4 4 4 1 4 3 0 4 4 4 4 4 0 4 0 4 4 4 4 1 4 4 4 4 4 0 1 4 4 1 4 0 4 3 4 0 4 3 1 0 4 4 1 1 4 4 4 3 4 4 4 3 0 4 1 4 4 4 0 4 4 4 4 1 0 4 1 0 4 4 4 4 4 4 ...
result:
ok 100000 lines
Test #13:
score: 0
Accepted
time: 64ms
memory: 117804kb
input:
300 100000 bcbabcab?bab??acacbcabacbacbcacacbabcab?bcbcb?bababcabcabcabca?abcbc?bcacacb?abababcbcbcbcbaba?cba?abcabc?ababacbcbc?acbabcacacbabcab?ca?b?babcbacbacbcbcbacbc?c?cababcacbc?bcbcabcacbabc?acbabcbacac?cbcb?abcbabacabcbacabcacababcbabcbcb??bacbcbacabc?cabacac?cab?cabacacbcacacbabacacabcab?bac...
output:
20336 14528 22504 24576 24576 16992 24576 24576 24576 0 24576 1500 24576 24576 24576 0 23592 7808 24576 0 24576 23592 24576 24576 0 640 24576 2576 24392 24576 624 24576 24576 0 8 24448 8 24576 104 0 24576 24576 24392 0 0 24576 24576 24576 0 24576 24392 24576 24576 24576 23488 24576 24576 24576 24448...
result:
ok 100000 lines
Test #14:
score: 0
Accepted
time: 65ms
memory: 119984kb
input:
300 100000 cbabacacabcaca?abcb?b??cbc??cbacb?acab?b?bcabc?a??bab?a?a?a?ca?acac????c?c?caba?a???bcab?ababababc??babacacacbacabcb?bab?bcab?bacb???ba???c?b?cb?bababac?cb??acacbcba?acaca??bacb?cbc?c?bcbcbab?ba?c??bacacab?b?b?ac??babcbcb?bcbcbcb?c?c?cbac?ba?a?abc?cab?bc?ca?abacaca?abc??ac?aca?a??ca?cac??...
output:
964413406 726709206 0 110704627 192317202 753035749 238645875 836077477 0 0 67075693 196248 337185872 684300992 551066954 512400928 894774207 441158600 632725062 60181080 460670453 301321033 206790308 549405433 258628038 0 719626090 0 800239318 716729053 580760175 749271169 414309213 431703326 12786...
result:
ok 100000 lines
Test #15:
score: 0
Accepted
time: 63ms
memory: 120224kb
input:
300 100000 cbacacacbcba??bc???ab??bca?acabcbcb?cac?babacbac?ba??cbcbac?cb?abacaca?ac?c?caba?ac?cabc?ba?cbaba??ba??abcabac?abab?cabcacbc?cab??aca?bc??babacacab?c?babcacacb?cba?ac?a?abacabcbcbcaca?ab?bcabababc??ababa?abc???acbacbabcac?a?acabcac?cbabac?bacab??c?a??babcbacac??aca?bcba?ab?bcbacbacbabab?b...
output:
868189535 868189535 0 868189535 495627643 0 868189535 929370324 868189535 868189535 1474560 0 0 868189535 868189535 868189535 688551450 868189535 868189535 0 868189535 868189535 868189535 868189535 9381984 868189535 868189535 868189535 868189535 20457120 868189535 868189535 635204610 868189535 86818...
result:
ok 100000 lines
Test #16:
score: 0
Accepted
time: 64ms
memory: 118488kb
input:
300 100000 cbac?cac?cbcbca?abacba?ac?acab????abaca?abcbcabc?c??acb???b?ac??bcb?cacacabac?b?bc?a?b?abcac??a?acacab?bacacab??ca?b?c?acacabcbacacbc?c?acbcabcaca?a?cb?a??abcacab?b?cacb??ac??c?a?bacb?bacbaba?a?bc?babca??bababcababcab?ba?cba??cb?b?abc?cbcab?ba?ca?bacb??ca?bcb??cacbcbca???cbac?bacbc?cac?bc...
output:
63065600 280135711 280135711 280135711 280135711 280135711 280135711 280135711 0 579883317 270080 280135711 0 280135711 280135711 539129922 280135711 280135711 539129922 0 280135711 280135711 280135711 0 280135711 270080 256 280135711 280135711 280135711 280135711 280135711 280135711 631211594 28013...
result:
ok 100000 lines
Test #17:
score: 0
Accepted
time: 91ms
memory: 120032kb
input:
300 100000 ??????a?a??c?c?????a??????????b???????????????????????????????????bc?b???????b????????c??????????a????????bc??a????????????c????a?????????????a?????b?????a????????c??ba????b?b???????????c?????????cbc?????????????????b???ab?b????ac?b??c??????c??a??ab???a?????b?????????a??b???????????ba????...
output:
356410997 164744264 978926692 879215541 267745269 399413378 667881560 356410997 818851047 356410997 989150636 266480908 0 356410997 303796242 234869176 137612115 356410997 0 24290767 273625930 411968196 567490332 356410997 0 356410997 807134302 646186244 356410997 356410997 577546772 527886169 35641...
result:
ok 100000 lines
Test #18:
score: 0
Accepted
time: 80ms
memory: 120416kb
input:
300 100000 ?a?????????????????b??b??ac?????????????????????b???????c??a??????c????????ac??a???a????a????c????????????bc?????b???c???ab?????????????????????c??????c?b???????a?a?????????c??b??c???b????a?c????????????????c?bc????b???????????b????????bc????c????????????????????a?????????c?????a?????????...
output:
421472289 555100087 555100087 880376766 555100087 0 0 931054200 106211865 993171009 555100087 486740217 555100087 0 555100087 190774849 555100087 336407512 0 0 655515061 555100087 0 309808634 992320113 362042447 0 461962238 830139091 238473131 555100087 0 555100087 555100087 992320113 555100087 1745...
result:
ok 100000 lines
Extra Test:
score: 0
Extra Test Passed