fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. ios::sync_with_stdio(false); cin.tie(0);
  7. int n; cin >> n;
  8. vector< vector<int> > a(401, vector<int>(401, 0));
  9. while (n--) {
  10. int u, v, c; cin >> u >> v >> c;
  11. a[u + 200][v + 200] = 1 << (c - 1);
  12. }
  13. #define rep(i, a, b) for (int i=a; i<=b; i++)
  14. #define LL long long
  15. LL res = 0;
  16. rep(i, 0, 400) rep(j, 0, i) {
  17. vector<LL> f(16, 0);
  18. rep(k, 0, 400) if (a[i][k] && a[j][k] && a[i][k] != a[j][k]) {
  19. int c = a[i][k] | a[j][k];
  20. res += f[15 - c];
  21. f[c]++;
  22. }
  23. }
  24. cout << res;
  25. return 0;
  26. }
  27.  
Runtime error #stdin #stdout 0s 15904KB
stdin
Standard input is empty
stdout
Standard output is empty