제출 #1124091

#제출 시각아이디문제언어결과실행 시간메모리
1124091ezzzayTrener (COCI20_trener)C++20
110 / 110
190 ms16340 KiB
#include<bits/stdc++.h> using namespace std; map<string,long long int>ma; map<string,long long int>::iterator it; int main(){ int a,b,mod=1e9+7,ans=0; string g; cin>>a>>b; for(int i=0;i<b;i++){ cin>>g; ma[g]+=1; } for(int i=2;i<=a;i++){ for(int h=0;h<b;h++){ cin>>g; string temp1=g.substr(0,i-1),temp2=g.substr(1,i-1); if(temp1==temp2) ma[g]+=ma[temp1]; else ma[g]+=ma[temp1]+ma[temp2]; ma[g]%=mod; } } for(it=ma.begin();it!=ma.end();it++){ if(it->first.size()==a){ ans+=it->second; ans%=mod; } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...