답안 #886830

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
886830 2023-12-13T03:08:38 Z karimov 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
445 ms 29652 KB
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fio(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout)
void YES(bool t=1){std::cout<<(t?"YES\n":"NO\n");}
void NO(bool t=1){YES(!t);}
const int MOD = 1000000007;
#define int long long
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()

void solve() {
	int n; cin >> n;
	map<int,int> a,b;
	map<pair<int,int>,bool> mp;
	int cnt=0;
	while(n--) {
		int x,y;
		cin >> x >> y;
		a[x]++;
		b[y]++;
		mp[{x,y}]=true;
	}
	for(auto it : mp){
		cnt+=(a[it.first.first]-1)*(b[it.first.second]-1);
	}
	cout<<cnt;
}

signed main() {
	FAST
	solve();
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 452 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 7 ms 1628 KB Output is correct
13 Correct 7 ms 1916 KB Output is correct
14 Correct 10 ms 2140 KB Output is correct
15 Correct 127 ms 12756 KB Output is correct
16 Correct 122 ms 13392 KB Output is correct
17 Correct 112 ms 12628 KB Output is correct
18 Correct 124 ms 12732 KB Output is correct
19 Correct 393 ms 27728 KB Output is correct
20 Correct 291 ms 21588 KB Output is correct
21 Correct 445 ms 29520 KB Output is correct
22 Correct 431 ms 29652 KB Output is correct