제출 #1239350

#제출 시각아이디문제언어결과실행 시간메모리
1239350sohamsen15별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
256 ms12568 KiB
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>

#define PB push_back
#define F first
#define S second
#define M move
#define B begin
#define E end
#define Fr front
#define Ba back

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pdd = pair<double, double>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
using vi = vector<int>;
using vll = vector<ll>;

const int INF = 2e9;
const ll INFL = 2e18;
const ll MOD = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed << setprecision(0);

    ll n, ans = 0; cin >> n;
    map<ll, ll> fx, fy;
    vector<pll> a;
    for (ll i = 0; i < n; i++) {
        ll x, y; cin >> x >> y;
        fx[x]++, fy[y]++, a.push_back({x, y});
    }
    for (auto [x, y]: a) ans += (fx[x] - 1) * (fy[y] - 1);
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...