QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#191369#7531. Hacking the ProjectDays_of_Future_Past#TL 7ms4196kbC++141.9kb2023-09-29 22:18:452023-09-29 22:18:45

Judging History

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

  • [2023-09-29 22:18:45]
  • 评测
  • 测评结果:TL
  • 用时:7ms
  • 内存:4196kb
  • [2023-09-29 22:18:45]
  • 提交

answer

#include <bits/stdc++.h>
#define SZ(c) ((int)(c).size())
#define ONLINE 1

using namespace std;

const int N = 1111;
const int INF = 1e9;

typedef pair<int, int> pii;

int dp[N][N];

void build() {
  for (int len = 2; len < N; ++len)
    for (int i = 0; i < N; ++i) {
      int r = i + len - 1;
      if (r >= N)
        break;
      dp[i][r] = INF;
      for (int m = i + 1; m <= r; ++m)
        dp[i][r] = min(dp[i][r], m + max(dp[i][m - 1], dp[m][r]));
    }
  printf("%d\n", dp[0][1000]);
}

vector<string> groundtruth{
  "aaa",
  "aba",
  "czzzz",
  "cxyxy"
};

vector<string> query(char c, int k) {
  static char buf[111];
  printf("query %c %d\n", c, k);
  fflush(stdout);
  vector<string> res;
  
  if (ONLINE) {
    int real_k;
    scanf("%d", &real_k);
    for (int i = 0; i < real_k; ++i) {
      scanf("%s", buf);
      res.push_back(buf);
    }
  } else {
    for (auto s: groundtruth)
      if (s[0] == c)
        res.push_back(s);
  }
  return res;
}

void answer(const vector<string> &ss) {
  printf("answer");
  for (int i = 0; i < SZ(ss); ++i)
    printf(" %s", ss[i].c_str());
  printf("\n");
  fflush(stdout);
}

int n;

vector<string> ans[33];

void main2() {
  scanf("%d", &n);
  for (int c = 0; c < 26; ++c)
    ans[c].clear();
  int remaining = n;
  for (int c = 0; c < 26; ++c) {
    int guess = 1;
    while (guess <= remaining) {
      ans[c] = query('a' + c, guess);
      if (SZ(ans[c]) < guess || SZ(ans[c]) == remaining) {
        break;
      } else {
        guess = min(guess * 2, remaining);
      }
    }
    remaining -= SZ(ans[c]);
  }
  vector<string> all_ans;
  for (int c = 0; c < 26; ++c)
    for (auto s: ans[c])
      all_ans.push_back(s);
  answer(all_ans);
}

