답안 #1100553

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1100553 2024-10-14T08:53:46 Z vjudge1 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
281 ms 9140 KB
//UNSTOPPABLE
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pii pair<int,int>
#define tpii pair <pair <int,int> , int>
#define bruh cout << "NO\n"
using namespace std;
using namespace __gnu_pbds;
const int N = 3e5 + 5;
int mod = 1e9 + 7;
const int INF = 1e18;
int n,x[N],y[N];
void Goldik(){
	cin >> n;
	map <int,int> mp , mp1;
	for(int i = 1 ; i <= n ; i++){
		cin >> x[i] >> y[i];
		mp[x[i]]++;
		mp1[y[i]]++;
	}	
	int ans = 0;
	for(int i = 1 ; i <= n ; i++){
		ans += (mp[x[i]] - 1) * (mp1[y[i]] - 1);
	}
	cout << ans;
}
//rewai mnogo zadach vozmozhno odna iz nih gde to popadetsya
//returning winter prime?
//chem prowe tem luchshe
signed main(/*AZ AZDAN UZDIKSIZ*/){
	//freopen("txt.in","r",stdin);
	//freopen("txt.out","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	srand(time(0));
	int TT = 1;
	// cin >> TT;
	for(int i = 1 ; i <= TT ; i++){
		//cout << "Case " << i << ": ";
		Goldik();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 1 ms 2384 KB Output is correct
7 Correct 1 ms 2384 KB Output is correct
8 Correct 1 ms 2384 KB Output is correct
9 Correct 1 ms 2384 KB Output is correct
10 Correct 1 ms 2384 KB Output is correct
11 Correct 1 ms 2384 KB Output is correct
12 Correct 6 ms 3152 KB Output is correct
13 Correct 5 ms 3176 KB Output is correct
14 Correct 8 ms 3664 KB Output is correct
15 Correct 89 ms 8556 KB Output is correct
16 Correct 105 ms 8528 KB Output is correct
17 Correct 95 ms 8520 KB Output is correct
18 Correct 97 ms 8520 KB Output is correct
19 Correct 259 ms 9036 KB Output is correct
20 Correct 202 ms 8772 KB Output is correct
21 Correct 281 ms 9032 KB Output is correct
22 Correct 275 ms 9140 KB Output is correct