D_L3

Unique Rows

Jan 26th, 2024
711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <map>
  7.  
  8. using namespace std;
  9.  
  10. map<vector<int>, int> rows;
  11.  
  12. int main() {
  13.     int n, m;
  14.     cin >> n >> m;
  15.    
  16.     for(int i = 0; i < n; i++) {
  17.         vector<int> row(m);
  18.         for(int i = 0; i < m; i++)
  19.             cin >> row[i];
  20.         rows[row]++;
  21.     }
  22.     int counter = 0;
  23.     for(const auto& row : rows){
  24.         if(row.second == 1)
  25.             counter++;
  26.     }
  27.     cout << counter;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment