제출 #869565

#제출 시각아이디문제언어결과실행 시간메모리
869565JoksimKaktusSet (COCI21_set)C++17
40 / 110
1088 ms48556 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); int n,k; cin >> n >> k; set <string> mlt; for(int i = 0;i < n;i++){ string s; cin >> s; mlt.insert(s); } ll res = 0; string gone; for(string s1 : mlt){ mlt.erase(gone); ll resadd = 0; for(string s2 : mlt){ if(s1 == s2)continue; string target = ""; for(int i = 0;i < k;i++){ if(s1[i] == s2[i]){ target += s1[i]; }else{ if(s1[i] != '1' && s2[i] != '1'){ target += '1'; }else if(s1[i] != '2' && s2[i] != '2'){ target += '2'; }else{ target += '3'; } } } resadd += mlt.count(target); } res += resadd/2; gone = s1; } cout << res; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...