Submission #475220

#TimeUsernameProblemLanguageResultExecution timeMemory
475220keta_tsimakuridzeAnagramistica (COCI21_anagramistica)C++14
0 / 110
5 ms6476 KiB
#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 (stderr)

anagramistica.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...