제출 #1227656

#제출 시각아이디문제언어결과실행 시간메모리
1227656thesen별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
481 ms9216 KiB
#include <bits/stdc++.h> #define pb push_back #define ll long long #define vint vector <int> #define vll vector <ll> #define vbool vector<bool> #define pairint pair<int,int> #define pairll pair<ll,ll> #define fi first #define sc second #define rever greater<ll>() using namespace std; void solve(ll tc){ ll n; cin >> n; map<ll, ll> x, y; vll a(n), b(n); for(int i = 0; i < n; i++){ cin >> a[i] >> b[i]; if(x[a[i]] == x[1000000000]){ x[a[i]] = 1; }else{ x[a[i]]++; } if(y[b[i]] == y[1000000000]){ y[b[i]] = 1; }else{ y[b[i]]++; } } ll res = 0; for(int i = 0; i < n; i++){ res += (x[a[i]]-1) * (y[b[i]]-1); } cout << res << endl; } int main(){ ll t; t = 1; for(int i = 1; i <= t; i++){ solve(i); } }
#Verdict Execution timeMemoryGrader output
Fetching results...