답안 #1080142

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1080142 2024-08-29T07:23:20 Z MrPavlito 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
272 ms 15596 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
#define endl "\n"
#define pii pair<int,int>

using namespace std;

const int MAXN = 1e5+5;
const int mod7 = 1e9+7;
const long long inf = 1e18;

signed main()
{
    ios_base::sync_with_stdio(false),cin.tie(0), cout.tie(0);
    int tt=1;
    //cin >> tt;
    while(tt--)
    {
        int n;
        cin >> n;
        vector<pii> niz(n);
        map<int,int> xovi;
        map<int,int> yovi;
        for(int i=0; i<n; i++)
        {
            cin >> niz[i].fi >> niz[i].sc;
            xovi[niz[i].fi] ++;
            yovi[niz[i].sc] ++;
        }
        int rez = 0;
        for(int i=0; i<n; i++)
        {
            pii tr = niz[i];
            rez+=(xovi[tr.fi]-1)*(yovi[tr.sc]-1);
        }
        cout << rez << endl;

    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 5 ms 1368 KB Output is correct
13 Correct 5 ms 1372 KB Output is correct
14 Correct 8 ms 1752 KB Output is correct
15 Correct 91 ms 8000 KB Output is correct
16 Correct 98 ms 8444 KB Output is correct
17 Correct 91 ms 8020 KB Output is correct
18 Correct 91 ms 8016 KB Output is correct
19 Correct 251 ms 14756 KB Output is correct
20 Correct 183 ms 11860 KB Output is correct
21 Correct 270 ms 15596 KB Output is correct
22 Correct 272 ms 15544 KB Output is correct