Submission #516838

#TimeUsernameProblemLanguageResultExecution timeMemory
516838Marslai24Set (COCI21_set)C++17
40 / 110
1079 ms65164 KiB
#include <bits/stdc++.h> using namespace std; #define int long long // a.k.a. TLE creator #define all(x) x.begin(), x.end() template<class A, class B> istream& operator >>(istream &o, pair<A, B> &x){return o >> x.first >> x.second;} template<class A, class B> ostream& operator <<(ostream &o, pair<A, B> &x){return o << x.first << ' ' << x.second << ' ';} void setIO(){ios::sync_with_stdio(false); cin.tie(0);} const int INF = INT_MAX, MOD = 998244353, N = 1e5 + 2, K = __lg(N) + 1; signed main(){ setIO(); int n, k; cin >> n >> k; vector<string> s(n); for(auto &i : s)cin >> i; map<string, int> cnt; for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ string now(k, '0'); for(int l = 0; l < k; l++){ if(s[i][l] == s[j][l])now[l] = s[i][l]; else{ for(char c = '1'; c <= '3'; c++){ if(s[i][l] != c && s[j][l] != c)now[l] = c; } } } cnt[now]++; } } int ans = 0; for(auto i : s){ ans += cnt[i]; } cout << ans / 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...