Submission #531775

# Submission time Handle Problem Language Result Execution time Memory
531775 2022-03-01T13:17:20 Z makanhulia Star triangles (IZhO11_triangle) C++17
100 / 100
578 ms 6872 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    int n; cin >> n;
    pair<int, int>pii[n];
    map<int, ll>cntX, cntY;

    for(int i = 0; i < n; i++){
        auto &[x, y] = pii[i];
        cin >> x >> y;
        cntX[x]++;
        cntY[y]++;
    }

    ll ans = 0;

    for(int i = 0; i < n; i++){
        auto &[x, y] = pii[i];
        ans += max(0LL, (cntX[x] - 1)*(cntY[y] - 1));
    }

    cout << ans << endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 11 ms 988 KB Output is correct
13 Correct 17 ms 972 KB Output is correct
14 Correct 19 ms 1348 KB Output is correct
15 Correct 176 ms 4980 KB Output is correct
16 Correct 213 ms 5064 KB Output is correct
17 Correct 169 ms 4856 KB Output is correct
18 Correct 181 ms 4956 KB Output is correct
19 Correct 480 ms 6540 KB Output is correct
20 Correct 352 ms 5996 KB Output is correct
21 Correct 509 ms 6664 KB Output is correct
22 Correct 578 ms 6872 KB Output is correct