답안 #87666

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
87666 2018-12-01T17:45:15 Z thebes 별들과 삼각형 (IZhO11_triangle) C++14
100 / 100
547 ms 22784 KB
#include <bits/stdc++.h>
using namespace std;

const int MN = 3e5+5;
map<int,int> x, y;
pair<int,int> p[MN];
int N, i; long long ans;

int main(){
        for(scanf("%d",&N),i=1;i<=N;i++){
                scanf("%d%d",&p[i].first,&p[i].second);
                x[p[i].first]++;
                y[p[i].second]++;
        }
        for(i=1;i<=N;i++)
                ans += (x[p[i].first]-1)*1LL*(y[p[i].second]-1);
        printf("%lld\n",ans);
        return 0;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:10:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         for(scanf("%d",&N),i=1;i<=N;i++){
             ~~~~~~~~~~~~~~^~~~
triangle.cpp:11:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf("%d%d",&p[i].first,&p[i].second);
                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 668 KB Output is correct
4 Correct 2 ms 668 KB Output is correct
5 Correct 2 ms 668 KB Output is correct
6 Correct 2 ms 668 KB Output is correct
7 Correct 2 ms 668 KB Output is correct
8 Correct 2 ms 668 KB Output is correct
9 Correct 2 ms 668 KB Output is correct
10 Correct 3 ms 668 KB Output is correct
11 Correct 3 ms 672 KB Output is correct
12 Correct 11 ms 1200 KB Output is correct
13 Correct 11 ms 1320 KB Output is correct
14 Correct 16 ms 1916 KB Output is correct
15 Correct 169 ms 6996 KB Output is correct
16 Correct 193 ms 9436 KB Output is correct
17 Correct 227 ms 11500 KB Output is correct
18 Correct 212 ms 13672 KB Output is correct
19 Correct 479 ms 21108 KB Output is correct
20 Correct 359 ms 21856 KB Output is correct
21 Correct 547 ms 22784 KB Output is correct
22 Correct 541 ms 22784 KB Output is correct