답안 #229367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
229367 2020-05-04T10:30:06 Z DodgeBallMan 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
462 ms 13304 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 3e5 + 10;
int n, x[N], y[N];
map<int, long long> m1, m2;
long long ans;
int main()
{
    scanf("%d",&n);
    for( int i = 1 ; i <= n ; i++ ) {
        scanf("%d %d",&x[i],&y[i]);
        m1[x[i]]++, m2[y[i]]++;
    }
    for( int i = 1 ; i <= n ; i++ ) ans += ( m1[x[i]] - 1 ) * ( m2[y[i]] - 1 );
    printf("%lld",ans);
    return 0;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
triangle.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d",&x[i],&y[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 13 ms 1152 KB Output is correct
13 Correct 12 ms 1280 KB Output is correct
14 Correct 16 ms 1664 KB Output is correct
15 Correct 221 ms 7164 KB Output is correct
16 Correct 188 ms 7416 KB Output is correct
17 Correct 134 ms 7160 KB Output is correct
18 Correct 134 ms 7160 KB Output is correct
19 Correct 360 ms 12536 KB Output is correct
20 Correct 285 ms 10360 KB Output is correct
21 Correct 426 ms 13176 KB Output is correct
22 Correct 462 ms 13304 KB Output is correct