#include <bits/stdc++.h>
using namespace std;
map<long long,long long> bruh;
map<long long,long long> idk;
map<pair<long long,long long>,long long> yay;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n,a,b,ans = 0;
cin >> n;
vector<pair<long long,long long>> haha(n);
for(long long i = 0; i < n; i++) {
cin >> a >> b;
haha[i] = {a,b};
yay[{a,b}]++;
bruh[a]++;
idk[b]++;
}
for(long long i = 0; i < n; i++) {
a = haha[i].first;
b = haha[i].second;
long long c = yay[{a,b}];
ans+=(bruh[a]-c)*(idk[b]-c);
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 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 |
1860 KB |
Output is correct |
13 |
Correct |
8 ms |
1884 KB |
Output is correct |
14 |
Correct |
11 ms |
2392 KB |
Output is correct |
15 |
Correct |
140 ms |
14184 KB |
Output is correct |
16 |
Correct |
159 ms |
15188 KB |
Output is correct |
17 |
Correct |
148 ms |
14156 KB |
Output is correct |
18 |
Correct |
171 ms |
14236 KB |
Output is correct |
19 |
Correct |
552 ms |
32164 KB |
Output is correct |
20 |
Correct |
365 ms |
24404 KB |
Output is correct |
21 |
Correct |
623 ms |
34388 KB |
Output is correct |
22 |
Correct |
605 ms |
34300 KB |
Output is correct |