Submission #97391

#TimeUsernameProblemLanguageResultExecution timeMemory
97391MercenaryParametriziran (COCI19_parametriziran)C++11
0 / 110
687 ms3696 KiB
#include<bits/stdc++.h> using namespace std; #define taskname "TEST" #define pb push_back typedef long double ld; typedef long long ll; const int maxn = 5e4 + 5; int n , m; vector<string> v[1 << 6]; ll res = 0; int Cal(int x , int y) { vector<string> t; t.reserve(v[x].size()); for(auto c : v[x]) { string tmp; for(int j = 0 ; j < m ; ++j) if(((x >> j) & 1) && ((y >> j) & 1))tmp.pb(c[j]); t.pb(tmp); } sort(t.begin(),t.end()); for(auto c : v[y]) { string tmp; for(int j = 0 ; j < m ; ++j) if(((x >> j) & 1) && ((y >> j) & 1))tmp.pb(c[j]); res += upper_bound(t.begin(),t.end(),tmp) - lower_bound(t.begin(),t.end(),tmp); } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); if(fopen(taskname".INP","r")) freopen(taskname".INP", "r",stdin) , freopen(taskname".OUT", "w",stdout); cin >> n >> m; for(int i = 1 ; i <= n ; ++i){ string s; cin >> s; int key = 0; for(int j = 0 ; j < m ; ++j) if(s[j] != '?')key |= (1 << j); v[key].pb(s); } for(int i = 0 ; i < (1 << m) ; ++i) for(int j = i ; j < (1 << m) ; ++j) res += Cal(i , j); res -= n; cout << res; }

Compilation message (stderr)

parametriziran.cpp: In function 'int Cal(int, int)':
parametriziran.cpp:32:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
parametriziran.cpp: In function 'int main()':
parametriziran.cpp:38:44: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen(taskname".INP", "r",stdin) ,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
         freopen(taskname".OUT", "w",stdout);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
parametriziran.cpp:38:44: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
#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...