Submission #87012

# Submission time Handle Problem Language Result Execution time Memory
87012 2018-11-29T07:40:02 Z Aydarov03 Star triangles (IZhO11_triangle) C++14
0 / 100
2 ms 484 KB
#include <bits/stdc++.h>
#define fr first
#define sc second
using namespace std;

map<int , int> x , y;

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);
        x[a]++;
        y[b]++;
        xy.push_back( {a , b} );
    }



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


    cout << ans;

}

Compilation message

triangle.cpp:15:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
triangle.cpp: In function 'int main()':
triangle.cpp:31:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < xy.size(); i++)
                    ~~^~~~~~~~~~~
triangle.cpp:23: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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Incorrect 2 ms 484 KB Output isn't correct
5 Halted 0 ms 0 KB -