Submission #897066

# Submission time Handle Problem Language Result Execution time Memory
897066 2024-01-02T13:51:29 Z ach00 Star triangles (IZhO11_triangle) C++14
100 / 100
422 ms 19804 KB
#include <bits/stdc++.h>
using namespace std;
#define X second
#define Y first
int main() {
    vector<pair<long long,long long>> stars;
    map<long long, int> x_count;
    map<long long, int> y_count;
    int n; cin >> n;
    for(int i = 0; i < n; i++) {
        int x,y; cin >> x >> y;
        stars.push_back({y,x});
        x_count[x]++;
        y_count[y]++;
    }
    long long ans = 0;
    for(int i = 0; i < n; i++) {
        ans += max((x_count[stars[i].X]-1),0)*max((y_count[stars[i].Y]-1),0);
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 436 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 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 448 KB Output is correct
12 Correct 8 ms 1240 KB Output is correct
13 Correct 9 ms 1344 KB Output is correct
14 Correct 13 ms 2004 KB Output is correct
15 Correct 131 ms 8048 KB Output is correct
16 Correct 142 ms 8200 KB Output is correct
17 Correct 129 ms 8048 KB Output is correct
18 Correct 130 ms 8008 KB Output is correct
19 Correct 391 ms 19152 KB Output is correct
20 Correct 254 ms 12476 KB Output is correct
21 Correct 422 ms 19700 KB Output is correct
22 Correct 376 ms 19804 KB Output is correct