# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96572 | 2019-02-10T10:43:34 Z | allllekssssa | Parametriziran (COCI19_parametriziran) | C++14 | 1528 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 | 22 ms | 5228 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 4564 KB | Output is correct |
2 | Correct | 28 ms | 4304 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 4380 KB | Output is correct |
2 | Correct | 40 ms | 5992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 61 ms | 4848 KB | Output is correct |
2 | Correct | 40 ms | 4308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 70 ms | 5168 KB | Output is correct |
2 | Correct | 71 ms | 4068 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 276 ms | 6784 KB | Output is correct |
2 | Correct | 80 ms | 4656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 376 ms | 5072 KB | Output is correct |
2 | Correct | 121 ms | 4356 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 610 ms | 6600 KB | Output is correct |
2 | Correct | 327 ms | 5432 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 982 ms | 5384 KB | Output is correct |
2 | Correct | 218 ms | 4416 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1528 ms | 6136 KB | Output is correct |
2 | Correct | 820 ms | 5468 KB | Output is correct |