Submission #96669

#TimeUsernameProblemLanguageResultExecution timeMemory
96669keko37Parametriziran (COCI19_parametriziran)C++14
110 / 110
460 ms3184 KiB
#include<bits/stdc++.h> using namespace std; typedef long long llint; const int MAXN = 50005; llint n, m, sol; string s[MAXN]; vector <int> v[70]; unordered_map <llint, int> mp; void spoji (int m1, int m2) { mp.clear(); for (int i=0; i<v[m1].size(); i++) { llint h = 0; for (int j=0; j<m; j++) { if ((m1 & (1 << j)) && (m2 & (1 << j))) { h = h * 27 + s[v[m1] [i]] [j] - 'a'; } } mp[h]++; } for (int i=0; i<v[m2].size(); i++) { llint h = 0; for (int j=0; j<m; j++) { if ((m1 & (1 << j)) && (m2 & (1 << j))) { h = h * 27 + s[v[m2] [i]] [j] - 'a'; } } sol += mp[h]; } } int main () { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int i=1; i<=n; i++) { cin >> s[i]; int mask = 0; for (int j=0; j<m; j++) { if (s[i] [j] != '?') mask += (1 << j); } v[mask].push_back(i); } for (int m1=0; m1<(1 << m); m1++) { for (int m2=0; m2<(1 << m); m2++) { spoji(m1, m2); } } cout << (sol - n)/2; return 0; }

Compilation message (stderr)

parametriziran.cpp: In function 'void spoji(int, int)':
parametriziran.cpp:16:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<v[m1].size(); i++) {
                   ~^~~~~~~~~~~~~
parametriziran.cpp:25:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<v[m2].size(); i++) {
                   ~^~~~~~~~~~~~~
#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...