답안 #601104

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
601104 2022-07-21T11:15:18 Z kabika 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
501 ms 20292 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define x first
#define y second

int main() 
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	map<int,vector<int>> xfx, yfx;
	vector<pair<int,int>> st(n);
	for(int i = 0; i < n; ++i)
	{
	    cin >> st[i].x >> st[i].y;
	    xfx[st[i].x].push_back(st[i].y);
	    yfx[st[i].y].push_back(st[i].x);
	}
	
	ll ans = 0;
	for(int i = 0; i < n; ++i)
	{
	    ll t = (xfx[st[i].x].size() - 1)*(yfx[st[i].y].size() - 1);
	    //cout << t << '\n';
	    ans += t;
	}
	cout << ans << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 312 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 7 ms 1620 KB Output is correct
13 Correct 6 ms 1748 KB Output is correct
14 Correct 13 ms 2380 KB Output is correct
15 Correct 155 ms 10320 KB Output is correct
16 Correct 201 ms 10884 KB Output is correct
17 Correct 149 ms 10412 KB Output is correct
18 Correct 136 ms 10388 KB Output is correct
19 Correct 501 ms 19140 KB Output is correct
20 Correct 288 ms 15248 KB Output is correct
21 Correct 495 ms 20292 KB Output is correct
22 Correct 419 ms 20172 KB Output is correct