답안 #314785

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
314785 2020-10-21T07:44:44 Z jovan_b 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
455 ms 13304 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

map <int, ll> kx;
map <int, ll> ky;
int x[300005];
int y[300005];

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> x[i] >> y[i];
        kx[x[i]]++, ky[y[i]]++;
    }
    ll res = 0;
    for(int i=1; i<=n; i++){
        res += (kx[x[i]]-1)*(ky[y[i]]-1);
    }
    cout << res;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 7 ms 1152 KB Output is correct
13 Correct 7 ms 1280 KB Output is correct
14 Correct 13 ms 1664 KB Output is correct
15 Correct 152 ms 7160 KB Output is correct
16 Correct 146 ms 7544 KB Output is correct
17 Correct 155 ms 7160 KB Output is correct
18 Correct 146 ms 7160 KB Output is correct
19 Correct 401 ms 12664 KB Output is correct
20 Correct 302 ms 10360 KB Output is correct
21 Correct 445 ms 13304 KB Output is correct
22 Correct 455 ms 13176 KB Output is correct