Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <bitset>
- using namespace std;
- #define F(n) (n=='A' ? 0 : n=='C' ? 1 : n=='G' ? 2 : 3)
- int n, m;
- bool Sirve(int a, int b, int c, const vector <string> &s, const vector <string> &p)
- {
- bitset <64> combinacion;
- for(int i=0; i<s.size(); i++)
- combinacion[F(s[i][a])*16 + F(s[i][b])*4 + F(s[i][c])] = true;
- for(int i=0; i<p.size(); i++)
- if(combinacion[F(p[i][a])*16 + F(p[i][b])*4 + F(p[i][c])])
- return false;
- return true;
- }
- int main()
- {
- vector <string> spotty, plain;
- cin >> n >> m;
- spotty.resize(n);
- plain.resize(n);
- for(int i=0; i<n; i++)
- cin >> spotty[i];
- for(int i=0; i<n; i++)
- cin >> plain[i];
- int res = 0;
- for(int i=0; i<m; i++)
- for(int j=i+1; j<m; j++)
- for(int k=j+1; k<m; k++)
- if(Sirve(i, j, k, spotty, plain))
- res++;
- cout << res << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement