Submission #86987

# Submission time Handle Problem Language Result Execution time Memory
86987 2018-11-29T05:10:40 Z abil Star triangles (IZhO11_triangle) C++14
100 / 100
711 ms 38916 KB
/**
   Solution by Abil
**/
#include <bits/stdc++.h>

using namespace std;

const int N = 300000 + 12;
int x[N],y[N];
map<int,int > mpx,mpy;
int main()
{
    int n;
    cin >> n;
    for(int i = 1;i <= n; i++){
       cin >> x[i] >> y[i];
       mpx[x[i]]++;
       mpy[y[i]]++;
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans += ((mpx[x[i]] - 1) * (mpy[y[i]] - 1));
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 516 KB Output is correct
3 Correct 2 ms 516 KB Output is correct
4 Correct 3 ms 516 KB Output is correct
5 Correct 2 ms 516 KB Output is correct
6 Correct 3 ms 516 KB Output is correct
7 Correct 2 ms 556 KB Output is correct
8 Correct 3 ms 564 KB Output is correct
9 Correct 3 ms 724 KB Output is correct
10 Correct 3 ms 724 KB Output is correct
11 Correct 4 ms 808 KB Output is correct
12 Correct 26 ms 1360 KB Output is correct
13 Correct 17 ms 1540 KB Output is correct
14 Correct 28 ms 2136 KB Output is correct
15 Correct 273 ms 7344 KB Output is correct
16 Correct 265 ms 9628 KB Output is correct
17 Correct 242 ms 11588 KB Output is correct
18 Correct 254 ms 13880 KB Output is correct
19 Correct 670 ms 21376 KB Output is correct
20 Correct 485 ms 25104 KB Output is correct
21 Correct 711 ms 32364 KB Output is correct
22 Correct 704 ms 38916 KB Output is correct