Submission #91685

# Submission time Handle Problem Language Result Execution time Memory
91685 2018-12-29T07:42:24 Z SamAnd Star triangles (IZhO11_triangle) C++17
100 / 100
672 ms 12408 KB
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
const int N = 300005;

int n;
pair<int, int> a[N];

map<int, int> x, y;

int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i].first >> a[i].second;
        x[a[i].first]++;
        y[a[i].second]++;
    }
    long long ans = 0;
    for (int i = 0; i < n; ++i)
    {
        ans += ((x[a[i].first] - 1LL) * (y[a[i].second] - 1LL));
    }
    cout << ans << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 2 ms 368 KB Output is correct
6 Correct 2 ms 252 KB Output is correct
7 Correct 2 ms 632 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 13 ms 1016 KB Output is correct
13 Correct 14 ms 1144 KB Output is correct
14 Correct 20 ms 1400 KB Output is correct
15 Correct 220 ms 6256 KB Output is correct
16 Correct 223 ms 6524 KB Output is correct
17 Correct 215 ms 6264 KB Output is correct
18 Correct 221 ms 6136 KB Output is correct
19 Correct 597 ms 11752 KB Output is correct
20 Correct 451 ms 9336 KB Output is correct
21 Correct 672 ms 12300 KB Output is correct
22 Correct 663 ms 12408 KB Output is correct