QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#141753 | #2135. How Many Strings Are Less | Gamal74# | TL | 1744ms | 138188kb | C++17 | 7.6kb | 2023-08-17 23:27:04 | 2023-08-17 23:27:05 |
Judging History
answer
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("Ofast,no-stack-protector", "omit-frame-pointer", "inline", "-ffast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,fma,popcnt,abm,mmx,avx")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
#define fi first
#define se second
#define pp push_back
#define all(x) (x).begin(), (x).end()
#define Ones(n) __builtin_popcount(n)
#define endl '\n'
#define mem(arrr, xx) memset(arrr,xx,sizeof arrr)
#define PI acos(-1)
//#define int long long
#define debug(x) cout << (#x) << " = " << x << endl
void Gamal() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifdef Clion
freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#endif
}
int dx[] = {+0, +0, -1, +1, +1, +1, -1, -1};
int dy[] = {-1, +1, +0, +0, +1, -1, +1, -1};
const int N = 1e6 + 5, M = 1e9 + 7;
int pw[2][N], inv[2][N], pre[2][N], P[2];
int mul(int a, int b) {
if(a < 0)a += M;
if(b < 0)b += M;
ll ret =1ll * a * b;
if(ret >= M)ret %= M;
return ret;
}
int add(int a, int b) {
if(a < 0)a += M;
if(b < 0)b += M;
int ret = a + b;
if(ret >= M)ret -= M;
return ret;
}
int fp(int b, int p) {
if (!p)return 1;
int ret = fp(b, p >> 1);
ret = mul(ret, ret);
if (p & 1)ret = mul(ret, b);
return ret;
}
void build() {
pw[0][0] = pw[1][0] = inv[0][0] = inv[1][0] = pre[0][0] = pre[1][0] = 1;
int in[2];
P[0] = 31, P[1] = 37;
in[0] = fp(P[0], M - 2);
in[1] = fp(P[1], M - 2);
for (int i = 1; i < N; ++i) {
for (int j = 0; j < 2; ++j) {
pw[j][i] = mul(pw[j][i - 1], P[j]);
inv[j][i] = mul(inv[j][i - 1], in[j]);
pre[j][i] = add(pre[j][i - 1], pw[j][i]);
}
}
}
struct Hash {
vector<pii> prefix;
Hash() {
}
Hash(string &s) {
prefix = vector<pii>(s.size(), {0, 0});
for (int i = 0; i < s.size(); ++i) {
prefix[i].fi = mul(s[i] - 'a' + 1, pw[0][i]);
prefix[i].se = mul(s[i] - 'a' + 1, pw[1][i]);
if (i) {
prefix[i].fi = add(prefix[i].fi, prefix[i - 1].fi);
prefix[i].se = add(prefix[i].se, prefix[i - 1].se);
}
}
}
pii getRange(int l,int r){
return {mul(add(prefix[r].fi,-(l ? prefix[l-1].fi:0)),inv[0][l]),
mul(add(prefix[r].se,-(l ? prefix[l-1].se:0)),inv[1][l])
};
}
};
struct SEG{
pii h={0,0};
int lz = -1;
SEG(){
}
SEG(pii hh){
h = hh;
}
};
struct segTree{
vector<SEG>seg;
int sz = 1,n,NO_OP = -1;
segTree(int nn){
n = nn;
while (sz < nn)
sz *= 2;
seg.assign(2 * sz,SEG());
}
SEG merge(SEG s1,SEG s2){
SEG ret;
ret.h.fi = add(s1.h.fi,s2.h.fi);
ret.h.se = add(s1.h.se,s2.h.se);
return ret;
}
void push(int x,int lx,int rx){
if(seg[x].lz == NO_OP)return;
seg[x].h.fi = mul(seg[x].lz, add(pre[0][rx],-(lx ? pre[0][lx-1]:0)));
seg[x].h.se = mul(seg[x].lz, add(pre[1][rx],-(lx ? pre[1][lx-1]:0)));
int lf = 2*x+1,rt=2*x+2;
if(lx != rx){
seg[lf].lz = seg[x].lz;
seg[rt].lz = seg[x].lz;
}
seg[x].lz = NO_OP;
}
void update(int l,int r,int v,int x,int lx,int rx){
push(x,lx,rx);
if(l > rx || r < lx)return;
if(l <= lx && r >= rx){
seg[x].lz = v;
push(x,lx,rx);
return;
}
int mid = (lx + rx)/2,lf = 2*x+1,rt=2*x+2;
update(l,r,v,lf,lx,mid);
update(l,r,v,rt,mid+1,rx);
seg[x] = merge(seg[lf],seg[rt]);
}
void update(int l,int r,int v){
update(l,r,v,0,0,n-1);
}
SEG query(int l,int r,int x,int lx,int rx){
push(x,lx,rx);
if(l <= lx && r >= rx)
return seg[x];
if(l > rx || r < lx)
return SEG();
int mid = (lx + rx)/2,lf = 2*x+1,rt=2*x+2;
return merge(query(l,r,lf,lx,mid), query(l,r,rt,mid+1,rx));
}
SEG query(int l,int r){
return query(l,r,0,0,n-1);
}
};
void solve() {
int n,q;cin >> n >> q;
string s;cin >> s;
vector<string>v(n);
vector<Hash>h(n);
for (int i = 0; i < n; ++i) {
cin >> v[i];
}
sort(all(v));
for (int i = 0; i < n; ++i) h[i] = Hash(v[i]);
int ptr = -1;
for (int i = 0; i < n; ++i) {
if(s > v[i])ptr = i;
else break;
}
segTree st(s.size());
for (int i = 0; i < s.size(); ++i) {
st.update(i,i,s[i] - 'a' + 1);
}
cout << ptr + 1 << endl;
while (q--){
int i;cin >> i;
char c;cin >> c;
i--;
// first i such that s[0,i-1] == v[0,i-1]
int l = 0,r = n - 1,match = (i ? -1:1);
if(i){
l = ptr + 1;
r = ptr;
int lx = 0,rx = max(ptr,0);
while (lx <= rx){
int mid = (lx + rx)/2;
if(v[mid].size() < i){
lx = mid + 1;
continue;
}
pii a = h[mid].getRange(0,i-1);
pii b = st.query(0,i-1).h;
if(a == b){
l = mid;
match = 1;
rx = mid - 1;
}
else lx = mid + 1;
}
lx = ptr+1,rx = n - 1;
while (lx <= rx){
int mid = (lx + rx)/2;
if(v[mid].size() < i){
rx = mid - 1;
continue;
}
pii a = h[mid].getRange(0,i-1);
pii b = st.query(0,i-1).h;
if(a == b){
match = 1;
r = mid;
lx = mid + 1;
}
else rx = mid - 1;
}
}
if(match != -1){
ptr = l - 1;
while (l <= r){
int mid = (l + r)/2;
int lx = 1,rx = min(s.size(),v[mid].size()) - i,f = -1;
while (lx <= rx){
int m2 = (lx + rx)/2;
pii a = h[mid].getRange(i,i+m2-1);
pii b = {mul(pre[0][m2-1], c - 'a' + 1), mul(pre[1][m2-1],c - 'a' + 1)};
if(a == b){
lx = m2 + 1;
}
else{
f = m2;
rx = m2 - 1;
}
}
if(~f){
if(v[mid][i+f-1] > c){
r = mid - 1;
}
else{
ptr = mid;
l = mid + 1;
}
}
else{
if(v[mid].size() >= s.size()){
r = mid - 1;
}
else{
ptr = mid;
l = mid + 1;
}
}
}
}
st.update(i,s.size()-1,c-'a'+1);
cout << ptr + 1 << endl;
}
}
signed main() {
Gamal();
build();
int t = 1;
// cin >> t;
while (t--) {
solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 9ms
memory: 27000kb
input:
4 3 anatoly boris anatooo anbbbbu anba 5 o 3 b 7 x
output:
0 0 2 3
result:
ok 4 number(s): "0 0 2 3"
Test #2:
score: 0
Accepted
time: 9ms
memory: 26984kb
input:
5 5 abcde buz ababa build a aba 1 b 3 z 2 u 4 z 1 a
output:
3 3 3 4 4 1
result:
ok 6 numbers
Test #3:
score: 0
Accepted
time: 10ms
memory: 27000kb
input:
1 1 abababababababababababab ababababababababababababab 23 b
output:
0 1
result:
ok 2 number(s): "0 1"
Test #4:
score: 0
Accepted
time: 4ms
memory: 26992kb
input:
4 100 b dd ds ss sd 1 d 1 s 1 s 1 d 1 s 1 s 1 s 1 s 1 s 1 d 1 s 1 s 1 d 1 d 1 s 1 d 1 d 1 d 1 s 1 d 1 s 1 d 1 s 1 s 1 d 1 d 1 d 1 d 1 s 1 s 1 d 1 s 1 s 1 d 1 d 1 s 1 s 1 s 1 s 1 s 1 s 1 s 1 d 1 d 1 s 1 d 1 s 1 s 1 s 1 s 1 d 1 s 1 s 1 s 1 s 1 s 1 s 1 s 1 d 1 d 1 s 1 d 1 s 1 s 1 d 1 d 1 d 1 d 1 s 1 d ...
output:
0 0 2 2 0 2 2 2 2 2 0 2 2 0 0 2 0 0 0 2 0 2 0 2 2 0 0 0 0 2 2 0 2 2 0 0 2 2 2 2 2 2 2 0 0 2 0 2 2 2 2 0 2 2 2 2 2 2 2 0 0 2 0 2 2 0 0 0 0 2 0 2 2 0 0 2 2 2 0 2 0 0 2 2 2 2 0 0 0 0 2 2 0 2 2 2 2 0 2 2 2
result:
ok 101 numbers
Test #5:
score: 0
Accepted
time: 1ms
memory: 27004kb
input:
10 10 lvv lvvl lll ll vvll vl vllvv vll vllvl llvl vv 2 l 1 l 3 v 1 v 1 v 3 l 3 l 1 l 2 v 1 v
output:
3 1 1 2 10 10 9 9 1 3 10
result:
ok 11 numbers
Test #6:
score: 0
Accepted
time: 7ms
memory: 26932kb
input:
20 20 ffffqqqfqq fffqfff fq qqfqff fqfqqqf fqfqf fqfffffqfq fqffffq qfffqqfq f qq f fffffqq q qqqqffffq qfqqqfff ffqff qqfqfqf qqfq qqqqfqqqf ffqqfffqf 8 f 5 q 8 f 2 q 2 f 3 f 6 f 4 q 2 f 10 f 9 q 10 q 2 q 10 f 5 f 6 f 5 f 7 f 6 f 3 q
output:
3 3 3 3 11 2 2 2 4 2 2 2 2 11 11 11 11 11 11 11 11
result:
ok 21 numbers
Test #7:
score: 0
Accepted
time: 1ms
memory: 26932kb
input:
4 100 enf gggppp ppggpg pggpgp gppgpg 2 g 2 p 2 p 3 p 1 p 1 g 3 p 1 g 3 p 2 g 3 g 2 p 3 p 3 p 3 p 3 p 2 g 3 g 1 g 2 p 1 g 3 p 1 p 1 p 1 g 2 g 2 g 1 g 1 p 3 g 1 g 3 p 1 g 2 g 1 g 3 g 1 p 3 p 1 p 2 g 2 g 2 g 1 p 3 p 1 p 2 g 2 g 2 p 2 p 2 g 2 p 2 p 2 p 1 g 2 p 1 g 3 p 2 g 3 g 1 g 2 g 1 g 1 p 2 p 1 g 3 ...
output:
0 0 0 0 0 4 0 1 0 1 0 0 1 1 1 1 1 0 0 0 1 0 1 4 4 0 0 0 0 4 3 0 1 0 0 0 0 4 4 4 2 2 2 4 4 4 2 2 4 4 2 4 4 4 0 1 0 1 0 0 0 0 0 4 4 0 1 0 1 0 1 0 0 4 3 4 4 4 4 2 0 0 1 0 0 0 0 1 0 1 0 1 1 1 0 0 1 1 0 1 4
result:
ok 101 numbers
Test #8:
score: 0
Accepted
time: 7ms
memory: 27000kb
input:
50 50 yyy iyiyiyyyiiii yiiiyyyiiiyi iiiiiiyyyyiiiyiyii yiyyiyyiiy yyyiiyiyiiyiiiyyyyiyy iiyyyyyiiiiiiiiyyiyiyii iy iiyiyiiii yyiiiiiyyyy yiyiyiiiiiyiyyyiiyiy iiiiiyyyy yyiiiiyiiiyyiiy iiyyiyyiyyiiyyyyiiiiyiiyiiyiyii iiiiyyyiiyii i iiyyyyyyiiyiyii iiyiiyyiyyyyyiiiiyiy yyiyiyyyyiiyyiiyyiyyiyi yyyiiyiy...
output:
45 45 22 22 45 45 45 45 2 45 37 22 22 22 33 22 22 22 22 33 45 2 2 45 45 45 45 45 45 45 45 45 37 45 45 45 37 45 2 2 19 45 37 45 37 45 45 2 2 7 7
result:
ok 51 numbers
Test #9:
score: 0
Accepted
time: 15ms
memory: 27000kb
input:
250 250 sbabbsb bsbbb asssaasbssa sbaabbabaasbabaaabasaasbbsabbaaasasbsbbbaabs sasasbbbbaassssabssaabasababssaaabaabssbsass b basasabbsbasaasbabsabbsabassbabssbasbbsaa ssbassbaasbsabssssssasbsassabsasbsbsbsaasbsb baabbsaabsbbassasasssbabsaaabababbsb sababssaabababaaa sbba basaassbbsbaaaasbssbbbsbsbb...
output:
203 203 201 209 2 8 2 4 2 2 48 48 42 138 2 13 13 13 13 13 13 13 13 48 48 2 13 29 24 24 29 29 21 21 90 250 249 250 209 209 209 209 209 209 209 250 242 242 250 250 249 209 213 171 171 209 209 209 209 209 209 171 250 2 2 29 16 21 21 14 14 2 8 8 8 48 48 48 90 90 76 2 2 6 2 16 29 27 29 2 13 29 29 29 29 2...
result:
ok 251 numbers
Test #10:
score: 0
Accepted
time: 19ms
memory: 32728kb
input:
2500 2500 xdwxxxdxwxdwdxdwwwwdwxdxdwwxdxwwdxxdwwwdxxxxxdddwwwxdwxdxxxdwdwxxwwwwxwxdxwxdxdxwdxdxxdwdwxwwxddwwxdddddxxxddxwwxwxwxddwwxdwdxwxdxwwxdddwxwxwwddxdxdddwxwdwwdwwdwwxwdw wwwwxwdxdxddwxwwdwwxxddxxw w wdxwxxxxwdwxdwdxxwwdxxxwwxwwxdwxwddddxwdwdxwdddxxdxddwwxddddxxxxdxwdwdwdxxxwdxwxxdwddwddwxwxww...
output:
1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1854 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1855 1254 1254 1254 1254 ...
result:
ok 2501 numbers
Test #11:
score: 0
Accepted
time: 114ms
memory: 32076kb
input:
10000 100000 bbbbjbbrrbjrjr brjbrbjbjbrbjrbrjrbjbjrrjjbrjrjbjjrjr bbjjbbjrbbbbrjjrbbbbrrbrjrbrbjjbbjbbbj jbbrjbjbjjbbbjbrbbrbjbbrrbrbrrbrrbjbjjjrbjrrrrrbjbbjrrjjbrjjrbrrrbb b jjbrjrjrrrjbbbrjjbjjjbrrbbjjjjjjbrrbjjbrrrjrrjrbjrrbbjbrjj jbjrbbrbjjjjbrbbrbjbrbjjbjrbbjjrjrbrjjbjjbbjjbbjjjbrbrrb jjrbbrbrr...
output:
91 91 90 90 90 90 91 91 91 91 99 99 5034 5034 5033 5045 5034 5034 5034 5034 5034 5034 59 59 59 59 59 59 59 59 60 10000 9999 8383 8383 8383 10000 5034 5034 3396 3511 4524 4524 4480 4482 4482 3396 3396 3413 3413 3413 3396 10000 9997 9997 9997 9997 9997 8889 8383 8383 8383 8390 7812 8383 8385 8383 8383...
result:
ok 100001 numbers
Test #12:
score: 0
Accepted
time: 45ms
memory: 30400kb
input:
31313 31313 plg pqgqgaglaal lag lagqgqppqap agpgglg aaaaglgpqg pap lggap llgaqqqpgpqg ppllllaqgaqg lalglplp al laglag aaq qalaapppg p lqg gpalqq apllpqqp qp qqgaqpgg lqqg qp qlgqagpgggg gagqaaqp lqllpplaalpl ag p qpppqaaal qppgqaalqaa lqql la qaglaa glpapqlagqlp aaaqagaqqql pggqgqlqlpq qlqggg g lagl...
output:
21893 8285 10985 10985 9667 23496 23496 20763 20975 31092 28391 31092 30496 30694 8285 10985 11197 16009 15597 16009 675 6114 5930 16009 31092 27062 26864 23496 23053 23496 24821 16009 18619 13220 31092 29755 16009 16009 16009 18619 18418 18005 16009 17331 18619 14635 14635 15280 8285 8716 8285 675 ...
result:
ok 31314 numbers
Test #13:
score: 0
Accepted
time: 162ms
memory: 53448kb
input:
313131 131313 ysy ys gsg i g s isi i i yia say g ig ig aai a ag aga ig ag ya gyi is agy g yi gg gga ia ag yy ggg sa y sgs aa gai i i s ia aii sag si a a i a i iig sss i ig gys gg i igy y gg gg ya yaa aii yi ss iag say siy iy gss gi y a sy g aa ai si a as ia iyg sy sga gs sis ys iyy iya s g y ii sis ...
output:
304123 312262 312262 275523 303314 303314 312262 275523 276335 293975 312262 303314 302486 25081 61655 58283 58283 43370 43370 61655 43370 52466 25081 25887 312262 284732 285545 284732 240474 240474 312262 96576 240474 239617 238827 237997 212894 240474 240474 240474 96576 124117 87296 240474 240474...
result:
ok 131314 numbers
Test #14:
score: 0
Accepted
time: 442ms
memory: 112596kb
input:
1000000 1000000 s v c g g w q p o x b r q t l w a e v a d i i u i b m x d x p f d d h j o p y x r h d w n w z i z r j w j j y s m j e z k m p j k o h d z i k h w k h v i r b z x a v b y r a h y z v l u z y e e s z z w p t d b h b h m q v b e f d r q t n i t u f q h p d m x b k k d z c l q w o x b j ...
output:
692520 807920 769459 538901 884904 500731 269604 538901 192697 38637 500731 154156 731303 423808 846522 231505 154156 654155 347013 846522 731303 76958 769459 115440 961752 884904 385537 884904 115440 154156 385537 731303 423808 615645 38637 231505 347013 192697 192697 231505 500731 385537 807920 19...
result:
ok 1000001 numbers
Test #15:
score: 0
Accepted
time: 1407ms
memory: 43932kb
input:
149439 1000000 pkmzs zmzmzsp zspzzmz msszk szkmsk mpspkk kzzspzs kkspmss kkskmpp pkksk szsmkpk kpppspp kppzks skkmksp kzzspsm pkpkksp kkkpzzs kzssmkm psspsz smskk kzssmsp mszkppk kzpskzp kmmpsks pzkzzks pkppmkk mmszspz kmpkmpm mkkpsmp kmkzmpz kzzpskz zk kkppspk mmmkmzk zmssmp zzpkmk pkzzzpp ssskpmz ...
output:
69506 45944 60867 60650 9 18393 20218 19522 19575 45944 66612 66179 66101 85024 94244 90581 149402 137913 140215 139531 139642 9 27575 22131 23213 23090 18393 22063 21834 85024 88696 87275 87398 149402 126424 127297 127154 9 9187 14606 13568 13511 120639 114893 116035 116260 116187 45944 53708 51904...
result:
ok 1000001 numbers
Test #16:
score: 0
Accepted
time: 503ms
memory: 61800kb
input:
2 1000000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...
result:
ok 1000001 numbers
Test #17:
score: 0
Accepted
time: 1266ms
memory: 34324kb
input:
10 1000000 oopppooopppopppoppppppooooppopopoooopopoooopopopooopoopopooooopopooppppppoppoppppoppoooopoppoooppppppoopppppoopppooppppopopppoppppopoopppopppopoopopopppopopopopppopoppoppoppppoppopoppooooppppoppppppoopopoooppoopppoppopopoooopppoopopooppoooopopppopooooooopppoppoopppopoopoppoooopooooooooppp...
output:
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
result:
ok 1000001 numbers
Test #18:
score: 0
Accepted
time: 1568ms
memory: 35364kb
input:
1000 1000000 abbacbaacaaabcacaaaaabaacbbaccaaabbbbbcbccbccbabacbaabbbaccbcccaaacaaabbaaccacaacbaaabbaabbaaababaabcbbcabacabaaabaaccbaabbaaaccbccbcacabbaaabbccbbcbcaccaaacabccbaabcccacaabbbacaccaaabcccbaaacbabcaacbbcabacccbcbcaabcccbaaabacacbbbcbbcabcacbcaacccaaccccbcabbbcbbbaabbbbbabbcabbabcccacabac...
output:
163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 163 518 518 ...
result:
ok 1000001 numbers
Test #19:
score: 0
Accepted
time: 1744ms
memory: 38064kb
input:
10 1000000 nncegllennegglnnnncegglcclnclenlclellccegncecgeclgnceneclcggcengnccgllclellnenenleclcccgcncngggecllnncclnglgclenlllegeccelceenenlgeggegccecclcellcegelnceclnnleclgccngnlcglcelnncglelncggglngngnlncgnnnnnccngggggnnlcglgccnlgccclccgegceeengnlgllcegcenlnccneeceelelggcncgglegcglcnnggeecglllcnec...
output:
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...
result:
ok 1000001 numbers
Test #20:
score: 0
Accepted
time: 703ms
memory: 138188kb
input:
1000000 1000000 wkpyxmddcfihtnzoegjcvruaumlubmhtuixffgmvvxgvspwownkxgetbgtkyjrpzkljighfgylsgtqpmqcidyziwbzimkgwrcewpvvipevpmrsoshbwmzremlgkwiohbmuamoppwcumugrnepoimbiythrheuvefysdufmxxfihkuagsroeqrbcgiltopbbpaoadimmfwomsdwxrzhndkumwumnuzvyrgfuyjxrzngoeqvittaofqffbjgenlrfpehpxqkourigwezsupwgezoezeiih...
output:
885453 616176 654910 885453 1000000 116603 769903 116603 38835 577427 424613 654910 961627 77639 577427 922907 309036 885453 693433 922907 922907 846835 961627 808537 808537 463126 808537 808537 232316 270910 270910 232316 232316 539535 193602 922907 922907 732206 961627 77639 808537 347163 732206 1...
result:
ok 1000001 numbers
Test #21:
score: -100
Time Limit Exceeded
input:
333260 1000000 mrgtctwkddutibjhvuwpuklnxlnigsvrdnjvtrugqtetaaytiyzkqabszexxykquungfunqdqswcakgvndxtvxnhytpezspgfhnveyyjhhlmgvvtmysnzppyedqkaxraeadzlxvwutikayiytxrxplnlhzlduasejekeltoqgumtswoywudajbwxfpdktjkgcmvbifskdmkfoltojmmctvylxjhsxkmrkevmvlwppmlgvsrjougntryxajxppmhkimexpqnhrygzviidkgknjvvpozkdo...
output:
163822 122219 125709 125598 125600 306830 302680 302574 302574 188237 189665 189536 293410 289209 289065 4121 11331 148277 150910 150899 280299 333260 161460 17362 17818 240757 241352 266805 306830 304509 161460 122219 126701 69855 71701 280299 333260 200984 333260 214297 207116 207192 253646 254380...