Submission #1005375

# Submission time Handle Problem Language Result Execution time Memory
1005375 2024-06-22T11:31:42 Z tvladm2009 Star triangles (IZhO11_triangle) C++17
100 / 100
238 ms 12176 KB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;

const int N = 3e5 + 7;

int n, x[N], y[N];
map<int, int> cntX, cntY;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> x[i] >> y[i];
        cntX[x[i]]++;
        cntY[y[i]]++;
    }
    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        ans += 1LL * (cntX[x[i]] - 1) * (cntY[y[i]] - 1);
    }
    cout << ans  << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2508 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2508 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 0 ms 2652 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 4 ms 3172 KB Output is correct
13 Correct 4 ms 3164 KB Output is correct
14 Correct 7 ms 3420 KB Output is correct
15 Correct 80 ms 7600 KB Output is correct
16 Correct 89 ms 7988 KB Output is correct
17 Correct 76 ms 7764 KB Output is correct
18 Correct 83 ms 7536 KB Output is correct
19 Correct 219 ms 11672 KB Output is correct
20 Correct 157 ms 9812 KB Output is correct
21 Correct 238 ms 12176 KB Output is correct
22 Correct 236 ms 12112 KB Output is correct