# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
104579 | 2019-04-08T07:49:41 Z | Hassoony | Parametriziran (COCI19_parametriziran) | C++17 | 410 ms | 3820 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod=(1e9+7); const ll inf=(1ll<<61); const int MX=50009; int n,m; vector<string>v[(1<<7)]; string s; unordered_map<string,int>vis; char oo[8]; ll ans=0; void add(string s){ int ret=0; string tmp=""; for(int j=0;j<m;j++){ if(s[j]!='?')ret+=(1<<j); } v[ret].push_back(s); } int main(){ cin>>n>>m; for(int i=0;i<n;i++){ scanf("%s",&oo);s=oo; add(s); } for(int i1=0;i1<(1<<m);i1++){ for(int j1=i1+1;j1<(1<<m);j1++){ int mask1=i1,mask2=j1; vis.clear(); for(auto pp:v[mask1]){ string tmp=""; for(int j=0;j<m;j++){ if((mask1&(1<<j))&&(mask2&(1<<j)))tmp+=pp[j]; } vis[tmp]++; } for(auto pp:v[mask2]){ string tmp=""; for(int j=0;j<m;j++){ if((mask1&(1<<j))&&(mask2&(1<<j)))tmp+=pp[j]; } ans+=vis[tmp]; } } } cout<<ans<<endl; } /* 3 3 ??b c?? c?c 4 6 ab??c? ??kll? a?k??c ?bcd?? 5 2 ?? b? c? ?g cg */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 2676 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 1912 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 1780 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 34 ms | 2456 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 83 ms | 3444 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 113 ms | 2464 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 207 ms | 3820 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 266 ms | 3056 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 410 ms | 3568 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |