Submission #703511

#TimeUsernameProblemLanguageResultExecution timeMemory
703511PacybwoahSet (COCI21_set)C++14
40 / 110
1040 ms65196 KiB
#include<iostream> #include<vector> #include<string> #include<set> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n,k; cin>>n>>k; vector<string> vec(n); for(int i=0;i<n;i++) cin>>vec[i]; set<string> s; for(int i=0;i<n;i++) s.insert(vec[i]); int cnt=0; for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ //s.erase(vec[i]); //s.erase(vec[j]); string tmp=vec[i]; for(int l=0;l<k;l++){ if(vec[i][l]==vec[j][l]){ tmp[l]=vec[i][l]; } else { tmp[l]=6-(vec[i][l]-'0')-(vec[j][l]-'0')+'0'; } } if(s.count(tmp)) cnt++; //s.insert(vec[i]); //s.insert(vec[j]); } } cout<<cnt/3; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...