Submission #104579

#TimeUsernameProblemLanguageResultExecution timeMemory
104579HassoonyParametriziran (COCI19_parametriziran)C++17
0 / 110
410 ms3820 KiB
#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 (stderr)

parametriziran.cpp: In function 'int main()':
parametriziran.cpp:25:23: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[8]' [-Wformat=]
         scanf("%s",&oo);s=oo;
                    ~~~^
parametriziran.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",&oo);s=oo;
         ~~~~~^~~~~~~~~~
#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...