답안 #1065592

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1065592 2024-08-19T09:43:55 Z Malix 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
382 ms 13392 KB
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;
typedef vector<ll> li;
typedef vector<li> lii;
 
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LSOne(s) ((s)&(-s))
 
ll INF=1000000000000000010;
int inf=1e9+10;
ll M=1e9+7;

int main() {   
    int n;cin>>n;
    map<int,ll> x,y;
    vi a(n),b(n);
    REP(i,0,n)cin>>a[i]>>b[i];
    REP(i,0,n){
        x[a[i]]++;
        y[b[i]]++;
    }
    ll ans=0;
    REP(i,0,n)ans+=(x[a[i]]-1)*(y[b[i]]-1);
    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 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 1 ms 348 KB Output is correct
9 Correct 0 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 7 ms 1140 KB Output is correct
13 Correct 14 ms 1216 KB Output is correct
14 Correct 13 ms 1628 KB Output is correct
15 Correct 166 ms 7080 KB Output is correct
16 Correct 134 ms 7508 KB Output is correct
17 Correct 125 ms 7212 KB Output is correct
18 Correct 124 ms 7252 KB Output is correct
19 Correct 341 ms 12628 KB Output is correct
20 Correct 258 ms 10308 KB Output is correct
21 Correct 382 ms 13332 KB Output is correct
22 Correct 371 ms 13392 KB Output is correct