# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
845224 | 2023-09-06T12:40:34 Z | vjudge1 | Trener (COCI20_trener) | C++17 | 13 ms | 2532 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define all(aa) aa.begin(), aa.end() const int mod=1e9+7; int main(){ int n, k; cin>>n>>k; int ans; map<string, int> dp, cnt; for(int j=0; j<k; j++){ string s; cin>>s; dp[s]=1; cnt[s]++; } for(int i=1; i<n; i++){ ans=0; for(int j=0; j<k; j++){ string s; cin>>s; cnt[s]++; string a(s.begin(), s.end()-1), b(s.begin()+1, s.end()); if(a==b) dp[s]=dp[a]*cnt[a]; else dp[s]=(dp[a]*cnt[a]+dp[b]*cnt[b])%mod; ans=(ans+dp[s])%mod; } } cout<<ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 2432 KB | Output is correct |
2 | Correct | 13 ms | 2532 KB | Output is correct |
3 | Correct | 13 ms | 2396 KB | Output is correct |
4 | Incorrect | 4 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 13 ms | 2432 KB | Output is correct |
6 | Correct | 13 ms | 2532 KB | Output is correct |
7 | Correct | 13 ms | 2396 KB | Output is correct |
8 | Incorrect | 4 ms | 348 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |