Submission #862265

#TimeUsernameProblemLanguageResultExecution timeMemory
862265Cyber_WolfSet (COCI21_set)C++17
40 / 110
1091 ms64944 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #pragma GCC optimize("Ofast") using namespace std; using namespace __gnu_pbds; #define lg long long #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int main() { fastio; lg n, k; cin >> n >> k; map<string, lg> mp; vector<string> v(n); for(int i = 0; i < n; i++) cin >> v[i], mp[v[i]]++; lg ans = 0; for(int j = 0; j < n; j++) { for(int z = j+1; z < n; z++) { lg b = 1; string inv = ""; for(int h = 0; h < k; h++) { if(v[j][h] == v[z][h]) { inv += v[j][h]; continue; } if(v[j][h] != v[z][h]) { if(v[j][h] != '1' && v[z][h] != '1') inv += "1"; else if(v[j][h] != '2' && v[z][h] != '2') inv += "2"; else inv += "3"; continue; } b = 0; break; } ans += b*mp[inv]; } } cout << ans/3 << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...