#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<class T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n = 0;
cin >> n;
ll ans = 0;
map<int, ll> amx, amy;
map<pair<int, int>, ll> amp;
vector<pair<int, int> > p(n);
for(auto& x : p) cin >> x.fi >> x.se;
make_unique(p);
for(auto& x : p) {
amx[x.fi]++;
amy[x.se]++;
amp[x]++;
}
for(auto& x : p)
ans += (amx[x.fi] - 1ll) * (amy[x.se] - 1ll);
cout << ans;
return 0;
}
/*
*/
Compilation message
triangle.cpp:3: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
3 | #pragma GCC optimization ("unroll-loops")
|
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
396 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
396 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
492 KB |
Output is correct |
11 |
Correct |
1 ms |
492 KB |
Output is correct |
12 |
Correct |
10 ms |
1772 KB |
Output is correct |
13 |
Correct |
9 ms |
1816 KB |
Output is correct |
14 |
Correct |
14 ms |
2396 KB |
Output is correct |
15 |
Correct |
203 ms |
13548 KB |
Output is correct |
16 |
Correct |
214 ms |
14316 KB |
Output is correct |
17 |
Correct |
166 ms |
13596 KB |
Output is correct |
18 |
Correct |
158 ms |
13464 KB |
Output is correct |
19 |
Correct |
478 ms |
29968 KB |
Output is correct |
20 |
Correct |
391 ms |
22892 KB |
Output is correct |
21 |
Correct |
497 ms |
32052 KB |
Output is correct |
22 |
Correct |
519 ms |
31992 KB |
Output is correct |