#include<bits/stdc++.h>
#define ll long long
#define lld long double
#define ff first
#define ss second
#define pb push_back
#define vr(v) v.begin(),v.end()
#define rv(v) v.rbegin(),v.rend()
#define Code ios_base::sync_with_stdio(false);
#define By cin.tie(NULL);
#define Davit cout.tie(NULL);
#define FOR(i, n) for(int i = 0;i<n;i++)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
//#include "algo/debug.h"
int main() {
Code
By
Davit
int n;
cin >> n;
vector<int> X(100005), Y(100005);
vector<pair<int, int>> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i].ff >> v[i].ss;
X[v[i].ff]++;
Y[v[i].ss]++;
}
ll ans = 0;
for (int i = 0; i < n; i++) {
int x = v[i].ff, y = v[i].ss;
ans += 1ll * (X[x] - 1) * (Y[y] - 1);
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1116 KB |
Output is correct |
2 |
Correct |
1 ms |
1224 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Runtime error |
1 ms |
2140 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |