Submission #483709

#TimeUsernameProblemLanguageResultExecution timeMemory
483709sam571128Anagramistica (COCI21_anagramistica)C++17
10 / 110
30 ms332 KiB
#include <bits/stdc++.h> #define int long long #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; signed main(){ fastio int n,k; cin >> n >> k; vector<string> v; for(int i = 0;i < n;i++){ string s; cin >> s; sort(s.begin(),s.end()); v.push_back(s); } int ans = 0; for(int i = 0;i < (1<<n);i++){ map<string,int> m; for(int j = 0;j < n;j++){ if(i&(1<<j)) m[v[j]]++; } int tmp = 0; for(auto [a,b] : m){ tmp += b*(b-1)/2; } if(tmp==k) ans++; } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...