답안 #549134

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
549134 2022-04-15T09:15:30 Z AJ00 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
314 ms 15564 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int x[300000],y[300000];
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1,n; 
  //  cin >> t; 
    while (t--){
        cin >> n;
        map<int,int> cntx,cnty;
        for (int i = 0; i < n; i++){
            cin >> x[i] >> y[i];
            cntx[x[i]]++;
            cnty[y[i]]++;
        }
        int ans = 0;
        for (int i = 0; i < n; i++){
            ans += (int)(cntx[x[i]]-1)*(cnty[y[i]]-1);
        }
        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 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 328 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 0 ms 328 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 7 ms 1236 KB Output is correct
13 Correct 10 ms 1304 KB Output is correct
14 Correct 10 ms 1748 KB Output is correct
15 Correct 109 ms 7964 KB Output is correct
16 Correct 120 ms 8336 KB Output is correct
17 Correct 123 ms 7844 KB Output is correct
18 Correct 146 ms 7944 KB Output is correct
19 Correct 314 ms 14740 KB Output is correct
20 Correct 280 ms 11848 KB Output is correct
21 Correct 292 ms 15544 KB Output is correct
22 Correct 304 ms 15564 KB Output is correct