제출 #87013

#제출 시각아이디문제언어결과실행 시간메모리
87013Aydarov03별들과 삼각형 (IZhO11_triangle)C++14
100 / 100
1053 ms25096 KiB
#include <bits/stdc++.h>
#define fr first
#define sc second
using namespace std;

map<int , int> x , y;
map <pair<int,int> , bool> used;


vector < pair<int,int> > xy;






main()
{
    int n , ans = 0;
    cin >> n;

    for(int i = 1; i <= n; i++)
    {
        int a , b;
        scanf("%d%d" , &a , &b);


        if( used.count( { a,b } )  )continue;
        x[a]++;
        y[b]++;
        xy.push_back( {a , b} );
        used[ {a,b} ] = 1;
    }



    for(int i = 0; i < xy.size(); i++)
    {
        if( y.count( xy[i].second ) )
        ans +=  (x[ xy[i].first ]-1) *  (y[  xy[i].second ] - 1) ;
    }


    cout << ans;

}

컴파일 시 표준 에러 (stderr) 메시지

triangle.cpp:17:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
triangle.cpp: In function 'int main()':
triangle.cpp:37:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < xy.size(); i++)
                    ~~^~~~~~~~~~~
triangle.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d" , &a , &b);
         ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...