답안 #88620

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88620 2018-12-07T05:33:32 Z toloraia 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
808 ms 7520 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
//#define temo

using namespace std;

const int N = 300007;

map < int, int > M1, M2;
int n;
int x[N], y[N];
ll ans;

int main()
{
    cin>>n;
    for (int i = 1; i <= n; i++){
        cin>>x[i]>>y[i];
        M1[x[i]]++;
        M2[y[i]]++;
    }
    for (int i = 1; i <= n; i++){
        ll p = M1[x[i]] - 1;
        ll q = M2[y[i]] - 1;
        ans += p * q;
    }
    cout<<ans<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 2 ms 448 KB Output is correct
4 Correct 2 ms 620 KB Output is correct
5 Correct 2 ms 620 KB Output is correct
6 Correct 2 ms 620 KB Output is correct
7 Correct 2 ms 620 KB Output is correct
8 Correct 2 ms 620 KB Output is correct
9 Correct 2 ms 620 KB Output is correct
10 Correct 3 ms 620 KB Output is correct
11 Correct 3 ms 624 KB Output is correct
12 Correct 16 ms 1308 KB Output is correct
13 Correct 17 ms 1452 KB Output is correct
14 Correct 23 ms 2048 KB Output is correct
15 Correct 275 ms 5684 KB Output is correct
16 Correct 291 ms 6004 KB Output is correct
17 Correct 249 ms 6004 KB Output is correct
18 Correct 250 ms 6004 KB Output is correct
19 Correct 710 ms 7364 KB Output is correct
20 Correct 500 ms 7364 KB Output is correct
21 Correct 786 ms 7520 KB Output is correct
22 Correct 808 ms 7520 KB Output is correct