답안 #5394

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
5394 2014-04-26T19:11:08 Z baneling100 별들과 삼각형 (IZhO11_triangle) C++
100 / 100
500 ms 6588 KB
#include <stdio.h>
#include <map>

using namespace std;

map <int,int> m1;
map <int,int> m2;
int n, x[300001], y[300001];
long long ans;

void input(void)
{
    int i;

    scanf("%d",&n);
    for(i=1 ; i<=n ; i++)
    {
        scanf("%d %d",&x[i],&y[i]);
        m1[x[i]]++;
        m2[y[i]]++;
    }
}

void process(void)
{
    int i;

    for(i=1 ; i<=n ; i++)
        ans+=((long long)m1[x[i]]-1)*(m2[y[i]]-1);
}

void output(void)
{
    printf("%lld",ans);
}

int main(void)
{
    input();
    process();
    output();

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3552 KB Output is correct
2 Correct 0 ms 3552 KB Output is correct
3 Correct 0 ms 3552 KB Output is correct
4 Correct 0 ms 3552 KB Output is correct
5 Correct 0 ms 3552 KB Output is correct
6 Correct 0 ms 3552 KB Output is correct
7 Correct 0 ms 3552 KB Output is correct
8 Correct 0 ms 3552 KB Output is correct
9 Correct 0 ms 3552 KB Output is correct
10 Correct 0 ms 3552 KB Output is correct
11 Correct 0 ms 3552 KB Output is correct
12 Correct 4 ms 3948 KB Output is correct
13 Correct 8 ms 3948 KB Output is correct
14 Correct 12 ms 4344 KB Output is correct
15 Correct 172 ms 6456 KB Output is correct
16 Correct 172 ms 6456 KB Output is correct
17 Correct 164 ms 6456 KB Output is correct
18 Correct 160 ms 6456 KB Output is correct
19 Correct 464 ms 6588 KB Output is correct
20 Correct 320 ms 6588 KB Output is correct
21 Correct 488 ms 6588 KB Output is correct
22 Correct 500 ms 6588 KB Output is correct