# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
238562 | 2020-06-11T21:30:42 Z | vankata | Trener (COCI20_trener) | C++14 | 363 ms | 28408 KB |
#include<bits/stdc++.h> using namespace std; const int MAXN = 2048; const int MOD = (int)(1e9+7); map<string,int>mp; long long n,k; void read() { int i,j,l; long long ans = 0; cin>>n>>k; string s,t,q; int lm=0; for(i=0;i<n;i++) { for(j=0;j<k;j++) { cin>>s; if(!i)mp[s]=1; if(i==n-1) { ans+=mp[s]; ans%=MOD; continue; } lm=0; for(l=1;l<s.size();l++) if(s[i]!=s[i-1])lm=true; for(l=0;l<26;l++) { t=s+char('a'+l); q=char('a'+l)+s; mp[t]+=mp[s]; mp[t]%=MOD; mp[q]+=mp[s]; mp[q]%=MOD; } if(lm==false) { t=s+s[0]; mp[t]--; mp[t]+=MOD; mp[t]%=MOD; } } } cout<<ans<<endl; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); read(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 512 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 6 ms | 512 KB | Output is correct |
4 | Incorrect | 5 ms | 384 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 363 ms | 28408 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 512 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 6 ms | 512 KB | Output is correct |
4 | Incorrect | 5 ms | 384 KB | Output isn't correct |