Submission #1109762

# Submission time Handle Problem Language Result Execution time Memory
1109762 2024-11-07T14:02:16 Z Kirill22 Star triangles (IZhO11_triangle) C++17
100 / 100
304 ms 12332 KB
#include "bits/stdc++.h"

using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    map<int, int> dx, dy;
    for (auto& [x, y] : a) {
        cin >> x >> y;
        dx[x]++;
        dy[y]++;
    }
    long long ans = 0;
    for (auto& [x, y] : a) {
        ans += (dx[x] - 1) * 1ll * (dy[y] - 1);
    }
    cout << ans << '\n';
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 404 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 464 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 2 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 6 ms 928 KB Output is correct
13 Correct 6 ms 1104 KB Output is correct
14 Correct 10 ms 1360 KB Output is correct
15 Correct 95 ms 6140 KB Output is correct
16 Correct 107 ms 6472 KB Output is correct
17 Correct 96 ms 6216 KB Output is correct
18 Correct 87 ms 6216 KB Output is correct
19 Correct 252 ms 11428 KB Output is correct
20 Correct 178 ms 9288 KB Output is correct
21 Correct 304 ms 12332 KB Output is correct
22 Correct 274 ms 12236 KB Output is correct