How to provide new test to hack solutions after contest?

Revision en1, by zhangky, 2021-06-21 16:41:14

I solve a problem1538E — Funny Substrings. But I found a new test to hack myself. The hack test is :

input 1 4 a := h b := ahaabc c = b + a d = a + c

output 1

But my code output 0. I want provide these test but I don't know how to provide my test. My submissions id is 120211661. There is my code. ~~~~~

include

include

include

include

include

include

define int long long

using namespace std;

struct Node{ int val; string pre,suf; Node(string _s="") { val=0; int len=min((int)_s.size(),3ll); if(_s.size()!=0)pre=_s.substr(0ll,len); if(_s.size()!=0)suf=_s.substr(max((int)_s.size()-3,0ll),len); for(int i=0;i<=(int)(_s.size()-4ll);i++) { if(_s.substr(i,4)=="haha") ++val; } } friend Node operator + (Node a,Node b) { Node ret=Node(); if(a.pre.size()<3||b.pre.size()<3) { ret=Node(a.suf+b.pre); ret.val+=a.val+b.val; } else { ret.pre=a.pre;ret.suf=b.suf; ret.val=a.val+b.val+Node(a.suf+b.pre).val; } return ret; }

};

int t,n;

signed main() { // freopen("in.txt", "r", stdin); cin>>t; while(t--) { cin>>n; map<string,Node>mp; string last; while(n--) { string x,opt; cin>>x>>opt; last=x; if(opt==":=") { string s; cin>>s; mp[x]=Node(s); } else { string s1,s2; cin>>s1>>s2>>s2; mp[x]=mp[s1]+mp[s2]; } } cout<<mp[last].val<<'\n'; } return 0; } ~~~~~

Tags #hack

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en8 English zhangky 2021-06-21 16:44:24 0 (published)
en7 English zhangky 2021-06-21 16:43:50 30
en6 English zhangky 2021-06-21 16:43:30 22
en5 English zhangky 2021-06-21 16:42:56 18
en4 English zhangky 2021-06-21 16:42:36 10
en3 English zhangky 2021-06-21 16:42:11 14
en2 English zhangky 2021-06-21 16:41:47 4
en1 English zhangky 2021-06-21 16:41:14 1604 Initial revision (saved to drafts)