Submission #991685

# Submission time Handle Problem Language Result Execution time Memory
991685 2024-06-02T19:21:49 Z VMaksimoski008 Star triangles (IZhO11_triangle) C++17
100 / 100
382 ms 9412 KB
#include <bits/stdc++.h>

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
//#define int long long

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
const double eps = 1e-9;

int32_t main() {
    int n;
    cin >> n;

    vector<pii> v(n);
    map<int, int> by_x, by_y;

    for(auto &x : v) {
        cin >> x.first >> x.second;
        by_x[x.first]++; by_y[x.second]++;
    }

    ll ans = 0;

    for(auto &x : v) {
        ans += (by_x[x.first] - 1) * (by_y[x.second] - 1);
    }

    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 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 348 KB Output is correct
12 Correct 8 ms 1116 KB Output is correct
13 Correct 8 ms 972 KB Output is correct
14 Correct 12 ms 1368 KB Output is correct
15 Correct 138 ms 5204 KB Output is correct
16 Correct 148 ms 5532 KB Output is correct
17 Correct 137 ms 5204 KB Output is correct
18 Correct 128 ms 5204 KB Output is correct
19 Correct 351 ms 8996 KB Output is correct
20 Correct 257 ms 7356 KB Output is correct
21 Correct 382 ms 9300 KB Output is correct
22 Correct 373 ms 9412 KB Output is correct