int main() {
  //build();
  int tc;
  scanf("%d", &tc);
  while (tc--) {
    main2();
  }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
4
1 aaa
2 aaa aba
2 aaa aba
0
1 cxyxy
2 cxyxy czzzz

output:

query a 1
query a 2
query a 4
query b 1
query c 1
query c 2
answer aaa aba cxyxy czzzz

result:

ok Ok in 11 k

Test #2:

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

input:

5
1000
1 a
2 a aajm
4 a aajm aavfegkci aavj
8 a aajm aavfegkci aavj abjc abnxwsy abzbr acvd
16 a aajm aavfegkci aavj abjc abnxwsy abzbr acvd adrvb af afbxpytbe afl afwsjfu aigwxskrks aimpdesf ajbq
32 a aajm aavfegkci aavj abjc abnxwsy abzbr acvd adrvb af afbxpytbe afl afwsjfu aigwxskrks aimpdesf ajb...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query d 1
query d 2
query d 4
query d 8
query d 16
query d 32
query d 64
query e ...

result:

ok Ok in 3159 k

Test #3:

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

input:

5
1000
1 acbd
2 acbd acgts
4 acbd acgts acvdflmn admkf
8 acbd acgts acvdflmn admkf aehzdl aepocjmc afaeqq afbqeawd
16 acbd acgts acvdflmn admkf aehzdl aepocjmc afaeqq afbqeawd afjb agrfnq ahrhdp aidg aimp aiqana ajb akwm
32 acbd acgts acvdflmn admkf aehzdl aepocjmc afaeqq afbqeawd afjb agrfnq ahrhdp...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query d 1
query d 2
query d 4
query d 8
query d 16
query d 32
query d 64
query e 1
query e 2...

result:

ok Ok in 3273 k

Test #4:

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

input:

5
1000
1 aaxqvzig
2 aaxqvzig abbaep
4 aaxqvzig abbaep actfxtivf adt
8 aaxqvzig abbaep actfxtivf adt adtl aer afa agfev
16 aaxqvzig abbaep actfxtivf adt adtl aer afa agfev agluptr ahci ahdfhfr aiympo ajjcvjb ajkux akq alnoiph
32 aaxqvzig abbaep actfxtivf adt adtl aer afa agfev agluptr ahci ahdfhfr ai...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query d 1
query d 2
query d 4
query d 8
query d 16
query d 32
query d 64
query e 1
query e 2...

result:

ok Ok in 3237 k

Test #5:

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

input:

5
1000
1 a
2 a aalilyz
4 a aalilyz ac acb
8 a aalilyz ac acb adcogtni adroq aepocjm aevi
16 a aalilyz ac acb adcogtni adroq aepocjm aevi af aguwuvh agxaaac ahuwl ahxy aiafmv aisyr ajuqw
32 a aalilyz ac acb adcogtni adroq aepocjm aevi af aguwuvh agxaaac ahuwl ahxy aiafmv aisyr ajuqw ake amdjxnsmk amg...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query d 1
query d 2
query d 4
query d 8
query d 16
query d 32
query d 64
query e ...

result:

ok Ok in 3148 k

Test #6:

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

input:

5
1000
1 abvmqw
2 abvmqw acgt
4 abvmqw acgt acoogjx adrvbejoo
8 abvmqw acgt acoogjx adrvbejoo ae aeqv af afb
16 abvmqw acgt acoogjx adrvbejoo ae aeqv af afb afdktn aggcwzid aibg aimgcusle aiymp ajuqm al alk
32 abvmqw acgt acoogjx adrvbejoo ae aeqv af afb afdktn aggcwzid aibg aimgcusle aiymp ajuqm al...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query d 1
query d 2
query d 4
query d 8
query d 16
query d 32
query d 64
query e ...

result:

ok Ok in 3208 k

Test #7:

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

input:

5
1000
1 aavfeg
2 aavfeg abogkwk
4 aavfeg abogkwk abpwnr abqlngdsc
8 aavfeg abogkwk abpwnr abqlngdsc acbdx adgeed aerm aevi
16 aavfeg abogkwk abpwnr abqlngdsc acbdx adgeed aerm aevi aexjyu afascs afbqeawdi afkxyfmcn afvmu agmm agwdwxsu aigw
32 aavfeg abogkwk abpwnr abqlngdsc acbdx adgeed aerm aevi a...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query d 1
query d 2
query d 4
query d 8
query d 16
query d 32
query d 64
query e ...

result:

ok Ok in 3146 k

Test #8:

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

input:

5
1000
1 a
2 a aaac
4 a aaac aac aadrvbej
8 a aaac aac aadrvbej aay abwun abz acb
16 a aaac aac aadrvbej aay abwun abz acb acn acqx actyaovq acvdf adgeedjk af ahnzdw ahxylcgn
32 a aaac aac aadrvbej aay abwun abz acb acn acqx actyaovq acvdf adgeedjk af ahnzdw ahxylcgn aidvvi aisyr aivtmpqz al an anbi...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query d 1
query d 2
query d 4
query d 8
query d 16
query d 32
query d 64
query e ...

result:

ok Ok in 3158 k

Test #9:

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

input:

5
1000
1 aaciqgnc
2 aaciqgnc aawtbc
4 aaciqgnc aawtbc aayipsoj abqlngds
8 aaciqgnc aawtbc aayipsoj abqlngds acf acqrs actad adrv
16 aaciqgnc aawtbc aayipsoj abqlngds acf acqrs actad adrv adxm aexjy agnn agwdwxs ai aid aif aijelh
32 aaciqgnc aawtbc aayipsoj abqlngds acf acqrs actad adrv adxm aexjy ag...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query d 1
query d 2
query d 4
query d 8
query d 16
query d 32
query d 64
query e ...

result:

ok Ok in 3151 k

Test #10:

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

input:

5
1000
1 aagxaa
2 aagxaa abjc
4 aagxaa abjc acg aciqg
8 aagxaa abjc acg aciqg acnhpzn acvdfl adtninwc aehz
16 aagxaa abjc acg aciqg acnhpzn acvdfl adtninwc aehz aek aeqqojyp aevibe aexjyulg afbxp afl aguwuv ahcipz
32 aagxaa abjc acg aciqg acnhpzn acvdfl adtninwc aehz aek aeqqojyp aevibe aexjyulg afb...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query d 1
query d 2
query d 4
query d 8
query d 16
query d 32
query d 64
query e ...

result:

ok Ok in 3150 k

Test #11:

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

input:

5
1000
1 aadbd
2 aadbd aadbg
4 aadbd aadbg aaemf aaepzchvxg
8 aadbd aadbg aaemf aaepzchvxg aapihz aaqjqvgx aazfccep aaznfe
16 aadbd aadbg aaemf aaepzchvxg aapihz aaqjqvgx aazfccep aaznfe abakwq abbwcmdh abdhdofrs abdjlpez abeaa abezgbabhd abgbpa abhkmvmahb
32 aadbd aadbg aaemf aaepzchvxg aapihz aaqj...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query d 1
query d 2
query d 4
query d 8
query...

result:

ok Ok in 3022 k

Test #12:

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

input:

5
1000
1 aabwpote
2 aabwpote aaclnnc
4 aabwpote aaclnnc aadjkgs aaemccd
8 aabwpote aaclnnc aadjkgs aaemccd aapihztr aavaacml aazdodzr abbaeuada
16 aabwpote aaclnnc aadjkgs aaemccd aapihztr aavaacml aazdodzr abbaeuada abbriejjk abbzfui abcdocbn abicfcs abjcdznj abkcmdgj abrlkfgb abuesdgjja
32 aabwpot...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query d 1
query d 2
query d 4
query d 8
query...

result:

ok Ok in 3106 k

Test #13:

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

input:

5
1000
1 aaaac
2 aaaac aabcfn
4 aaaac aabcfn aacafh aacklaael
8 aaaac aabcfn aacafh aacklaael aacqahce aadaagbh aadneaeg aaeahnfag
16 aaaac aabcfn aacafh aacklaael aacqahce aadaagbh aadneaeg aaeahnfag aaedi aaegsqcag aafbkbfcra aaffddb aagecekeae aaghla aagpa aajdhjlba
32 aaaac aabcfn aacafh aacklaa...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query a 256
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query d 1
query d 2
query d 4
que...

result:

ok Ok in 3052 k

Test #14:

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

input:

5
1000
1 aabbhcc
2 aabbhcc aabfaakbdp
4 aabbhcc aabfaakbdp aabpmcgoa aabzaecvji
8 aabbhcc aabfaakbdp aabpmcgoa aabzaecvji aadcaoscc aadcbqgafi aaeizjcec aafaedcb
16 aabbhcc aabfaakbdp aabpmcgoa aabzaecvji aadcaoscc aadcbqgafi aaeizjcec aafaedcb aafbefhcab aafbygbcc aagobdhafb aajhdbdlm aakbaezd aakc...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query a 256
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query d 1
query d 2
query d 4
que...

result:

ok Ok in 3083 k

Test #15:

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

input:

5
1000
1 aaaaaibb
2 aaaaaibb aaabaa
4 aaaaaibb aaabaa aaabceaid aaabf
8 aaaaaibb aaabaa aaabceaid aaabf aaagbba aaagpabe aaahcab aaamdca
16 aaaaaibb aaabaa aaabceaid aaabf aaagbba aaagpabe aaahcab aaamdca aabhbhbf aabhdl aabicbiaa aabjcngb aacafh aacdcaca aacia aaclg
32 aaaaaibb aaabaa aaabceaid aaa...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query a 256
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query b 256
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query d 1
query d 2
q...

result:

ok Ok in 2950 k

Test #16:

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

input:

5
1000
1 aaabfdi
2 aaabfdi aaabied
4 aaabfdi aaabied aaacbfg aaaeebaf
8 aaabfdi aaabied aaacbfg aaaeebaf aaafbeabii aaagbbabh aaaqpbb aaaudai
16 aaabfdi aaabied aaacbfg aaaeebaf aaafbeabii aaagbbabh aaaqpbb aaaudai aabaabge aabbbdc aabcehac aabeabfacb aabedfk aacaeaaeac aaccfdc aacgdicaa
32 aaabfdi ...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query a 256
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query b 256
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query c 256
query d 1...

result:

ok Ok in 3196 k

Test #17:

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

input:

5
1000
1 aaaab
2 aaaab aaaad
4 aaaab aaaad aaaaeddca aaabceaed
8 aaaab aaaad aaaaeddca aaabceaed aaabf aaacbaa aaaedfecd aaafd
16 aaaab aaaad aaaaeddca aaabceaed aaabf aaacbaa aaaedfecd aaafd aaafdegda aaamaab aaanae aabaacfca aabajbdbda aabak aabbgddaaa aabca
32 aaaab aaaad aaaaeddca aaabceaed aaab...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query a 256
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query b 256
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query c 256
query d 1...

result:

ok Ok in 3308 k

Test #18:

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

input:

5
1000
1 aaaadbaab
2 aaaadbaab aaaagbae
4 aaaadbaab aaaagbae aaabhab aaacakhd
8 aaaadbaab aaaagbae aaabhab aaacakhd aaacbcbaqe aaadacda aaadfagae aaaeaaaebr
16 aaaadbaab aaaagbae aaabhab aaacakhd aaacbcbaqe aaadacda aaadfagae aaaeaaaebr aaaeaekea aaaebbdfe aaajbbb aabaabgd aabaeefbfa aabakfbeb aabba...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query a 256
query a 512
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query b 256
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query c 2...

result:

ok Ok in 3360 k

Test #19:

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

input:

5
1000
1 aaaaaedd
2 aaaaaedd aaaab
4 aaaaaedd aaaab aaaabb aaaabc
8 aaaaaedd aaaab aaaabb aaaabc aaaadda aaaaeabb aaabaa aaabbcaabh
16 aaaaaedd aaaab aaaabb aaaabc aaaadda aaaaeabb aaabaa aaabbcaabh aaabbncfba aaabd aaabeda aaabi aaacaad aaackaaee aaadbaab aaadbc
32 aaaaaedd aaaab aaaabb aaaabc aaaa...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query a 256
query a 512
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query b 256
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query c 2...

result:

ok Ok in 3112 k

Test #20:

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

input:

5
1000
1 aaaaaaakf
2 aaaaaaakf aaaaaadda
4 aaaaaaakf aaaaaadda aaaaacf aaaacaabc
8 aaaaaaakf aaaaaadda aaaaacf aaaacaabc aaaadbaa aaaafaia aaaafeaeeb aaabbcaa
16 aaaaaaakf aaaaaadda aaaaacf aaaacaabc aaaadbaa aaaafaia aaaafeaeeb aaabbcaa aaabceaaa aaabdbb aaabeda aaabiaagh aaacbcbaqe aaacbdf aaaceaa...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query a 256
query a 512
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query b 256
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query c 2...

result:

ok Ok in 3114 k

Test #21:

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

input:

1
1000
0
1 bagaoguesy
2 bagaoguesy bajdjjxkus
4 bagaoguesy bajdjjxkus bamxlzqrbg baqstjbgkd
8 bagaoguesy bajdjjxkus bamxlzqrbg baqstjbgkd baxomczwvf bbcczeqbln bbfivcdxcq bbkdokgwfw
16 bagaoguesy bajdjjxkus bamxlzqrbg baqstjbgkd baxomczwvf bbcczeqbln bbfivcdxcq bbkdokgwfw bbmbmkokgs bbvoexrygb bcaym...

output:

query a 1
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query c 1
query d 1
query e 1
query f 1
query g 1
query h 1
query i 1
query i 2
query i 4
query i 8
query i 16
query i 32
query i 64
query i 128
query j 1
query k 1
query l 1
query m 1
query m 2
query m 4
...

result:

ok Ok in 2050 k

Test #22:

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

input:

1
1000
0
1 babuzeiopu
2 babuzeiopu baekaudviq
4 babuzeiopu baekaudviq baerbtrcoo bajklhxyid
8 babuzeiopu baekaudviq baerbtrcoo bajklhxyid bajxsdfnaz bakbkywipe bakwsjgopl bamuoeesxn
16 babuzeiopu baekaudviq baerbtrcoo bajklhxyid bajxsdfnaz bakbkywipe bakwsjgopl bamuoeesxn bamvowdurh bapdftjwal baspe...

output:

query a 1
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query b 256
query b 512
query c 1
query d 1
query d 2
query d 4
query d 8
query d 16
query d 32
query d 64
query d 128
query d 256
query d 512
query e 1
query f 1
query f 2
query f 4
query f 8
query f 16
q...

result:

ok Ok in 3500 k

Test #23:

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

input:

1
1000
1 aahisutiku
2 aahisutiku aakxjvgzfg
4 aahisutiku aakxjvgzfg aamvtdufhl aaprijqexs
8 aahisutiku aakxjvgzfg aamvtdufhl aaprijqexs abeysgmdvz abkhygxbld abyfnocctt acboavgdvp
16 aahisutiku aakxjvgzfg aamvtdufhl aaprijqexs abeysgmdvz abkhygxbld abyfnocctt acboavgdvp acrpgutmfc adaavgwzbu adkpbom...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query d 1
query e 1
query e 2
query f 1
query...

result:

ok Ok in 3517 k

Test #24:

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

input:

1
1000
1 adwrfxvqth
2 adwrfxvqth akykuvdgif
4 adwrfxvqth akykuvdgif aosgchfnkc apmnedzewx
8 adwrfxvqth akykuvdgif aosgchfnkc apmnedzewx arjntqhinl arkgjayddx avjczjvyww awvoeoenja
8 adwrfxvqth akykuvdgif aosgchfnkc apmnedzewx arjntqhinl arkgjayddx avjczjvyww awvoeoenja
1 bariprplmb
2 bariprplmb bbde...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query d 1
query e 1
query e 2
query e 4
query e 8
query e 16
query e 32
query e 64
query e 128
query e...

result:

ok Ok in 2270 k

Test #25:

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

input:

1
1000
0
0
1 cbepuznjbc
2 cbepuznjbc cbilnwqszh
4 cbepuznjbc cbilnwqszh cbnhflckuo cbrqmcwarn
8 cbepuznjbc cbilnwqszh cbnhflckuo cbrqmcwarn cbrwvaeoqj cbuvzuspvx cbvbibnvnn cdjdgylqpc
16 cbepuznjbc cbilnwqszh cbnhflckuo cbrqmcwarn cbrwvaeoqj cbuvzuspvx cbvbibnvnn cdjdgylqpc cdplbcgtyo cduoxeltku cdz...

output:

query a 1
query b 1
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query d 1
query e 1
query f 1
query g 1
query h 1
query i 1
query j 1
query j 2
query j 4
query j 8
query j 16
query j 32
query k 1
query l 1
query l 2
query l 4
query l 8
query l 16
query l 32
query l 64
qu...

result:

ok Ok in 2043 k

Test #26:

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

input:

1
1000
0
1 babktgvctu
2 babktgvctu bacckliudy
4 babktgvctu bacckliudy badycnijil baetozsvwo
8 babktgvctu bacckliudy badycnijil baetozsvwo bafkjjimwe bahqwfghge bakdzdncvx bakxnjuted
16 babktgvctu bacckliudy badycnijil baetozsvwo bafkjjimwe bahqwfghge bakdzdncvx bakxnjuted balwwpmrvk bamtkbtrfg baomi...

output:

query a 1
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query b 256
query b 512
query b 1000
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query d 1
query e 1
query f 1
query g 1
query h 1
query i 1
query j 1
query k 1
query l 1
query...

result:

ok Ok in 3576 k

Test #27:

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

input:

1
1000
1 anpmcjtvhc
1 anpmcjtvhc
1 babqiytdti
2 babqiytdti backovxsdu
4 babqiytdti backovxsdu bacnnmlgfv badvigqcqh
8 babqiytdti backovxsdu bacnnmlgfv badvigqcqh bafemlfuaz bafvsugtiw bagguxpimu bagwdcjohm
16 babqiytdti backovxsdu bacnnmlgfv badvigqcqh bafemlfuaz bafvsugtiw bagguxpimu bagwdcjohm bah...

output:

query a 1
query a 2
query b 1
query b 2
query b 4
query b 8
query b 16
query b 32
query b 64
query b 128
query b 256
query b 512
query c 1
query c 2
query d 1
query e 1
query e 2
query e 4
query e 8
query e 16
query e 32
query e 64
query e 128
query e 256
query e 512
query e 675
query f 1
query g 1
...

result:

ok Ok in 2973 k

Test #28:

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

input:

1
1000
0
0
1 cadaytkjkd
2 cadaytkjkd cafzgsqgfu
4 cadaytkjkd cafzgsqgfu caqlhlglip casxpxqqoa
8 cadaytkjkd cafzgsqgfu caqlhlglip casxpxqqoa catxklbkrn caxsnclszq cayihgbkpv cbbdesifkj
16 cadaytkjkd cafzgsqgfu caqlhlglip casxpxqqoa catxklbkrn caxsnclszq cayihgbkpv cbbdesifkj cbggreijir cbghfxiqvo cbl...

output:

query a 1
query b 1
query c 1
query c 2
query c 4
query c 8
query c 16
query c 32
query c 64
query c 128
query c 256
query d 1
query e 1
query e 2
query e 4
query e 8
query e 16
query e 32
query e 64
query e 128
query e 256
query f 1
query g 1
query g 2
query h 1
query i 1
query j 1
query k 1
query ...

result:

ok Ok in 3047 k

Test #29:

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

input:

1
1000
0
1 bbebxtglxm
2 bbebxtglxm bdzpwcbwvo
4 bbebxtglxm bdzpwcbwvo bfurjatycr bmfsbdoxww
7 bbebxtglxm bdzpwcbwvo bfurjatycr bmfsbdoxww bpfvjcmlct bpmixrqzfb bylpzqlgxq
0
0
0
0
0
0
1 iabmdmtywa
2 iabmdmtywa iaemjvkjdy
4 iabmdmtywa iaemjvkjdy iakpsrcnhb iaowsmpxps
8 iabmdmtywa iaemjvkjdy iakpsrcnhb...

output:

query a 1
query b 1
query b 2
query b 4
query b 8
query c 1
query d 1
query e 1
query f 1
query g 1
query h 1
query i 1
query i 2
query i 4
query i 8
query i 16
query i 32
query i 64
query i 128
query i 256
query j 1
query k 1
query k 2
query k 4
query l 1
query l 2
query l 4
query l 8
query l 16
qu...

result:

ok Ok in 3350 k

Test #30:

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

input:

1
1000
0
0
0
1 dkthhcxrcq
1 dkthhcxrcq
1 eakgfiehic
2 eakgfiehic eaqjfngdky
4 eakgfiehic eaqjfngdky ebgxwpmnxx ebidmjgczs
8 eakgfiehic eaqjfngdky ebgxwpmnxx ebidmjgczs ebubwrmjdc ecdjuyzyjs ecmzzanhuc ecsnhvefww
16 eakgfiehic eaqjfngdky ebgxwpmnxx ebidmjgczs ebubwrmjdc ecdjuyzyjs ecmzzanhuc ecsnhvef...

output:

query a 1
query b 1
query c 1
query d 1
query d 2
query e 1
query e 2
query e 4
query e 8
query e 16
query e 32
query e 64
query e 128
query f 1
query f 2
query g 1
query h 1
query h 2
query i 1
query i 2
query j 1
query j 2
query j 4
query j 8
query j 16
query j 32
query j 64
query k 1
query k 2
qu...

result:

ok Ok in 2142 k

Test #31:

score: -100
Time Limit Exceeded

input:

5
1000
1 aaaiqwexnq
2 aaaiqwexnq aadjcquqdq
4 aaaiqwexnq aadjcquqdq aafaldvvzr aaflmsydwu
8 aaaiqwexnq aadjcquqdq aafaldvvzr aaflmsydwu aafwzaqmhr aafypzoakd aahtirtmve aaitvirspt
16 aaaiqwexnq aadjcquqdq aafaldvvzr aaflmsydwu aafwzaqmhr aafypzoakd aahtirtmve aaitvirspt aajkhyjujl aajwmyiykc aamnvri...

output:

query a 1
query a 2
query a 4
query a 8
query a 16
query a 32
query a 64
query a 128
query a 256
query a 512
query a 1000
answer aaaiqwexnq aadjcquqdq aafaldvvzr aaflmsydwu aafwzaqmhr aafypzoakd aahtirtmve aaitvirspt aajkhyjujl aajwmyiykc aamnvriles aamotubelz aanjhaxtjv aanpnufnlu aanxeqwcui aaorah...

result: