# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96573 | 2019-02-10T10:44:06 Z | allllekssssa | Parametriziran (COCI19_parametriziran) | C++11 | 1491 ms | 6784 KB |
#include<bits/stdc++.h> using namespace std; #define pb push_back const int maxi=50000+10; int n,m; string s[maxi]; vector<string> v[maxi]; map<string, int> mp; long long merge(int m1, int m2) { long long ans=0; mp.clear(); for (string str:v[m1]) { string p = ""; for (int j=0;j<m;j++) if ((1<<j)&m1 && (1<<j)&m2) p+=str[j]; mp[p]++; } for (string str:v[m2]) { string p = ""; for (int j=0;j<m;j++) if ((1<<j)&m1 && (1<<j)&m2) p+=str[j]; ans+=mp[p]; } return ans; } int main() { cin>>n>>m; long long ans = 0; for (int i=1;i<=n;i++) { cin>>s[i]; int val = 0; for (int j=0;j<m;j++) if (s[i][j]!='?') val+=1<<j; v[val].pb(s[i]); } for (int i=0;i<(1<<m);i++) { for (int j=0;j<(1<<m);j++) ans+= merge(i,j); } ans-=n; cout<<ans/2<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 5224 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 4592 KB | Output is correct |
2 | Correct | 22 ms | 4204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 4428 KB | Output is correct |
2 | Correct | 47 ms | 6044 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 56 ms | 4804 KB | Output is correct |
2 | Correct | 40 ms | 4280 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 80 ms | 5168 KB | Output is correct |
2 | Correct | 67 ms | 4000 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 263 ms | 6784 KB | Output is correct |
2 | Correct | 89 ms | 4656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 397 ms | 5236 KB | Output is correct |
2 | Correct | 109 ms | 4460 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 628 ms | 6684 KB | Output is correct |
2 | Correct | 318 ms | 5232 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 978 ms | 5400 KB | Output is correct |
2 | Correct | 224 ms | 4376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1491 ms | 6152 KB | Output is correct |
2 | Correct | 816 ms | 5416 KB | Output is correct |