Submission #331104

# Submission time Handle Problem Language Result Execution time Memory
331104 2020-11-27T10:57:11 Z AlexLuchianov Star triangles (IZhO11_triangle) C++14
100 / 100
363 ms 5868 KB
#include <iostream>
#include <vector>
#include <map>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

std::map<int,int> frecx, frecy;

int const nmax = 300000;
int v[1 + nmax][2];

int main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);

  int n;
  std::cin >> n;
  for(int i = 1;i <= n; i++)
    std::cin >> v[i][0] >> v[i][1];
  for(int i = 1;i <= n; i++) {
    frecx[v[i][0]]++;
    frecy[v[i][1]]++;
  }
  ll result = 0;
  for(int i = 1;i <= n; i++)
    result += 1LL * (frecx[v[i][0]] - 1) * (frecy[v[i][1]] - 1);
  std::cout << result;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 7 ms 876 KB Output is correct
13 Correct 7 ms 876 KB Output is correct
14 Correct 11 ms 1260 KB Output is correct
15 Correct 117 ms 4076 KB Output is correct
16 Correct 154 ms 4332 KB Output is correct
17 Correct 131 ms 4204 KB Output is correct
18 Correct 117 ms 4096 KB Output is correct
19 Correct 355 ms 5648 KB Output is correct
20 Correct 256 ms 5228 KB Output is correct
21 Correct 363 ms 5868 KB Output is correct
22 Correct 361 ms 5868 KB Output is correct