Submission #152594

#TimeUsernameProblemLanguageResultExecution timeMemory
152594beso123별들과 삼각형 (IZhO11_triangle)C++14
100 / 100
1024 ms18600 KiB
#include <bits/stdc++.h>
#define int  long long
#define pii pair<int,int>
#define x first
#define y second
using namespace std;
int n,ans;
map <int,int> x,y;
vector <pii> v;
main(){
cin>>n;
for(int k=1;k<=n;k++){
    int a,b;
    cin>>a>>b;
    x[a]++;
    y[b]++;
    v.push_back(make_pair(a,b));
}
for(int k=0;k<v.size();k++){
   int a=v[k].x,b=v[k].y;
   int p1=x[a]-1,p2=y[b]-1;

   ans+=(p1*p2);
}
cout<<ans;
return 0;
}

Compilation message (stderr)

triangle.cpp:10:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
triangle.cpp: In function 'int main()':
triangle.cpp:19:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for(int k=0;k<v.size();k++){
             ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...