fork download
  1. /*
  2. ==> Don't stop when you're tired, stop when you're done.
  3. --> @author: MIDORIYA_
  4. */
  5. //*==============================================================
  6. #include <bits/stdc++.h>
  7. using namespace std;
  8. typedef long long ll;
  9. typedef double db;
  10. typedef long double ld;
  11. typedef pair<int, int> pii;
  12. typedef vector<int> vi;
  13. typedef vector<ll> vll;
  14. typedef vector<db> vd;
  15. typedef vector<ld> vld;
  16. typedef vector<bool> vb;
  17. typedef vector<vector<ll>> vvl;
  18. typedef vector<pii> vii;
  19. typedef set<int> si;
  20. typedef set<ll> sl;
  21. #define pb push_back
  22. #define all(x) x.begin(), x.end()
  23. #define rall(x) x.rbegin(), x.rend()
  24. #define endl "\n"
  25. const ll MOD = 1'000'000'007;
  26. #define INF 2'000'000'000
  27. #define time cerr << "Time Taken: " << (float)clock() / CLOCKS_PER_SEC << " Secs" << endl;
  28. //*===================>>>Fast-IO-Functions<<<=================
  29. void fastIO()
  30. {
  31. ios_base::sync_with_stdio(false);
  32. cin.tie(nullptr);
  33. cout.tie(nullptr);
  34. }
  35. //*===================>>>File-IO-Functions<<<=================
  36. void fileIO()
  37. {
  38. #ifndef ONLINE_JUDGE
  39. freopen("in.txt", "r", stdin);
  40. freopen("out.txt", "w", stdout);
  41. #endif
  42. }
  43. //*===================>>>ONE-FOR-ALL-Function<<<==============
  44. void OneForAll() {
  45.  
  46. int n;
  47. cin >> n;
  48. vector<array<int, 3>> stars(n);
  49. unordered_map<int, int> xCnt, yCnt, zCnt;
  50.  
  51. for(auto &star : stars)
  52. {
  53. cin >> star[0] >> star[1] >> star[2];
  54.  
  55. xCnt[star[0]]++;
  56. yCnt[star[1]]++;
  57. zCnt[star[2]]++;
  58. }
  59.  
  60. for(auto &star : stars)
  61. {
  62. cout << xCnt[star[0]] - 1 << " " << yCnt[star[1]] - 1 << " " << zCnt[star[2]] - 1 << endl;
  63. }
  64. }
  65.  
  66. int main()
  67. {
  68. fastIO();
  69. fileIO();
  70.  
  71. ll tc = 1;
  72. // cin >> tc;
  73. while (tc--)
  74. {
  75. OneForAll();
  76. }
  77. time;
  78. return 0;
  79. }
  80.  
  81. // fibonacci series -> 0 1 1 2 3 5 8 13 21 34 ...
  82. // factorial series -> 1 1 2 6 24 120 720 ...
  83.  
Success #stdin #stdout #stderr 0s 5324KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Time Taken: 0.004438 Secs