답안 #887307

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
887307 2023-12-14T08:52:27 Z alex_2008 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
374 ms 12120 KB
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#include <bitset>
typedef long long ll;
using namespace std;
const int N = 3e5 + 10;
int x[N], y[N];
int main() {
	int n;
	cin >> n;
	map <int, int> mpx, mpy;
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
		mpx[x[i]]++;
		mpy[y[i]]++;
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += (mpx[x[i]] - 1) * 1ll * (mpy[y[i]] - 1);
	}
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2648 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 9 ms 3068 KB Output is correct
13 Correct 9 ms 3164 KB Output is correct
14 Correct 13 ms 3412 KB Output is correct
15 Correct 127 ms 7504 KB Output is correct
16 Correct 138 ms 7808 KB Output is correct
17 Correct 127 ms 7536 KB Output is correct
18 Correct 135 ms 7976 KB Output is correct
19 Correct 344 ms 11600 KB Output is correct
20 Correct 251 ms 9808 KB Output is correct
21 Correct 370 ms 12120 KB Output is correct
22 Correct 374 ms 12112 KB Output is correct