답안 #293864

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
293864 2020-09-08T13:14:27 Z 7_7_7 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
510 ms 12408 KB
#include <bits/stdc++.h>

using namespace std;

int n;
map<int, int> x;
map<int, int> y;
int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n;
    vector<int> a(n + 1), b(n + 1);
    for(int i = 1; i <= n; i ++){
        cin >> a[i] >> b[i];
        x[a[i]] ++; y[b[i]] ++;
    }
    long long res = 0;
    for(int i = 1; i <= n; i ++){
        x[a[i]] --; y[b[i]] --;
        res += (x[a[i]] * 1ll * y[b[i]]);
        x[a[i]] ++; y[b[i]] ++;
    }
    cout << res << "\n";
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 392 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 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 10 ms 1024 KB Output is correct
13 Correct 9 ms 1152 KB Output is correct
14 Correct 15 ms 1408 KB Output is correct
15 Correct 177 ms 6520 KB Output is correct
16 Correct 181 ms 6520 KB Output is correct
17 Correct 169 ms 6264 KB Output is correct
18 Correct 173 ms 6392 KB Output is correct
19 Correct 460 ms 11684 KB Output is correct
20 Correct 347 ms 9336 KB Output is correct
21 Correct 491 ms 12280 KB Output is correct
22 Correct 510 ms 12408 KB Output is correct