/*
█████████████.....██████....██.........█....██████████....██.........██.
██.........██.......██......█.█........█....██......██.....██.......██..
██.........██.......██......█..█.......█....██......██......██.....██...
██.........██.......██......█...█......█....██......██.......██...██....
██.........██.......██......█....█.....█....██......██........██.██.....
██.........██.......██......█.....█....█....██......██.........███......
█████████████.......██......█.....█....█....██████████.........███......
██..................██......█......█...█....██......██.........███......
██..................██......█......█...█....██......██.........███......
██..................██......█.......█..█....██......██.........███......
██..................██......█.......█..█....██......██.........███......
██..................██......█........█.█....██......██.........███......
██..................██......█........█.█....██......██.........███......
██................██████....█.........██....██......██.........███......
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
//#define DEBUG
#define pqueue priority_queue
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)
//#define x first;
//#define y second;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;
const int INF = 1e9;
const ll INFLL = 1e12;
const int MOD = 1000000007;
const ld eps = 1e-6;
const int MOD2 = (1<<30)+1;
const int dosz = 5e5;
void fast_io(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifdef DEBUG
// freopen("a.in", "r", stdin);
#else
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
}
map<int, int> mp1;
map<int, int> mp2;
void solve(){
int n;
cin >> n;
vpii kek(n);
for(int i=0; i<n; i++){
cin >> kek[i].first >> kek[i].second;
mp1[kek[i].first]++;
mp2[kek[i].second]++;
}
int ans = 0;
for(pii i:kek){
ans += (mp1[i.first]-1)*(mp2[i.second]-1);
}
cout << ans;
}
signed main() {
fast_io();
int q = 1;
// cin >> q;
while(q--){
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 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 |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
7 ms |
1260 KB |
Output is correct |
13 |
Correct |
7 ms |
1388 KB |
Output is correct |
14 |
Correct |
12 ms |
1772 KB |
Output is correct |
15 |
Correct |
142 ms |
7916 KB |
Output is correct |
16 |
Correct |
156 ms |
8384 KB |
Output is correct |
17 |
Correct |
138 ms |
7916 KB |
Output is correct |
18 |
Correct |
141 ms |
7916 KB |
Output is correct |
19 |
Correct |
410 ms |
14700 KB |
Output is correct |
20 |
Correct |
287 ms |
11884 KB |
Output is correct |
21 |
Correct |
420 ms |
14828 KB |
Output is correct |
22 |
Correct |
452 ms |
14700 KB |
Output is correct |