fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. unsigned int n, x1, x2, x3, y1, y2, y3, A [4] = {0, 0, 0, 0};
  6. unsigned long long c = 0;
  7. cin >> n;
  8. for (int i = 0; i < n; i ++){
  9. cin >> x1 >> y1;
  10. if(x1 % 2 == 0 and y1 % 2 == 0) A [0] ++;
  11. else if(x1 % 2 == 1 and y1 % 2 == 0) A [1] ++;
  12. else if(x1 % 2 == 0 and y1 % 2 == 1) A [2] ++;
  13. else A [3] ++;
  14. }
  15. for(int i = 0; i < 4; i ++){
  16. for(int j= 0; j < 4; j ++){
  17. if (i == j) c += A[i] * (A[i] - 1) * (A[i] - 2) / 6;
  18. else c += A[i] * (A[i] - 1) * A[j] / 2;
  19. }
  20. }
  21. cout << c;
  22. return 0;
  23. }
Success #stdin #stdout 0s 4276KB
stdin
5
0 0
0 1
-1 0
-1 -1
3 -3
stdout
3