QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#758213#9558. The Devilhos_lyricAC ✓845ms449564kbC++145.2kb2024-11-17 16:48:252024-11-17 16:48:26

Judging History

你现在查看的是最新测评结果

  • [2024-11-17 16:48:26]
  • 评测
  • 测评结果:AC
  • 用时:845ms
  • 内存:449564kb
  • [2024-11-17 16:48:25]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


namespace bm {
constexpr int LIM_N0 = 130 * 130;
constexpr int LIM_N1 = 130;
int n0, n1;
bitset<LIM_N1> adj[LIM_N0];
int to[LIM_N0], fr[LIM_N1];
int zeit, used[LIM_N0];
void init(int n0_, int n1_) {
  n0 = n0_; n1 = n1_;
  for (int u = 0; u < n0; ++u) adj[u].reset();
}
void ae(int u, int v) {
  adj[u].set(v);
}
int augment(int u) {
  used[u] = zeit;
  for (int v = 0; v < n1; ++v) if (adj[u][v]) {
    const int w = fr[v];
    if (!~fr[v] || (used[w] != zeit && augment(w))) {
      to[u] = v; fr[v] = u; return 1;
    }
  }
  return 0;
}
int run() {
  memset(to, ~0, n0 * sizeof(int));
  memset(fr, ~0, n1 * sizeof(int));
  memset(used, ~0, n0 * sizeof(int));
  int tof = 0;
  for (zeit = 0; zeit < n0; ++zeit) tof += augment(zeit);
  return tof;
}
}  // namespace bm


constexpr int MAX_U = 130 * 130 * 130;
constexpr int A = 52;
int tr(char c) {
  return isupper(c) ? (0 + (c - 'A')) : (26 + (c - 'a'));
}
char rt(int a) {
  return (a < 26) ? ('A' + (a - 0)) : ('a' + (a - 26));
}

int U;
int nxt[MAX_U][A];
pair<int, int> prv[MAX_U];
int zeit, used[MAX_U];
int newNode() {
  assert(U < MAX_U);
  const int u = U++;
  fill(nxt[u], nxt[u] + A, -1);
  used[u] = 0;
  return u;
}
int go(int u, int a) {
  int &v = nxt[u][a];
  if (!~v) {
    v = newNode();
    prv[v] = make_pair(u, a);
  }
  return v;
}
void init() {
  U = 0;
  zeit = 0;
  newNode();
}
string str(int u) {
  string ret;
  for (; u; ) {
    const int p = prv[u].first;
    const int a = prv[u].second;
    ret += rt(a);
    u = p;
  }
  reverse(ret.begin(), ret.end());
  return ret;
}


char buf[130 * 130];
char *readln() {
  return fgets(buf, sizeof(buf), stdin);
}

int N;
vector<vector<string>> S;

