제출 #1330418

#제출 시각아이디문제언어결과실행 시간메모리
1330418blackscreen1별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
412 ms9236 KiB
#include <bits//stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_multiset;
#define ll long long
#define iloop(m, h) for (auto i = m; i != h; i += (m < h ? 1 : -1))
#define jloop(m, h) for (auto j = m; j != h; j += (m < h ? 1 : -1))
#define kloop(m, h) for (auto k = m; k != h; k += (m < h ? 1 : -1))
#define lloop(m, h) for (auto l = m; l != h; l += (m < h ? 1 : -1))
#define pll pair<ll, ll>
#define INF 1000000000000000
#define MOD1 1000000007
#define MOD2 998244353
#define MOD3 1000000009
ll n, a[300005], b[300005], cans = 0;
map<ll, ll> mp, mp2;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	iloop(0, n) {
		cin >> a[i] >> b[i];
		if (mp.find(a[i]) == mp.end()) mp[a[i]] = 1;
		else mp[a[i]]++;
		if (mp2.find(b[i]) == mp2.end()) mp2[b[i]] = 1;
		else mp2[b[i]]++;
	}
	iloop(0, n) cans += (mp[a[i]]-1)*(mp2[b[i]]-1);
	cout << cans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...