# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
475220 | 2021-09-21T14:23:30 Z | keta_tsimakuridze | Anagramistica (COCI21_anagramistica) | C++14 | 5 ms | 6476 KB |
#include<bits/stdc++.h> #define f first #define s second #define int long long #define pii pair<int,int> using namespace std; const int N = 2e5 + 5, mod = 1e9 + 7; // ! int t,n,k,dp[N]; map<string,int> cnt; string s[N]; main(){ cin >> n >> k; for(int i = 1; i <= n; i++) { cin >> s[i]; sort(s[i].begin(),s[i].end()); cnt[s[i]]++; } dp[0] = 1; for(int i = 1; i <= n; i++) { for(int j = k; j >= 0; j--) { for(int p = 1; p <= min(j,cnt[s[i]]); p++) dp[j] = (dp[j] + dp[j - p]) % mod; } cnt[s[i]] = 0; } cout << dp[k]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 6476 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 6476 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 6476 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |