Submission #229367

#TimeUsernameProblemLanguageResultExecution timeMemory
229367DodgeBallManStar triangles (IZhO11_triangle)C++14
100 / 100
462 ms13304 KiB
#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 (stderr)

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]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...