Submission #678338

# Submission time Handle Problem Language Result Execution time Memory
678338 2023-01-05T13:25:03 Z stevancv Star triangles (IZhO11_triangle) C++14
100 / 100
309 ms 13228 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 100 + 2;
const int mod = 1e9 + 7;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n; cin >> n;
    map<int, ll> X, Y;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        X[x[i]]++; Y[y[i]]++;
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ans += (ll)(X[x[i]] - 1) * (Y[y[i]] - 1);
    }
    cout << ans << en;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 316 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 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 6 ms 1120 KB Output is correct
13 Correct 5 ms 1236 KB Output is correct
14 Correct 9 ms 1600 KB Output is correct
15 Correct 107 ms 7120 KB Output is correct
16 Correct 113 ms 7624 KB Output is correct
17 Correct 97 ms 7160 KB Output is correct
18 Correct 98 ms 7168 KB Output is correct
19 Correct 260 ms 12580 KB Output is correct
20 Correct 209 ms 10288 KB Output is correct
21 Correct 286 ms 13228 KB Output is correct
22 Correct 309 ms 13228 KB Output is correct