제출 #745254

#제출 시각아이디문제언어결과실행 시간메모리
745254Ahmed57Set (COCI21_set)C++17
40 / 110
131 ms568 KiB
#include <bits/stdc++.h> using namespace std; bool chk[40000000]; int main(){ int n,k; cin>>n>>k; vector<string> v(n); for(int i = 0;i<n;i++){ int x;cin>>x; chk[x] = 1; v[i] =to_string(x); } int all = 0; for(int i =0 ;i<n;i++){ for(int j = i+1;j<n;j++){ if(i==j)continue; int val = 0; for(int e = 0;e<k;e++){ val*=10; if(v[i][e]==v[j][e]){ val+=(v[i][e]-'0'); }else{ if(v[i][e]!='1'&&v[j][e]!='1'){ val+=1; }if(v[i][e]!='2'&&v[j][e]!='2'){ val+=2; }if(v[i][e]!='3'&&v[j][e]!='3'){ val+=3; } } } all+=chk[val]; } } cout<<all/3<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...