fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define ld long double
  7.  
  8. void Free_palestine() {
  9. ios::sync_with_stdio(false);
  10. cin.tie(NULL);
  11. cout.tie(NULL);
  12. }
  13.  
  14. const int N = 2e5 + 5;
  15. const int MOD = 1e9 + 7;
  16. const int MAXN = 1e5 + 5;
  17.  
  18.  
  19. signed main(){
  20. Free_palestine();
  21. int n;
  22. cin>>n;
  23.  
  24. int x[n],y[n],z[n];
  25. for(int i =0; i < n; i++){
  26. cin>>x[i]>>y[i]>>z[i];
  27. }
  28. for(int i =0; i < n; i++){
  29. int cx=0, cy=0, cz=0;
  30. for(int j =0; j < n; j++){
  31. if(i == j){
  32. continue;
  33. }
  34. if(x[i]==x[j]){
  35. cx++;
  36. }
  37. if(y[i]==y[j]){
  38. cy++;
  39. }
  40. if(z[i]==z[j]){
  41. cz++;
  42. }
  43. }
  44. cout<<cx<<" "<<cy<<" "<<cz<<endl;
  45. }
  46. }
Success #stdin #stdout 0s 5320KB
stdin
5
1 2 3
2 5 3
1 5 2
3 2 1
1 2 5
stdout
2 2 1
0 1 1
2 1 0
0 2 0
2 2 0