fork(1) download
  1. #include <iostream>
  2. #include <set>
  3. #include <map>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. struct Triplet
  8. {
  9. long long v[3];
  10.  
  11. Triplet(long long x,long long y, long long z)
  12. {
  13. v[0] = x;
  14. v[1] = y;
  15. v[2] = z;
  16. sort( v, v+3 );
  17. }
  18. };
  19. class TripletCompare
  20. {
  21. public:
  22. bool operator()(const Triplet &t1, const Triplet &t2)
  23. {
  24. return lexicographical_compare( &t1.v[0], &t1.v[3] , &t2.v[0], &t2.v[3]);
  25. }
  26. };
  27.  
  28. int main()
  29. {
  30. int n;
  31. cin >> n;
  32. int unique = 0;
  33. int i = n;
  34. map<Triplet,int,TripletCompare> m;
  35. while ( i-- > 0 )
  36. {
  37. long long x,y,z;
  38. cin >> x >> y >> z;
  39. Triplet t(x,y,z);
  40.  
  41. if( m.find(t) != m.end() )
  42. {
  43. m[t]++;
  44. }
  45. else
  46. {
  47. m[t] = 1;
  48. }
  49. }
  50. map<Triplet,int,TripletCompare>::iterator it;
  51. for( it = m.begin(); it != m.end(); it++ )
  52. {
  53. if( it->second == 1 )
  54. {
  55. unique++;
  56. }
  57. }
  58. cout << unique << endl;
  59. return 0;
  60. }
  61.  
Success #stdin #stdout 0s 3480KB
stdin
3
1 2 3
2 1 3
3 1 2
stdout
0