답안 #946519

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946519 2024-03-14T17:49:03 Z sondos225 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
255 ms 15516 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define yes "YES"
#define no "NO"
#define bigg INT_MAX
#define debug(x) cout<<(#x)<<" = " <<x<<endl;
#define all(x) x.begin(),x.end()
#define sz size()
#define nn '\n'
#define mms(x,y) memset(x,y,sizeof(x))
#define forr(i,j,n) for (int i=j; i<n; i++)
#define forn(i,j,n) for (int i=j; i>n; i--)
#define fi first
#define se second
#define la "LA"
#define cinn(x,y) for(int i=0; i<y; i++) cin>>x[i];
#define pii pair<int,int>
signed main()
{
//    #ifndef LOCAL
//    freopen("lifeguards.in","r",stdin);
//    freopen("lifeguards.out","w", stdout);
//    #endif
    fast
    int n;
    cin>>n;
    pii a[n];
    map<int,int> mx;
    map<int,int> my;
    forr(i,0,n)
    {
        cin>>a[i].fi >>a[i].se;
        mx[a[i].fi]++;
        my[a[i].se]++;
    }
    int ans=0;
    forr(i,0,n)
    {
        ans+=((mx[a[i].fi]-1)*(my[a[i].se]-1));
       // cin>>a[i].fi >>a[i].se;
       // ++;
       // ++;
    }
    cout<<ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 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 0 ms 460 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 1624 KB Output is correct
13 Correct 5 ms 1368 KB Output is correct
14 Correct 8 ms 1728 KB Output is correct
15 Correct 90 ms 7996 KB Output is correct
16 Correct 92 ms 8436 KB Output is correct
17 Correct 86 ms 8020 KB Output is correct
18 Correct 85 ms 8040 KB Output is correct
19 Correct 250 ms 14936 KB Output is correct
20 Correct 170 ms 11868 KB Output is correct
21 Correct 255 ms 15516 KB Output is correct
22 Correct 250 ms 15464 KB Output is correct