Submission #679964

# Submission time Handle Problem Language Result Execution time Memory
679964 2023-01-09T17:05:03 Z Hacv16 Star triangles (IZhO11_triangle) C++17
100 / 100
486 ms 15484 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int MAX = 2e6 + 15;

ll n, x[MAX], y[MAX], ans;
map<ll, ll> fx, fy;

int main(void){
    cin >> n;

    for(int i = 1; i <= n; i++){
        cin >> x[i] >> y[i];
        fx[x[i]]++; fy[y[i]]++;
    }

    for(int i = 1; i <= n; i++)
        ans += (fx[x[i]] - 1) * (fy[y[i]] - 1);

    cout << ans << '\n';

    exit(0);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 12 ms 1228 KB Output is correct
13 Correct 12 ms 1224 KB Output is correct
14 Correct 15 ms 1748 KB Output is correct
15 Correct 164 ms 8012 KB Output is correct
16 Correct 171 ms 8232 KB Output is correct
17 Correct 161 ms 7872 KB Output is correct
18 Correct 158 ms 7896 KB Output is correct
19 Correct 436 ms 14900 KB Output is correct
20 Correct 326 ms 11828 KB Output is correct
21 Correct 486 ms 15452 KB Output is correct
22 Correct 482 ms 15484 KB Output is correct