QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#191464#7531. Hacking the ProjectDays_of_Future_Past#AC ✓6ms3996kbC++142.6kb2023-09-29 23:20:122023-09-29 23:20:13

Judging History

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

  • [2023-09-29 23:20:13]
  • 评测
  • 测评结果:AC
  • 用时:6ms
  • 内存:3996kb
  • [2023-09-29 23:20:12]
  • 提交

answer

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

using namespace std;

const int N = 1111;

typedef pair<int, int> pii;

double dp[N];
vector<int> opt_qry_sizes[N];

void build() {
  for (int U = 1; U <= 1000; ++U) {
    for (int i = 1; i <= U; ++i)
      dp[i] = 3.78 * i;
    int cur = 0, mx = 0;
    //if (U % 100 == 0)
      //printf("U=%d: ", U);
    //opt_qry_sizes[U].push_back(1);
    for (int i = 1; i <= U; ++i) {
      assert(dp[i] - cur >= 0);
      if (i >= mx) {
        if (i == U) {
          if (mx < U)
            opt_qry_sizes[U].push_back(U);
          break;
        }
        int tmp = min(int(dp[i] - cur), U);
        if (tmp < i)
          printf("fail@ U %d i %d\n", U, i);
        assert(tmp >= i);
        if (tmp > mx) {
          //if (U % 100 == 0)
            //printf(" %d", tmp);
          opt_qry_sizes[U].push_back(tmp);
          cur += tmp;
          mx = tmp;
        }
      }
    }
    //if (U % 100 == 0)
      //printf("\n");
  }
}

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

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() {
  if (ONLINE) {
    scanf("%d", &n);
  } else {
    n = SZ(groundtruth);
  }
  for (int c = 0; c < 26; ++c)
    ans[c].clear();
  int remaining = n;
  for (int c = 0; c < 26; ++c) {
    ans[c] = query('a' + c, 1);
    if (SZ(ans[c]) == 0)
      continue;
    for (int guess: opt_qry_sizes[remaining]) {
      if (guess == 1)
        break;
      ans[c] = query('a' + c, guess);
      if (SZ(ans[c]) < guess || SZ(ans[c]) == remaining) {
        break;
      }
    }
    remaining -= SZ(ans[c]);
    if (remaining == 0)
      break;
  }
  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;
  if (ONLINE) {
    scanf("%d", &tc);
  } else {
    tc = 1;
  }
  while (tc--) {
    main2();
  }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3756kb

input:

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

output:

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

result:

ok Ok in 8 k

Test #2:

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

input:

5
1000
1 a
3 a aajm aavfegkci
8 a aajm aavfegkci aavj abjc abnxwsy abzbr acvd
19 a aajm aavfegkci aavj abjc abnxwsy abzbr acvd adrvb af afbxpytbe afl afwsjfu aigwxskrks aimpdesf ajbq alsqmc alswxsm anmkcljvyy
41 a aajm aavfegkci aavj abjc abnxwsy abzbr acvd adrvb af afbxpytbe afl afwsjfu aigwxskrks ...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query b 1
query b 3
query b 8
query b 19
query b 41
query c 1
query c 3
query c 8
query c 19
query c 41
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
query e 1
query e 3
query e 8
query e 19
query e 41
query f 1
query f ...

result:

ok Ok in 2831 k

Test #3:

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

input:

5
1000
1 acbd
3 acbd acgts acvdflmn
8 acbd acgts acvdflmn admkf aehzdl aepocjmc afaeqq afbqeawd
19 acbd acgts acvdflmn admkf aehzdl aepocjmc afaeqq afbqeawd afjb agrfnq ahrhdp aidg aimp aiqana ajb akwm alilyzhysa alkb amljwn
37 acbd acgts acvdflmn admkf aehzdl aepocjmc afaeqq afbqeawd afjb agrfnq ah...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query b 1
query b 3
query b 8
query b 19
query b 41
query c 1
query c 3
query c 8
query c 19
query c 41
query d 1
query d 3
query d 8
query d 19
query d 41
query e 1
query e 3
query e 8
query e 19
query e 41
query f 1
query f 3
query f 8
query f 19...

result:

ok Ok in 2702 k

Test #4:

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

input:

5
1000
1 aaxqvzig
3 aaxqvzig abbaep actfxtivf
8 aaxqvzig abbaep actfxtivf adt adtl aer afa agfev
19 aaxqvzig abbaep actfxtivf adt adtl aer afa agfev agluptr ahci ahdfhfr aiympo ajjcvjb ajkux akq alnoiph alsq alxz amtx
40 aaxqvzig abbaep actfxtivf adt adtl aer afa agfev agluptr ahci ahdfhfr aiympo aj...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query b 1
query b 3
query b 8
query b 19
query b 41
query c 1
query c 3
query c 8
query c 19
query c 41
query d 1
query d 3
query d 8
query d 19
query d 41
query e 1
query e 3
query e 8
query e 19
query e 41
query e 83
query f 1
query f 3
query f 8...

result:

ok Ok in 2614 k

Test #5:

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

input:

5
1000
1 a
3 a aalilyz ac
8 a aalilyz ac acb adcogtni adroq aepocjm aevi
19 a aalilyz ac acb adcogtni adroq aepocjm aevi af aguwuvh agxaaac ahuwl ahxy aiafmv aisyr ajuqw ake amdjxnsmk amgcifdlj
36 a aalilyz ac acb adcogtni adroq aepocjm aevi af aguwuvh agxaaac ahuwl ahxy aiafmv aisyr ajuqw ake amdjx...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query b 1
query b 3
query b 8
query b 19
query b 41
query c 1
query c 3
query c 8
query c 19
query c 41
query d 1
query d 3
query d 8
query d 19
query d 41
query e 1
query e 3
query e 8
query e 19
query e 41
query e 83
query f 1
query f 3
query f 8...

result:

ok Ok in 2698 k

Test #6:

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

input:

5
1000
1 abvmqw
3 abvmqw acgt acoogjx
8 abvmqw acgt acoogjx adrvbejoo ae aeqv af afb
19 abvmqw acgt acoogjx adrvbejoo ae aeqv af afb afdktn aggcwzid aibg aimgcusle aiymp ajuqm al alk amklrwl amncorb anaztksn
35 abvmqw acgt acoogjx adrvbejoo ae aeqv af afb afdktn aggcwzid aibg aimgcusle aiymp ajuqm a...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query c 1
query c 3
query c 8
query c 19
query c 41
query d 1
query d 3
query d 8
query d 19
query d 41
query e 1
query e 3
query e 8
query e 19
query e 41
query f 1
query f 3
query f 8...

result:

ok Ok in 2615 k

Test #7:

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

input:

5
1000
1 aavfeg
3 aavfeg abogkwk abpwnr
8 aavfeg abogkwk abpwnr abqlngdsc acbdx adgeed aerm aevi
19 aavfeg abogkwk abpwnr abqlngdsc acbdx adgeed aerm aevi aexjyu afascs afbqeawdi afkxyfmcn afvmu agmm agwdwxsu aigw aimg aitmxp aiy
41 aavfeg abogkwk abpwnr abqlngdsc acbdx adgeed aerm aevi aexjyu afasc...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query b 1
query b 3
query b 8
query b 19
query b 41
query c 1
query c 3
query c 8
query c 19
query c 41
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
query e 1
query e 3
query e 8
query e 19
query e 41
query f 1
query f ...

result:

ok Ok in 2702 k

Test #8:

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

input:

5
1000
1 a
3 a aaac aac
8 a aaac aac aadrvbej aay abwun abz acb
19 a aaac aac aadrvbej aay abwun abz acb acn acqx actyaovq acvdf adgeedjk af ahnzdw ahxylcgn aidvvi aisyr aivtmpqz
41 a aaac aac aadrvbej aay abwun abz acb acn acqx actyaovq acvdf adgeedjk af ahnzdw ahxylcgn aidvvi aisyr aivtmpqz al an ...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query b 1
query b 3
query b 8
query b 19
query b 41
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
query e 1
query e 3
query e 8
query e 19
query e 41
query f...

result:

ok Ok in 2865 k

Test #9:

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

input:

5
1000
1 aaciqgnc
3 aaciqgnc aawtbc aayipsoj
8 aaciqgnc aawtbc aayipsoj abqlngds acf acqrs actad adrv
19 aaciqgnc aawtbc aayipsoj abqlngds acf acqrs actad adrv adxm aexjy agnn agwdwxs ai aid aif aijelh aj ajrnwj akevsjo
41 aaciqgnc aawtbc aayipsoj abqlngds acf acqrs actad adrv adxm aexjy agnn agwdwx...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query c 1
query c 3
query c 8
query c 19
query c 41
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
query e 1
query e 3
query e 8
query e 19
query e 41
query f...

result:

ok Ok in 2780 k

Test #10:

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

input:

5
1000
1 aagxaa
3 aagxaa abjc acg
8 aagxaa abjc acg aciqg acnhpzn acvdfl adtninwc aehz
19 aagxaa abjc acg aciqg acnhpzn acvdfl adtninwc aehz aek aeqqojyp aevibe aexjyulg afbxp afl aguwuv ahcipz aijelhy aixws ajuldlwr
39 aagxaa abjc acg aciqg acnhpzn acvdfl adtninwc aehz aek aeqqojyp aevibe aexjyulg ...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query c 1
query c 3
query c 8
query c 19
query c 41
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
query e 1
query e 3
query e 8
query e 19
query e 41
query f 1
query f ...

result:

ok Ok in 2868 k

Test #11:

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

input:

5
1000
1 aadbd
3 aadbd aadbg aaemf
8 aadbd aadbg aaemf aaepzchvxg aapihz aaqjqvgx aazfccep aaznfe
19 aadbd aadbg aaemf aaepzchvxg aapihz aaqjqvgx aazfccep aaznfe abakwq abbwcmdh abdhdofrs abdjlpez abeaa abezgbabhd abgbpa abhkmvmahb abhtaev abicf absaa
41 aadbd aadbg aaemf aaepzchvxg aapihz aaqjqvgx ...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
query e 1
query e 3
quer...

result:

ok Ok in 2685 k

Test #12:

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

input:

5
1000
1 aabwpote
3 aabwpote aaclnnc aadjkgs
8 aabwpote aaclnnc aadjkgs aaemccd aapihztr aavaacml aazdodzr abbaeuada
19 aabwpote aaclnnc aadjkgs aaemccd aapihztr aavaacml aazdodzr abbaeuada abbriejjk abbzfui abcdocbn abicfcs abjcdznj abkcmdgj abrlkfgb abuesdgjja abzegbl abzgbaz acfkbefq
41 aabwpote ...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query a 159
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
query e 1
qu...

result:

ok Ok in 2901 k

Test #13:

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

input:

5
1000
1 aaaac
3 aaaac aabcfn aacafh
8 aaaac aabcfn aacafh aacklaael aacqahce aadaagbh aadneaeg aaeahnfag
19 aaaac aabcfn aacafh aacklaael aacqahce aadaagbh aadneaeg aaeahnfag aaedi aaegsqcag aafbkbfcra aaffddb aagecekeae aaghla aagpa aajdhjlba aakbae aakcbfobaa aaldd
41 aaaac aabcfn aacafh aacklaae...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query a 159
query a 288
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
...

result:

ok Ok in 3109 k

Test #14:

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

input:

5
1000
1 aabbhcc
3 aabbhcc aabfaakbdp aabpmcgoa
8 aabbhcc aabfaakbdp aabpmcgoa aabzaecvji aadcaoscc aadcbqgafi aaeizjcec aafaedcb
19 aabbhcc aabfaakbdp aabpmcgoa aabzaecvji aadcaoscc aadcbqgafi aaeizjcec aafaedcb aafbefhcab aafbygbcc aagobdhafb aajhdbdlm aakbaezd aakcbfob aalddlb aapbkagbc aazaqjecc...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query a 159
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
query e 1
qu...

result:

ok Ok in 2877 k

Test #15:

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

input:

5
1000
1 aaaaaibb
3 aaaaaibb aaabaa aaabceaid
8 aaaaaibb aaabaa aaabceaid aaabf aaagbba aaagpabe aaahcab aaamdca
19 aaaaaibb aaabaa aaabceaid aaabf aaagbba aaagpabe aaahcab aaamdca aabhbhbf aabhdl aabicbiaa aabjcngb aacafh aacdcaca aacia aaclg aadbb aadfqjoead aadhbkb
41 aaaaaibb aaabaa aaabceaid aa...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query a 159
query a 288
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query b 288
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query d 3
query d 8
query d 19
query d 41...

result:

ok Ok in 2866 k

Test #16:

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

input:

5
1000
1 aaabfdi
3 aaabfdi aaabied aaacbfg
8 aaabfdi aaabied aaacbfg aaaeebaf aaafbeabii aaagbbabh aaaqpbb aaaudai
19 aaabfdi aaabied aaacbfg aaaeebaf aaafbeabii aaagbbabh aaaqpbb aaaudai aabaabge aabbbdc aabcehac aabeabfacb aabedfk aacaeaaeac aaccfdc aacgdicaa aacgebfcba aachaad aaclgja
41 aaabfdi ...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query a 159
query a 288
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
...

result:

ok Ok in 3102 k

Test #17:

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

input:

5
1000
1 aaaab
3 aaaab aaaad aaaaeddca
8 aaaab aaaad aaaaeddca aaabceaed aaabf aaacbaa aaaedfecd aaafd
19 aaaab aaaad aaaaeddca aaabceaed aaabf aaacbaa aaaedfecd aaafd aaafdegda aaamaab aaanae aabaacfca aabajbdbda aabak aabbgddaaa aabca aabcbacdc aabhbhbf aabjga
41 aaaab aaaad aaaaeddca aaabceaed aa...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query a 159
query a 288
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query b 288
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query d 3
query d 8
query d 19
query d 41...

result:

ok Ok in 2700 k

Test #18:

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

input:

5
1000
1 aaaadbaab
3 aaaadbaab aaaagbae aaabhab
8 aaaadbaab aaaagbae aaabhab aaacakhd aaacbcbaqe aaadacda aaadfagae aaaeaaaebr
19 aaaadbaab aaaagbae aaabhab aaacakhd aaacbcbaqe aaadacda aaadfagae aaaeaaaebr aaaeaekea aaaebbdfe aaajbbb aabaabgd aabaeefbfa aabakfbeb aabbaaai aabbbbcfbj aabcaag aabceab...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query a 159
query a 288
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query b 288
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query d 3
query d 8
query d 19
query d 41...

result:

ok Ok in 2814 k

Test #19:

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

input:

5
1000
1 aaaaaedd
3 aaaaaedd aaaab aaaabb
8 aaaaaedd aaaab aaaabb aaaabc aaaadda aaaaeabb aaabaa aaabbcaabh
19 aaaaaedd aaaab aaaabb aaaabc aaaadda aaaaeabb aaabaa aaabbcaabh aaabbncfba aaabd aaabeda aaabi aaacaad aaackaaee aaadbaab aaadbc aaaddb aaafbfdkd aaafdf
41 aaaaaedd aaaab aaaabb aaaabc aaaa...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query a 159
query a 288
query a 487
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query b 288
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query d 3
query d 8
query d 1...

result:

ok Ok in 2952 k

Test #20:

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

input:

5
1000
1 aaaaaaakf
3 aaaaaaakf aaaaaadda aaaaacf
8 aaaaaaakf aaaaaadda aaaaacf aaaacaabc aaaadbaa aaaafaia aaaafeaeeb aaabbcaa
19 aaaaaaakf aaaaaadda aaaaacf aaaacaabc aaaadbaa aaaafaia aaaafeaeeb aaabbcaa aaabceaaa aaabdbb aaabeda aaabiaagh aaacbcbaqe aaacbdf aaaceaa aaadacaa aaadeab aaadmaa aaaedc...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query a 159
query a 288
query a 487
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query b 288
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query d 3
query d 8
query d 1...

result:

ok Ok in 2989 k

Test #21:

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

input:

1
1000
0
1 bagaoguesy
3 bagaoguesy bajdjjxkus bamxlzqrbg
8 bagaoguesy bajdjjxkus bamxlzqrbg baqstjbgkd baxomczwvf bbcczeqbln bbfivcdxcq bbkdokgwfw
19 bagaoguesy bajdjjxkus bamxlzqrbg baqstjbgkd baxomczwvf bbcczeqbln bbfivcdxcq bbkdokgwfw bbmbmkokgs bbvoexrygb bcaymppyki bcmiphiusu bcmxmroxcd bdbyzxw...

output:

query a 1
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query c 1
query d 1
query e 1
query f 1
query g 1
query h 1
query i 1
query i 3
query i 8
query i 19
query i 41
query i 83
query i 159
query j 1
query k 1
query l 1
query m 1
query m 3
query m 8
query m 19
query m 4...

result:

ok Ok in 2837 k

Test #22:

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

input:

1
1000
0
1 babuzeiopu
3 babuzeiopu baekaudviq baerbtrcoo
8 babuzeiopu baekaudviq baerbtrcoo bajklhxyid bajxsdfnaz bakbkywipe bakwsjgopl bamuoeesxn
19 babuzeiopu baekaudviq baerbtrcoo bajklhxyid bajxsdfnaz bakbkywipe bakwsjgopl bamuoeesxn bamvowdurh bapdftjwal baspeslstz batmiwceso bbcbfvdhfu bbdzcic...

output:

query a 1
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query b 288
query c 1
query d 1
query d 3
query d 8
query d 19
query d 41
query d 83
query d 159
query d 288
query e 1
query f 1
query f 3
query f 8
query f 19
query f 41
query g 1
query h 1
query i 1
query j 1
quer...

result:

ok Ok in 2365 k

Test #23:

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

input:

1
1000
1 aahisutiku
3 aahisutiku aakxjvgzfg aamvtdufhl
8 aahisutiku aakxjvgzfg aamvtdufhl aaprijqexs abeysgmdvz abkhygxbld abyfnocctt acboavgdvp
19 aahisutiku aakxjvgzfg aamvtdufhl aaprijqexs abeysgmdvz abkhygxbld abyfnocctt acboavgdvp acrpgutmfc adaavgwzbu adkpbomane adpyjhbwrv aekrlovqls aermhtyec...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query d 1
query e 1
query e 3
query f 1
query g 1
query g 3
query g 8
query g 19
query g 41
query g 83
query h ...

result:

ok Ok in 2935 k

Test #24:

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

input:

1
1000
1 adwrfxvqth
3 adwrfxvqth akykuvdgif aosgchfnkc
8 adwrfxvqth akykuvdgif aosgchfnkc apmnedzewx arjntqhinl arkgjayddx avjczjvyww awvoeoenja
8 adwrfxvqth akykuvdgif aosgchfnkc apmnedzewx arjntqhinl arkgjayddx avjczjvyww awvoeoenja
1 bariprplmb
3 bariprplmb bbdehlqkie bbdnupnpqe
8 bariprplmb bbde...

output:

query a 1
query a 3
query a 8
query a 19
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query c 1
query c 3
query c 8
query c 19
query d 1
query e 1
query e 3
query e 8
query e 19
query e 41
query e 83
query e 159
query e 288
query f 1
query f 3
query f 8
query f 19
query...

result:

ok Ok in 2374 k

Test #25:

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

input:

1
1000
0
0
1 cbepuznjbc
3 cbepuznjbc cbilnwqszh cbnhflckuo
8 cbepuznjbc cbilnwqszh cbnhflckuo cbrqmcwarn cbrwvaeoqj cbuvzuspvx cbvbibnvnn cdjdgylqpc
19 cbepuznjbc cbilnwqszh cbnhflckuo cbrqmcwarn cbrwvaeoqj cbuvzuspvx cbvbibnvnn cdjdgylqpc cdplbcgtyo cduoxeltku cdzalgjsmw cejvnqvmhl celaublikb cerew...

output:

query a 1
query b 1
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query d 1
query e 1
query f 1
query g 1
query h 1
query i 1
query j 1
query j 3
query j 8
query j 19
query j 41
query k 1
query l 1
query l 3
query l 8
query l 19
query l 41
query l 83
query l 159
query l 288
query l ...

result:

ok Ok in 3019 k

Test #26:

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

input:

1
1000
0
1 babktgvctu
3 babktgvctu bacckliudy badycnijil
8 babktgvctu bacckliudy badycnijil baetozsvwo bafkjjimwe bahqwfghge bakdzdncvx bakxnjuted
19 babktgvctu bacckliudy badycnijil baetozsvwo bafkjjimwe bahqwfghge bakdzdncvx bakxnjuted balwwpmrvk bamtkbtrfg baomixiagc baoqpmlyvb bapyoakqbf bapytic...

output:

query a 1
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query b 288
query b 487
query b 752
query c 1
query c 3
query c 8
query c 19
query c 41
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 m 1
query n 1
query o 1
query o...

result:

ok Ok in 2866 k

Test #27:

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

input:

1
1000
1 anpmcjtvhc
1 anpmcjtvhc
1 babqiytdti
3 babqiytdti backovxsdu bacnnmlgfv
8 babqiytdti backovxsdu bacnnmlgfv badvigqcqh bafemlfuaz bafvsugtiw bagguxpimu bagwdcjohm
19 babqiytdti backovxsdu bacnnmlgfv badvigqcqh bafemlfuaz bafvsugtiw bagguxpimu bagwdcjohm bahoawcolg balfvfqttv balnimeoft banmi...

output:

query a 1
query a 3
query b 1
query b 3
query b 8
query b 19
query b 41
query b 83
query b 159
query b 288
query b 487
query c 1
query c 3
query d 1
query e 1
query e 3
query e 8
query e 19
query e 41
query e 83
query e 159
query e 288
query e 487
query e 675
query f 1
query g 1
query h 1
query i 1
...

result:

ok Ok in 3138 k

Test #28:

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

input:

1
1000
0
0
1 cadaytkjkd
3 cadaytkjkd cafzgsqgfu caqlhlglip
8 cadaytkjkd cafzgsqgfu caqlhlglip casxpxqqoa catxklbkrn caxsnclszq cayihgbkpv cbbdesifkj
19 cadaytkjkd cafzgsqgfu caqlhlglip casxpxqqoa catxklbkrn caxsnclszq cayihgbkpv cbbdesifkj cbggreijir cbghfxiqvo cblngggqxz cbnnrjgzpl cbtsxigphe cbycf...

output:

query a 1
query b 1
query c 1
query c 3
query c 8
query c 19
query c 41
query c 83
query c 159
query d 1
query e 1
query e 3
query e 8
query e 19
query e 41
query e 83
query e 159
query f 1
query g 1
query g 3
query h 1
query i 1
query j 1
query k 1
query k 3
query k 8
query k 19
query k 41
query l ...

result:

ok Ok in 2615 k

Test #29:

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

input:

1
1000
0
1 bbebxtglxm
3 bbebxtglxm bdzpwcbwvo bfurjatycr
7 bbebxtglxm bdzpwcbwvo bfurjatycr bmfsbdoxww bpfvjcmlct bpmixrqzfb bylpzqlgxq
0
0
0
0
0
0
1 iabmdmtywa
3 iabmdmtywa iaemjvkjdy iakpsrcnhb
8 iabmdmtywa iaemjvkjdy iakpsrcnhb iaowsmpxps iawwchhbue iaxooljbux ibdlngpkgx ibduaemqdw
19 iabmdmtywa ...

output:

query a 1
query b 1
query b 3
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 3
query i 8
query i 19
query i 41
query i 83
query i 159
query j 1
query k 1
query k 3
query k 8
query l 1
query l 3
query l 8
query l 19
query l 41
query m 1
query n 1
query o 1
que...

result:

ok Ok in 2901 k

Test #30:

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

input:

1
1000
0
0
0
1 dkthhcxrcq
1 dkthhcxrcq
1 eakgfiehic
3 eakgfiehic eaqjfngdky ebgxwpmnxx
8 eakgfiehic eaqjfngdky ebgxwpmnxx ebidmjgczs ebubwrmjdc ecdjuyzyjs ecmzzanhuc ecsnhvefww
19 eakgfiehic eaqjfngdky ebgxwpmnxx ebidmjgczs ebubwrmjdc ecdjuyzyjs ecmzzanhuc ecsnhvefww ectepkuesj ecxteexpsq edamjdhdsc...

output:

query a 1
query b 1
query c 1
query d 1
query d 3
query e 1
query e 3
query e 8
query e 19
query e 41
query e 83
query e 159
query f 1
query f 3
query g 1
query h 1
query h 3
query i 1
query i 3
query j 1
query j 3
query j 8
query j 19
query j 41
query k 1
query k 3
query k 8
query k 19
query k 41
q...

result:

ok Ok in 3029 k

Test #31:

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

input:

5
1000
1 aaaiqwexnq
3 aaaiqwexnq aadjcquqdq aafaldvvzr
8 aaaiqwexnq aadjcquqdq aafaldvvzr aaflmsydwu aafwzaqmhr aafypzoakd aahtirtmve aaitvirspt
19 aaaiqwexnq aadjcquqdq aafaldvvzr aaflmsydwu aafwzaqmhr aafypzoakd aahtirtmve aaitvirspt aajkhyjujl aajwmyiykc aamnvriles aamotubelz aanjhaxtjv aanpnufnl...

output:

query a 1
query a 3
query a 8
query a 19
query a 41
query a 83
query a 159
query a 288
query a 487
query a 752
query a 1000
answer aaaiqwexnq aadjcquqdq aafaldvvzr aaflmsydwu aafwzaqmhr aafypzoakd aahtirtmve aaitvirspt aajkhyjujl aajwmyiykc aamnvriles aamotubelz aanjhaxtjv aanpnufnlu aanxeqwcui aaor...

result:

ok Ok in 3793 k