Submission #999011

#TimeUsernameProblemLanguageResultExecution timeMemory
999011vjudge1Trener (COCI20_trener)C++17
0 / 110
6 ms860 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1e9 + 7; signed main() { int n,k; cin>>n>>k; map<string,int> ans; int fin_ans=0,iv = (mod+1)/2; for (int a=1;a<=n;a++) for (int b=0;b<k;b++) { string s; cin>>s; if (a==1) { ans[s]=1; continue; } int x=0; string s1=s.substr(0,a-1),s2=s.substr(1,a-1); if (ans.find(s1)!=ans.end()) x+=ans[s1]; if (ans.find(s2)!=ans.end()) x+=ans[s2]; x%=mod; if (s1==s2) x=x*iv%mod; ans[s]=x; if (a==n) fin_ans+=x,fin_ans%=mod; } cout<<fin_ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...