int main() {
  for (; readln(); ) {
    N = atoi(buf);
    S.assign(N, {});
    for (int i = 0; i < N; ++i) {
      readln();
      istringstream iss(buf);
      for (string s; iss >> s; S[i].push_back(s)) {}
    }
// cerr<<"S = "<<S<<endl;
    
    init();
    // (depth, u)
    vector<vector<pair<int, int>>> graph(N);
    for (int i = 0; i < N; ++i) {
      const int lim = (int)S[i].size() + N + 1;
      // depth -> u
      vector<vector<int>> uss(lim);
      uss[0].push_back(0);
      for (const string &s : S[i]) {
        ++zeit;
        int cnt = 0;
        vector<vector<int>> vss(lim);
        // (node, pos in s)
        vector<pair<int, int>> ps;
        for (int d = 0; d < lim; ++d) {
          for (const int u : uss[d]) ps.emplace_back(u, 0);
          vector<pair<int, int>> qs;
          for (const auto &p : ps) if (p.second < (int)s.size()) {
            const int v = go(p.first, tr(s[p.second]));
            if (used[v] != zeit) {
              used[v] = zeit;
              assert(d + 1 < lim);
              vss[d + 1].push_back(v);
              if (++cnt == N) goto done;
            }
            qs.emplace_back(v, p.second + 1);
          }
          ps.swap(qs);
        }
       done:{}
// for(int d=0;d<lim;++d)for(const int v:vss[d])cerr<<d<<","<<str(v)<<" ";cerr<<endl;
        uss.swap(vss);
      }
      for (int d = 0; d < lim; ++d) for (const int u : uss[d]) graph[i].emplace_back(d, u);
    }
    
    vector<pair<int, int>> dus;
    for (int i = 0; i < N; ++i) for (const auto &du : graph[i]) dus.push_back(du);
    sort(dus.begin(), dus.end());
    dus.erase(unique(dus.begin(), dus.end()), dus.end());
    const int dusLen = dus.size();
    // greedy for dus
    bm::init(dusLen, N);
    for (int i = 0; i < N; ++i) for (const auto &du : graph[i]) {
      const int j = lower_bound(dus.begin(), dus.end(), du) - dus.begin();
      bm::ae(j, i);
    }
    const int res = bm::run();
    if (res == N) {
      for (int i = 0; i < N; ++i) {
        const int j = bm::fr[i];
        assert(~j);
        const string t = str(dus[j].second);
        puts(t.c_str());
      }
    } else {
      puts("no solution");
    }
  }
  return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 7676kb

input:

5
automated teller machine
active teller machine
active trouble maker
always telling misinformation
American Teller Machinery

output:

autm
atem
atma
atm
ATM

result:

ok len=18

Test #2:

score: 0
Accepted
time: 1ms
memory: 7700kb

input:

5
Forest Conservation Committee Forum
Fuming Corruption Collusion Federation
Fulsome Cash Concealment Foundation
Funky Crony Capitalism Facilitator
Funny Cocky Cocky Funny

output:

FoCCF
FCoCF
FCCFo
FCCF
FCCoF

result:

ok len=24

Test #3:

score: 0
Accepted
time: 1ms
memory: 7740kb

input:

3
A AA
AA A
A A A

output:

no solution

result:

ok len=-1

Test #4:

score: 0
Accepted
time: 1ms
memory: 8008kb

input:

2
QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmertyuiop
Q W E R T Y U I O P A S D F G H J K L Z X C V B N M q w e r t y u i o p a s d f g h j k l z x c v b n m j k l z x c v b n m

output:

Q
QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmjklzxcvbnm

result:

ok len=63

Test #5:

score: 0
Accepted
time: 1ms
memory: 7740kb

input:

10
aaa aaa aaa aaa aaa aaa
aab aaa aaa aaa aaa aaa
aaa aab aaa aaa aaa aaa
aab aab aaa aaa aaa aaa
a a a a a a
ab ab a a a a a a
ab ab b a a a a a a
aw a a a a a
az az a a a a
az a a a a a

output:

aaaaaaaaa
aaaaaaa
aaabaaaa
aabaaaaa
aaaaaa
aaaaaaaa
aabaaaaaa
awaaaaa
aazaaaa
azaaaaa

result:

ok len=76

Test #6:

score: 0
Accepted
time: 834ms
memory: 10892kb

input:

128
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

result:

ok len=24512

Test #7:

score: 0
Accepted
time: 845ms
memory: 19204kb

input:

128
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccccccccccccccccccccccccc...

result:

ok len=16534

Test #8:

score: 0
Accepted
time: 124ms
memory: 10868kb

input:

128
zAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

zAAAAAAAzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zAAAAAAzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zAAAAAzzzzzz...

result:

ok len=17624

Test #9:

score: 0
Accepted
time: 163ms
memory: 449564kb

input:

128
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a...

output:

abaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bcbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
cdcccccccccccccccccccccccccccccccccccccc...

result:

ok len=16460

Test #10:

score: 0
Accepted
time: 475ms
memory: 42644kb

input:

128
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccccccccccccccccccccccc...

result:

ok len=16384

Test #11:

score: 0
Accepted
time: 0ms
memory: 9892kb

input:

10
AoenrfWTxhAiSipaV cJGloMoCBombqBsVuorNWL gqrmsIZGthdBIvNPWjTGgssBfbctzPCvCmMJWN MDYvQBZCaCmwSFnvQOmolkTmwWgysKuVmByj EOwjzBEgECXizqAZukRFAxdvrRhsGcIzQsFUMcXw mVNxPkaPPKUZEpswrhOqJerzhvfVwcNoDceNZPaskxTEhlGCMIoSqvAg JCPAAkYZoGOxpFNCj tsNvJHyeVCZqOHKzVsLoMnprENEmGSSxFGDDOafIIMVAbUtUIkAqmnrXUnWWfkAl...

output:

AcgMEmJtQnptFcoksenMLQXoWgmMEMuxBJYTcICgaVNaTfoyuAvDOAnedNDDPPPwIGaDOnjIlUvbJTVVQFLk
HvApbVGYRBPuNjNkipYlWgO
ScgzHNitvtRoLuUisITjuWCLGelWKqYoIAnAmIWTLOeMVHndqytXTd
UBSuhtoimhfhdKivdyCqJxSbtnocRCEKicArQJKnRagqrJfNHY
WqlPqHsSnpHcIfqCalIrqubIpBXqTVRBOYYQqRCQqJzyHRbbSCLzxsXOzNxSxSXcPhfHkNKClKWBJbg
iLqfr...

result:

ok len=660

Test #12:

score: 0
Accepted
time: 11ms
memory: 59680kb

input:

64
AQLPmEKRHtLKaVeVgUBkYfECFrvhbsXorapjINwkXhyCmkexRIVAZTsXaOihheHjstls AiIegrwbTMbBFdDQHGMgyOahunXRrySnKEmfKXQkpWdtNpGdgdBtPGfdcdnUvEqkfmvmSRzevtZkhPzjhDhTVLQCbaozNEXlqUgHeRshchY SFwbzOhRAEybYCGswuldoWkKloHghqiDybxtJPdzAWjmqxw mcRhokiMnxgAucSnasFcEXpZdEGEGzEGaEBAfGNEQAgQSTFKrMvxoUZTDKQMHksaciHoYXih...

output:

AASmGWIMEJjHHnPlYRcjfOMPuKTjbyRxHmnMcJSXFigHUqxClyINhlMPJgLAZRXFEOGWcCIQvqaYBIhOPkeUVWKHJYow
CJenkhWcPeucbfOFBHxSdYqLgftApMsctvFlfKkZmavIfqWYNZpZKJKYPwMSuvaSubelMSQKFIymAZoMLIOqoHGlIbOAp
CejoeafHpVdTXKhgDGCAFivwKoSTwwBUDBdXYMWNlUBUttHXemMOHwlBiaqRUwYTIPqJvpowUFTSkqyAywInGlWgMfYXuFrw
DkivKkaYITyXOOVF...

result:

ok len=3658

Test #13:

score: 0
Accepted
time: 59ms
memory: 369312kb

input:

128
kfiaaudafulirmameczaaaaaaaaaaaaaaaaaaaaaaaaagaaaajaaaaaalaaqoaaa f i a a u d a f u l i r m a m e c z a a a a a a a a a a a a a a a a a a a a a a a a a g a a a a j a a a a a a l a a q o a a a
aaaoqaalaaaaaajaaaagaaaaaaaaaaaaaaaaaaaaaaaaazcemamrilufaduaaifk a a o q a a l a a a a a a j a a a a g a ...

output:

kfiaaudafulirmameczaaaaaaaaaaaaaaaaaaaaaaaaagaaaajaaaaaalaaqoaaa
aaaoqaalaaaaaajaaaagaaaaaaaaaaaaaaaaaaaaaaaaazcemamrilufaduaaifk
aoajcnjaaicamaaaahyaaaaaaaaaaaaaaaaaaaaaaaaabaazasvaeaavcaaaajak
kajaaaacvaaeavsazaabaaaaaaaaaaaaaaaaaaaaaaaaayhaaaamaciaajncjaoa
akkggaaaaumaiwaqawgaaaaaaaaaaaaaaaaaaaaa...

result:

ok len=14640

Test #14:

score: 0
Accepted
time: 94ms
memory: 15056kb

input:

128
a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaZ a aaaaaaaaaaaaaaaZ aaaaaaaaaaaaab aaaaaaaaaaaaab aaaaaaaaaaaaaaaZ aaaaaaaaaaaaab a aaaaaaaaaaaaaz aaaaaaaaaaaaaaaZ aaaaaaaaaaaaab aaaaaaaaaaaaaz a aaaaaaaaaaaaab aaaaaaaaaaa...

output:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaa...

result:

ok len=17957

Test #15:

score: 0
Accepted
time: 183ms
memory: 13616kb

input:

128
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZz Z ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZb ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZWZZZZZ ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZbZZZZZ ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZQQZZZZZ ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZbZZZZZ ZZZZZ...

output:

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZ...

result:

ok len=20417

Test #16:

score: 0
Accepted
time: 180ms
memory: 13428kb

input:

128
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZWZZZZZ ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZb ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZQQZZZZZ ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZQQZZZZZ ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZb ZZZZZZZZZ...

output:

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ...

result:

ok len=20417

Test #17:

score: 0
Accepted
time: 11ms
memory: 8368kb

input:

128
p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p
p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p
p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p ...

output:

pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
ppppppppppppppppppppppppppppppppppppppppppppp
ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
p...

result:

ok len=8256

Test #18:

score: 0
Accepted
time: 0ms
memory: 20772kb

input:

64
Hash Objects
The following values are provided as constant attributes of the hash objects returned by the constructors
hash digest size
The size of the resulting hash in bytes
hash block size
The internal block size of the hash algorithm in bytes
A hash object has the following attributes
hash na...

output:

HO
Tfvapacaothorbtc
hds
Tsotrhib
hbs
Tibsothaib
Ahohtfa
hn
Tcnothalaasaaptntcahott
CivTnahbpiCsiibuPwnfssmneosp
Ahohtfm
hud
UthowtbloRcaetascwtcoatamuamubietmuab
hd
RtdotdpttumsfTiaboosdswmcbitwrft
hhe
LdetdiraasoodlcohdTmbutetvsieoonbe
hc
RaccothoTcbutectdodsacis
Svld
hsduT
TsasapvldwlibutobosAstdm...

result:

ok len=968

Test #19:

score: 0
Accepted
time: 3ms
memory: 12112kb

input:

62
Invocation
Manage access Packages Issues Invocations Solution files Stresses Tests Validator Checker Files Statement General info View Problems Contest
Back to invocations
Rejudge
Set solutions tags
n cpp n break cpp n log cpp n log removeset cpp n noclear cpp n spfa cpp n spfa py py n spfa pypy ...

output:

I
MaPIISfSTVCFSGiVPC
Bti
Re
Sst
ncnbcnlcnlrcnncnscnsppnsppnsvcncnsc
OOOOOOOOOOO
OOOOOOOOWOO
OOOOOOTOOTT
OOOOOOTOOOO
OOOOOOTOWTT
OOOOOOTOWOO
pt
mmMmMmMmMmMmMmMmMmMmMmM
Cwasstspawmtmahwlbc
IsctehoTosgTagOidTtccihwoc
Ctol
nmvhmvh
cbn
vn
vp
nmvhmtavdvnhmavoalotftin
nmvhmtavdvnhmavoalotfti
Ffhmttiatwhtsf...

result:

ok len=436

Test #20:

score: 0
Accepted
time: 3ms
memory: 10084kb

input:

64
Resource Files
New File Add Files
Name Length Modified
Actions
Delete Download Edit View
Advanced
gen atm cpp
Rename
kB Delete Download Edit View
olymp sty
problem tex
statements ftl
testlib h
Auto update
You can place here h files or java files These files will be copied to compilation directory...

output:

RF
NFAF
NLM
Ac
DDEV
Ad
gac
R
kDDEV
os
pt
sf
th
Au
YcphhfojfTfwbctcddtcpoesf
SF
NLLM
DDEVL
vcv
ccc
gabpg
gapge
gaaapg
gapg
gdpg
glpg
grcg
gspg
gzpg
gdp
grp
UffgvaciynIisrtutii
Dnushusti
Eog
Ycrmagh
A
Nf
Uatuafywitpr
Vc
hpccpXIfa
Afsgabp
Afsgabpd
Afsgapy
Afsgapde
Afsgap
Afsgapd
Afsgdpy
Afsgdpde
Afsgdp...

result:

ok len=325

Test #21:

score: 0
Accepted
time: 0ms
memory: 34988kb

input:

63
Major Arcana
Article
Talk
Read
Edit
View history
Tools
From Wikipedia the free encyclopedia
A fan with cards an index and their box
The Major Arcana cards redesigned by Roberto Viesi
The Major Arcana are the named or numbered cards in a cartomantic tarot pack the name being originally given by oc...

output:

MA
A
Ta
R
Ed
Vh
To
FWtfe
Afwcaiatb
TMAcrbRV
TMAatnonciactptnbogbotttcoantpufpcgTausciascptnfticpptintucitFTninubtcgp
PtttctcwsufpgatFatwspoascpufgagTmhbaacsattbbtttohnmomiWddfcgtcgtcsaptaadftrctscwakboatMA
TtMaMAauitoadaotdaipETaowJBPwutnPC
SMDwttFatcohsaoemmoieiitIcottcwiwiTosbteittcwACdGaScaFpeoTi...

result:

ok len=2094

Test #22:

score: 0
Accepted
time: 3ms
memory: 12004kb

input:

54
include bits stdc h
include testlib h
using namespace std
int n
vector vector string a
string strip const string s
auto l s begin
while l s end l l
auto r s end
while r l prev r r
return s substr l s begin r l
inline int readAndCheckAnswer InStream in
string first strip in readLine A Za z first l...

output:

ibsh
ith
uns
in
vvsa
sscss
alsb
wlsell
arse
wrlprr
rsslsbrl
iirIi
sfsirAZzfl
ifns
r
ieffl
vsaf
fiiini
apbirAZzp
it
ssa
sip
fawai
sis
fajp
fikjkaiskwsk
iaijkwk
sijk
e
b
pms
iepcaisaiinaaftsics
ieacaiambu
aiai
tais
rt
imiaca
raa
nirir
ssir
vsw
st
wst
wpbt
apbmw
ijra
ipro
ijp
qwJhtabphn
qfPhtabjhn
ipj
...

result:

ok len=270

Test #23:

score: 0
Accepted
time: 5ms
memory: 12424kb

input:

64
present me some phrases that shares the same initialism as much as possible as long as possible
ChatGPT
Creating long phrases that share the same initialism can be quite the puzzle Heres a list featuring the initialism S T A R T to give you an idea of how diverse the phrases can be
Seek Treasure ...

output:

pmsptstsiamapalap
C
ClptstsicbqtpHalftiSTARTtgyaiohdtpcb
STARTru
STARTi
STAReT
STARiT
START
STARTr
STAzRT
STAcRT
STrARTr
STARaT
Tpsdtfthafstasase
ctgm
HamputiSTART
STAReTr
SiTART
ShTART
SeTART
SToART
STARTo
STARTe
STeART
STAnRT
SThART
Epbotcosswiapjabsoace
STiART
STAdRT
STAmRT
SaTART
STAtRT
STrART
S...

result:

ok len=522

Test #24:

score: 0
Accepted
time: 12ms
memory: 54012kb

input:

128
You are given a string consisting of characters and or
You have to paint every character of this string into one of two colors red or blue
If you paint the i th character red you get r i coins
If you paint it blue you get b i coins
After coloring the string you remove every blue character from i...

output:

Yagascocao
Yhtpecotsiootcrob
Iyptitcrygric
Iypibygbic
Actsyrebcfiactnoiitrsi
e
tnopocsttlcitpiatrcitpi
Feiyhtpc
Witmnocyce
Lscaaaonnnifitfch
aloftnxx
xkaita
ceotadbamki
aiailkfeiin
Yagnxak
Ytitctnofaoln
Stacblpim
MaBapacg
Echtpaavaadv
Acsbactitaosisgttdot
Mhnctitothaavomaiaadvomai
Bhmctjtothaavombja...

result:

ok len=2069

Test #25:

score: 0
Accepted
time: 4ms
memory: 52160kb

input:

128
An anonymous informant has told you that the array b was obtained as follows initially there existed an array a a ldots a n after which the following two component operation was performed k times
A fixed point dagger x of the array a was chosen
Then the array a was cyclically shifted to the left...

output:

Aaihtyttabwoafiteaaaalanawtftcowpkt
Afpdxotaawc
Ttaawcsttldext
Aaroksotabblbnwo
Ywtcitwotaicbtoitagtbf
dAnxicafpotaaalanilxlnaaxx
dAclsotaaalanitaalana
Yagartwtravicoasv
Evhanvist
Taaqqott
Tftaacvwtnstvvwsitcsott
Tnvotnvwb
Tstaxttnvoavitsovv
Aaqotnvoaotvitft
TbSilawatnB
OtcotyBwane
Feeidaiikwianni
S...

result:

ok len=1849

Test #26:

score: 0
Accepted
time: 13ms
memory: 54500kb

input:

128
It turns out that Doremy has a special power
She can choose k days and during these days it will not rain
Doremy wants to calculate the maximum number of dry cities after using the special power
The only differences between the two versions of this problem are the constraint on k the time limit ...

output:

ItotDhasp
Scckdadtdiwnr
Dwtctmnodcautsp
Todbttvotpatcokttlatml
Ycmhoiavotpas
Dliarcconcnftn
Twbptdoritnmd
Ititdiwritcitiliri
Acicdiiwnritcitnmd
Scckditevkadtdiwnr
Dliacconcnftnwaiplititc
Icbmaaugwnn
Itaneitg
NDwtmtgc
Tdtscaaebiaji
skiSakgicjcc
wSitsoatntacitsccoeiojaciagc
CDmtgc
Tnijaitscciteapfitj
...

result:

ok len=2054

Test #27:

score: 0
Accepted
time: 7ms
memory: 8312kb

input:

128
Ab
aba
abac
abacaabaca synonyms
abaciscus
abacist
abackaback synonyms
Abaco
abacterial
abactinal
abaculus
abacusabacus synonyms
Abadan
AbaddonAbaddon synonyms
A bad penny always turns up
ab aeterno
abaftabaft synonyms
Abagtha
Abailard
Abakan
abaloneabalone synonyms
abamp
abampere
abandonabandon ...

output:

Ab
aba
abac
abacsy
abacis
abaci
abasyn
Abac
abacte
abact
abacu
abacs
Abad
Asy
Abpatu
aa
abafs
Abag
Abai
Abak
abals
abamp
abam
absyno
asynon
aband
Ahayweh
abans
aban
abapi
abap
AIs
b
as
absy
abasy
absyn
abass
abasi
asyno
abas
asyn
abati
aj
abato
abat
Aba
abats
abax
abay
abb
A
abbac
ad
Abbad
Abbai
Abb...

result:

ok len=504

Test #28:

score: 0
Accepted
time: 7ms
memory: 8012kb

input:

105
abele
abelia
Abelian
Abelian group
Abe Lincoln in Illinois
Abel meholah
abelmosk
Abelson
Abenaki
abendabend synonyms
Abeokuta
Abercrombie
Aberdare
Aberdeen
Aberdeen Angus
Aberdeen Proving Ground
Aberdeenshire
Aberdeen terrier
aberdevine
Aberdonian
Aberfan
Abernathy
abernethy
aberrantaberrant syn...

output:

abele
abeli
Abeli
Ag
ALiI
Am
abel
Abel
Aben
abens
Abeo
Aberc
A
Aber
AA
APG
Abe
At
aberd
Aberd
Aberf
Abern
aber
asyno
abers
Abery
aes
abe
abesy
abet
abets
ae
abeys
abes
abf
ABFM
AB
abhe
AP
abh
absy
abhos
abhsy
abhs
Abia
Abiat
Abib
abid
abisy
abbys
abids
Abid
Abie
abien
bi
abie
aac
abigs
Abih
Abil
abi...

result:

ok len=410

Test #29:

score: 0
Accepted
time: 6ms
memory: 10072kb

input:

128
Saar
Saarbrcken
SAARC
Saaremaa
Saarinen
Saarland
SaaS
Saavedra Lamas
Sab
Saba
Sabadell
sabadilla
Sabaean
Sabah
sabalo
Sabaoth
Sabata
Sabatier
Sabatini
sabaton
Sabattier effect
sabayon
Sabbat
Sabbatarian
SabbathSabbath synonyms
Sabbath school
Sabbatical
sabbatical yearsabbatical year synonyms
Sab...

output:

Saar
Saarb
SAA
Saare
Saari
Saa
SaaS
SLa
S
Saba
Sabad
sabad
Sabae
Sabah
sabal
Sabao
Sabata
Sabati
Sabat
sabat
Se
saba
Sabbat
Sa
Ssy
Ss
Sabba
syys
Sabb
SAB
Sabea
Sabe
sabes
sabe
srrsy
ssa
st
stti
sabi
Sab
Sabin
SL
Sabi
Svvs
Sabir
sabk
sabls
san
sabl
SIp
sabo
sabs
sabos
sabsy
sab
sabrs
sr
sabr
stt
Sabr...

result:

ok len=555

Test #30:

score: 0
Accepted
time: 8ms
memory: 10172kb

input:

128
safari suit
Safavid
safesafe synonyms
safe and soundsafe and sound synonyms
safe area
safe as houses
safe blower
safe breaker
safe conductsafe conduct synonyms
safecrackersafecracker synonyms
safe deposit
safe deposit boxsafe deposit box synonyms
safeguardsafeguard synonyms
safe harborsafe harbo...

output:

ssui
Safa
ss
sasass
saa
saho
sbl
sab
sccsy
ssy
sde
sdbdbsy
ssyn
shhsy
shhs
safs
safe
safsy
spe
sse
sspa
sasu
safes
sbbs
sc
sca
sch
sac
sccs
sd
sdbdbs
sfa
sfi
sfu
sf
sggs
sho
sints
siis
SI
slls
sal
sl
sma
smms
snns
spps
srrs
ssq
sto
svvs
swo
s
saff
so
saffs
Saf
SR
SAf
safr
SAD
saf
saft
sagss
ssyno
sa...

result:

ok len=443

Test #31:

score: 0
Accepted
time: 5ms
memory: 8072kb

input:

115
sage cock
sage Derby
sage green
sage grouse
sage hen
sagelysagely synonyms
sagenite
sage sparrow
sage thrasher
saggar
saggersagger synonyms
sagging moment
saggysaggy synonyms
Saghalien
Sag Harbor
Saginaw
Saginaw Bay
Sagitta
sagittalsagittal synonyms
sagittal suture
Sagittarian
SagittariusSagitta...

output:

sc
sD
sgre
sgr
she
sages
sage
ssp
st
sagg
saggs
sm
sagsy
Sagh
SH
Sagin
SaB
Sagit
sagis
ssut
Sagi
Ssy
sagi
sags
sago
sg
spa
sr
S
sag
Sag
SeH
Sagu
sw
Sa
Ss
Saha
Sah
Sahe
Stc
sah
SAk
SAH
saic
sasyn
Said
saig
Saig
ST
ssyno
sail
sailb
ssy
scttw
sas
saile
sailf
sasy
sbbs
sl
ssh
si
sailm
ssyn
sh
sailo
ssc
...

result:

ok len=379

Test #32:

score: 0
Accepted
time: 46ms
memory: 12928kb

input:

128
AAAzzzzzAzzzAzzAzAzzAzzAAzzzzAzAzzAAAAzzAAzAAzAAAAzAzzzzzAAAAzAAAzzzAzzAAzAAzzAAAAAzzzzzzAzzAAzzzzzAAAAzzzAzAAzzzAAzzzAAAAzAAzzA
AzAAzAzAAzAAzzzzAAzzzAzzzAzzAAAzzzAAAzzzzAzAAzzzAzAzAzAzzzzAAAzAzzzAAzzzzzzzzzAAzzzzzzAAAzzzzAzzAzAzAAzAzzzzzAzAzzAzzAzzAAzzAAzA
AAzAzzzzAzAAAzAAzAAzAzAzAAzAAzzAzzzAAz...

output:

AAAzzzz
AzAAzA
AAzAzzz
z
AAzA
zAAzAAA
zAAzzzz
AA
zA
zzz
zAAzAA
zAAA
AAzzAz
AAAzAzA
zzAzzzz
zzAz
zAzzA
zz
zAzAz
zAAAA
AAzzzAz
zzAAzz
AAzAAAA
AAzAA
AzAAAz
A
zzzz
zAzzz
zAzzAA
AAzzzA
zAAAzzz
Azzz
zAzzAz
zAA
zAzzzz
AzzzAA
zzzA
zzAzAz
zAz
AzzzAz
Azzzz
AAAzz
zzzzzzA
zAzzzA
zzA
zAzAAz
zAAzzA
zAzAAA
AAzAAA
...

result:

ok len=673

Test #33:

score: 0
Accepted
time: 48ms
memory: 12720kb

input:

128
zAzzAAAAAzzAAAzAAAzAzzzAAzzzAzzzAzAzzAAzzAzAAzAzAzAAAAAzzzzzAAAAzzzzzAAAAzzzzzAAzzzAzAzAzzzAAAzAAAAzzzzAzAzzzzAzAzAAAzAzzzzAzAAA
zzAzzzAAzzAAAzAAAzzAzAAzAAzzzAAAAzzzzAzzzAzAzzzAAAAAAAzzAzzzAzzAAzzAAAAAzAzzzzzAzAAAAAzzAAzzAzAAzzAAAzAzzAzAAAAAAzAzAzzzAAAzAzzA
AzzAAAAzzAAzzAAzzAAAAzAzzzzzAAAzzAzzzA...

output:

zAzzAAA
zz
AzzAAAA
AAAAzA
zA
zAAAAzz
AAA
zAAAA
AzAzAAA
zAzAAA
AzAzAzz
AzAz
zzAAzAA
zAzzA
AAzzz
zzz
AzzzzzA
AAzAAA
AzAzAz
AAAAAAz
zAAAAz
AzzzzA
zAzA
zAAAzzA
zAzzAA
zzzzz
AAAAzzA
zzAzAz
zzzAzA
zzAzAA
zAzAz
zAAz
AAAzAAz
Azz
zAA
zAz
AAz
zAzzAz
Az
zAzzz
AAzA
zzAzA
zAAA
AAzAAz
z
AAzzAA
AAzAA
AzAAAz
AAzzzA...

result:

ok len=667

Test #34:

score: 0
Accepted
time: 55ms
memory: 22560kb

input:

128
riJvmelARapZOVXwMfUdCzkwcdcFjGKiqKQwFwiXFPFIjlUnHZFetAENZXLpvEWaOZRVAeFBjLaCKvnszYuPa riJvmelARapZOVXwMfUdCzkwcdcFjGKiqKQwFwiXFPFIjlUnHZFetAENZXLpvEWaOZRVAeFBjLaCKvnszYuPa riJvmelARapZOVXwMfUdCzkwcdcFjGKiqKQwFwiXFPFIjlUnHZFetAENZXLpvEWaOZRVAeFBjLaCKvnszYuPa riJvmelARapZOVXwMfUdCzkwcdcFjGKiqKQwFw...

output:

rrirrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrirrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrirrrrrrrrrrrrrrrrrr...

result:

ok len=16511

Test #35:

score: 0
Accepted
time: 0ms
memory: 16112kb

input:

64
g MinGW W x ucrt posix seh built by Brecht Sanders
Copyright C Free Software Foundation Inc
This is free software see the source for copying conditions There is NO
warranty not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
Usage g options file
Options
pass exit codes Exit with high...

output:

gMWxupsbbBS
CCFSFI
TifsstsfccTiN
wnefMoFFAPP
Ugof
O
pecEwhecfap
hDti
thDtsclo
hcoptwjsu
Dstoclo
Uvhtdcloosp
vDcvi
dDaotbiss
dDtvotc
dDtcstp
psdDtditcssp
plfnDtnotcscl
pfnlDtfptll
ppnpDtfptccp
pmDttsnGtua
acitlp
pmdDtrdfvol
pmlDtmbcloa
mlsd
pmodDtrptOl
psDttld
pshsDtssutfh
WoPcsootta
WoPcsoottp
WoPcs...

result:

ok len=539

Test #36:

score: 0
Accepted
time: 843ms
memory: 15140kb

input:

128
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccccccccccccccccc...

result:

ok len=16636

Test #37:

score: 0
Accepted
time: 0ms
memory: 8004kb

input:

1
z

output:

z

result:

ok len=1

Test #38:

score: 0
Accepted
time: 24ms
memory: 229472kb

input:

128
AQcNVBPpxahJeqoyDYRQdSHFxfNXlLotEijTgUySPIUHysxlfdPCpRvbSJkQBOhTJgJVDRdjAIFODJTSLJZmzUJgAXsJEFJDkGhfGCMAcpZVd iMGDnPQZefidJgKERflhOdNxntuIcaEMjnFgRSbqqopCDKnPsDAlxCsZvbvIObJqlTcofHD nnJCmTgqyFYNjQTBgNSSbVWrNxahwleYXVVGizfdorZdeBDrdXEJnnphWIAiWmzqqdWCDRSoNIBHHZr qCRWhfJScgWlkkfzjPIhZXojqEWYOOahsF...

output:

AinqKjKOTbajcXnZARIjQnPJOOFrlfWldfUfXsj
B
BAkzSIOKVkoYNbLIlfatOiDcpFbymXoAcXQDpgsweYhmXkEnxDnIOMYYBslzJBCBUIjHzHPYduUbFnPjjnPq
BXvBcFXrPxdzOGQdjoDuWBfZLfzjPsfBfvVcRTCeklejNSPxVcAHCbjtOEuhObAZfNQhgNdh
BsvmwwOSwXfJlxLINsDIfMOPbLtPvKBPzimHoJiaycCkSTpDKFGjIfipMN
BaRwYGBLxhsArZHQQYsCWoJVnYnGdPDOgZLbgqKCr...

result:

ok len=8082

Test #39:

score: 0
Accepted
time: 62ms
memory: 441396kb

input:

128
EsRPZZEOwdRaYIWsPeQRAzwvIUwETAYeTUQPzvOIzWwTvwsREYwZWwaPUsRRQdIWsQYUvZaaRAYYdTaRUAYZOeIEOTvAwAAPwOAORTAQUQaYUdaPUwvQAAPEPsReResP EsRPZZEOwdRaYIWsPeQRAzwvIUwETAYeTUQPzvOIzWwTvwsREYwZWwaPUsRRQdIWsQYUvZaaRAYYdTaRUAYZOeIEOTvAwAAPwOAORTAQUQaYUdaPUwvQAAPEPsReResP EsRPZZEOwdRaYIWsPeQRAzwvIUwETAYeTUQPzv...

output:

EEEQEEQEQEEQQQEQEQQQQQEEQEEQEEEQEQQQQEQQQEEQQEEEEQQQQEQQEEQQEQEQQQQQEEQQEQEEQEEEQQQQQQQEQQQQQEQQQQEEQQEEQEEQQQEEQEEQEEQEQQQEEEEE
EQEQQEQQQQQEQEQEEQEEEEQQEQEQEEEQEEEQQQEEQEQEQQEQQQQEEEQQEEQEEQEQQQEQEQEEQQQEQEQEQQEQQQQEEEQQQEQQQEQQEEQEEEEQEQEEQEEEQEQQEQQQEQEQ
QEEQQEQEQQEEQEEQQQEQEEQEEQEQEEEQQEQEEQQEEQ...

result:

ok len=16384

Test #40:

score: 0
Accepted
time: 45ms
memory: 15116kb

input:

128
vAawasZQUZeQEvZYZZPsWYzEUPvYETPEAeewWIzszEAvsPeEdUTUUweUzOseEddUYszPWWOzTZAvREzQAYwvdsQvsEPdvsYaOZARdwQAWwTPPIvZsRQwszdQIaOIOIQZ vAawasZQUZeQEvZYZZPsWYzEUPvYETPEAeewWIzszEAvsPeEdUTUUweUzOseEddUYszPWWOzTZAvREzQAYwvdsQvsEPdvsYaOZARdwQAWwTPPIzIesOOQQaaYaOUAwse vAawasZQUZeQEvZYZZPsWYzEUPvYETPEAeewWI...

output:

vvAvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvAvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvAvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

result:

ok len=16511

Test #41:

score: 0
Accepted
time: 2ms
memory: 9940kb

input:

128
A
AB
A B
ABA
A BA
AB A
A B A
ABAC
A BAC
AB AC
A B AC
ABA C
A BA C
AB A C
A B A C
ABACA
A BACA
AB ACA
A B ACA
ABA CA
A BA CA
AB A CA
A B A CA
ABAC A
A BAC A
AB AC A
A B AC A
ABA C A
A BA C A
AB A C A
A B A C A
ABACAA
A BACAA
AB ACAA
A B ACAA
ABA CAA
A BA CAA
AB A CAA
A B A CAA
ABAC AA
A BAC AA
AB...

output:

no solution

result:

ok len=-1

Test #42:

score: 0
Accepted
time: 0ms
memory: 7760kb

input:

64
r
rw
r w
rwe
r we
rw e
r w e
rwer
r wer
rw er
r w er
rwe r
r we r
rw e r
r w e r
rwerr
r werr
rw err
r w err
rwe rr
r we rr
rw e rr
r w e rr
rwer r
r wer r
rw er r
r w er r
rwe r r
r we r r
rw e r r
r w e r r
rwerrt
r werrt
rw errt
r w errt
rwe rrt
r we rrt
rw e rrt
r w e rrt
rwer rt
r wer rt
rw ...

output:

no solution

result:

ok len=-1

Test #43:

score: 0
Accepted
time: 0ms
memory: 10164kb

input:

64
A
AA
A A
AAA
A AA
AA A
A A A
AAAB
A AAB
AA AB
A A AB
AAA B
A AA B
AA A B
A A A B
AAABB
A AABB
AA ABB
A A ABB
AAA BB
A AA BB
AA A BB
A A A BB
AAAB B
A AAB B
AA AB B
A A AB B
AAA B B
A AA B B
AA A B B
A A A B B
AAABBB
A AABBB
AA ABBB
A A ABBB
AAA BBB
A AA BBB
AA A BBB
A A A BBB
AAAB BB
A AAB BB
AA ...

output:

no solution

result:

ok len=-1

Test #44:

score: 0
Accepted
time: 1ms
memory: 7728kb

input:

4
z
zx
z x
QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVB WERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBN ERTYUIOPASDFGHJKLZXCVBNMqwertyu...

output:

no solution

result:

ok len=-1

Test #45:

score: 0
Accepted
time: 1ms
memory: 9820kb

input:

2
z
QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVB WERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBN ERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdf...

output:

z
QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVB

result:

ok len=129

Test #46:

score: 0
Accepted
time: 0ms
memory: 11984kb

input:

121
ol
olo
o lo
ol o
olol
o lol
ol ol
o l ol
olo l
o lo l
ol o l
ololA
o lolA
ol olA
o l olA
olo lA
o lo lA
ol o lA
o l o lA
olol A
o lol A
ol ol A
o l ol A
olo l A
o lo l A
ol o l A
ololAN
o lolAN
ol olAN
o l olAN
olo lAN
o lo lAN
ol o lAN
o l o lAN
olol AN
o lol AN
ol ol AN
o l ol AN
olo l AN
o lo...

output:

no solution

result:

ok len=-1

Test #47:

score: 0
Accepted
time: 1ms
memory: 7816kb

input:

27
ee
eee
e ee
ee e
eeee
e eee
ee ee
e e ee
eee e
e ee e
ee e e
eeeee
e eeee
ee eee
e e eee
eee ee
e ee ee
ee e ee
e e e ee
eeee e
e eee e
ee ee e
e e ee e
eee e e
e ee e e
ee e e e
QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF...

output:

no solution

result:

ok len=-1

Test #48:

score: 0
Accepted
time: 1ms
memory: 7668kb

input:

5
we
wer
w er
we r
QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVB WERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBN ERTYUIOPASDFGHJKLZXCVBN...

output:

w
wer
we
wr
QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVB

result:

ok len=136

Test #49:

score: 0
Accepted
time: 1ms
memory: 7792kb

input:

5
dz
dzd
d zd
dz d
QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVB WERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBN ERTYUIOPASDFGHJKLZXCVBN...

output:

d
dzd
dz
dd
QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVB

result:

ok len=136

Extra Test:

score: 0
Extra Test Passed