Submission #513667

# Submission time Handle Problem Language Result Execution time Memory
513667 2022-01-17T11:45:55 Z blue Star triangles (IZhO11_triangle) C++17
100 / 100
406 ms 13284 KB
#include <iostream>
#include <map>
#include <vector>
using namespace std;

using ll = long long;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    map<int, ll> mx, my;

    int N;
    cin >> N;

    int X[1+N], Y[1+N];
    for(int i = 1; i <= N; i++)
    {
        cin >> X[i] >> Y[i];

        if(mx.find(X[i]) == mx.end()) mx[X[i]] = 1;
        else mx[X[i]]++;

        if(my.find(Y[i]) == my.end()) my[Y[i]] = 1;
        else my[Y[i]]++;
    }

    ll ans = 0;

    for(int i = 1; i <= N; i++)
    {
        ans += (mx[X[i]] - 1) * (my[Y[i]] - 1);
    }

    cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 308 KB Output is correct
2 Correct 0 ms 216 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 8 ms 1064 KB Output is correct
13 Correct 8 ms 1152 KB Output is correct
14 Correct 14 ms 1580 KB Output is correct
15 Correct 121 ms 7248 KB Output is correct
16 Correct 159 ms 7448 KB Output is correct
17 Correct 137 ms 7108 KB Output is correct
18 Correct 120 ms 7176 KB Output is correct
19 Correct 396 ms 12428 KB Output is correct
20 Correct 276 ms 10268 KB Output is correct
21 Correct 406 ms 13204 KB Output is correct
22 Correct 351 ms 13284 KB Output is correct