Submission #1072349

# Submission time Handle Problem Language Result Execution time Memory
1072349 2024-08-23T17:19:40 Z coolboy19521 Star triangles (IZhO11_triangle) C++17
100 / 100
482 ms 12252 KB
#include "bits/stdc++.h"
#define ll long long

using namespace std;

const int sz = 3e5 + 15;

pair<int,int> ps[sz];

int main() {
    int n;
    cin >> n;

    map<int,int> cx, cy;

    for (int i = 0; i < n; i ++) {
        int x, y;
        cin >> x >> y;

        cx[x] ++, cy[y] ++;
        ps[i] = make_pair(x, y);
    }

    ll r = 0;

    for (int i = 0; i < n; i ++) {
        int x, y;
        tie(x, y) = ps[i];
        cx[x] --, cy[y] --;
        r += cx[x] * cy[y];
        cx[x] ++, cy[y] ++;
    }

    cout << r << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 444 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 9 ms 1116 KB Output is correct
13 Correct 10 ms 1192 KB Output is correct
14 Correct 14 ms 1372 KB Output is correct
15 Correct 156 ms 7780 KB Output is correct
16 Correct 171 ms 7780 KB Output is correct
17 Correct 154 ms 7508 KB Output is correct
18 Correct 159 ms 7668 KB Output is correct
19 Correct 425 ms 11600 KB Output is correct
20 Correct 309 ms 10068 KB Output is correct
21 Correct 477 ms 12252 KB Output is correct
22 Correct 482 ms 12108 KB Output is correct