Submission #96572

#TimeUsernameProblemLanguageResultExecution timeMemory
96572allllekssssaParametriziran (COCI19_parametriziran)C++14
110 / 110
1528 ms6784 KiB
#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 (stderr)

parametriziran.cpp: In function 'long long int merge(int, int)':
parametriziran.cpp:23:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
       if ((1<<j)&m1 && (1<<j)&m2)
       ^~
parametriziran.cpp:25:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
         mp[p]++;
         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...