Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <vector>
- #include <math.h>
- using namespace std;
- ifstream ifs("input.txt");
- ofstream ofs("output.txt");
- inline bool f(int a,int b){
- if(a==b)return 0;
- if((a&b)==b)return 1;
- if((a&b)==a)return 1;
- return 0;
- }
- int main()
- {
- int n,m;
- ifs>>n>>m;
- vector<int> v(n);
- char ch;
- int t,s=pow(2,m);;
- for(int i=0;i<n;i++){
- t=s;
- for(int j=0;j<m;j++){
- ifs>>ch;
- v[i]+=t*((ch=='+')?1:0);
- t/=2;
- }
- }
- int ans=0;
- for(int i=0;i<n-1;i++){
- for(int j=i+1;j<n;j++)
- ans+=f(v[i],v[j]);
- }
- ofs<<ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment