답안 #914942

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914942 2024-01-23T01:57:29 Z adaawf 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
246 ms 12600 KB
#include <iostream>
#include <map>
using namespace std;
int a[300005], b[300005];
map<int, int> ma, mb;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i];
        ma[a[i]]++;
        mb[b[i]]++;
    }
    long long int res = 0;
    for (int i = 1; i <= n; i++) {
        res += 1ll * (ma[a[i]] - 1) * (mb[b[i]] - 1);
    }
    cout << res;
}
# 결과 실행 시간 메모리 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 2392 KB Output is correct
5 Correct 1 ms 2392 KB Output is correct
6 Correct 1 ms 2396 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 2648 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 5 ms 3164 KB Output is correct
13 Correct 6 ms 3180 KB Output is correct
14 Correct 8 ms 3416 KB Output is correct
15 Correct 81 ms 7620 KB Output is correct
16 Correct 88 ms 8228 KB Output is correct
17 Correct 80 ms 7752 KB Output is correct
18 Correct 81 ms 7520 KB Output is correct
19 Correct 215 ms 11672 KB Output is correct
20 Correct 165 ms 10036 KB Output is correct
21 Correct 235 ms 12112 KB Output is correct
22 Correct 246 ms 12600 KB Output is correct