답안 #798218

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
798218 2023-07-30T13:40:48 Z alittlemiddle 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
256 ms 15564 KB
#include <bits/stdc++.h>
#define el '\n'
#define fi first
#define sc second
#define int ll
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
using namespace std;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
const int mod=1e9+7;
const int N=3e5+11;
int n, x[N],y[N], ans;
map<int, int> mp1, mp2;
void sol()
{
    cin >> n;
    for(int i=1;i<=n; i++)
    {
        cin >> x[i] >> y[i];
        mp1[x[i]]++;
        mp2[y[i]]++;
    }
    for(int i=1; i<=n; i++) ans+=(mp1[x[i]]-1)*(mp2[y[i]]-1);
    cout << ans;
}
signed main()
{
//    freopen("divisor.INP", "r", stdin);
//    freopen("divisor.OUT", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin >> t;
    while(t--)
    {
        sol();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 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 5 ms 1248 KB Output is correct
13 Correct 5 ms 1236 KB Output is correct
14 Correct 8 ms 1748 KB Output is correct
15 Correct 84 ms 7952 KB Output is correct
16 Correct 92 ms 8336 KB Output is correct
17 Correct 84 ms 7932 KB Output is correct
18 Correct 88 ms 7836 KB Output is correct
19 Correct 234 ms 14740 KB Output is correct
20 Correct 166 ms 11724 KB Output is correct
21 Correct 256 ms 15564 KB Output is correct
22 Correct 256 ms 15548 KB Output is correct