답안 #499012

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499012 2021-12-27T03:43:58 Z beksultan04 별들과 삼각형 (IZhO11_triangle) C++14
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
#define pii pair<int,int>
#define ret return
#define fr first
#define sc second
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define nosol puts("-1");
#define pb push_back
#define endi puts("");
const int N = 1e6+12,INF = 1e15+7;
#define ordered_set tree <int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int y[N],x[N];


main(){
	int n,i,x,y,ans=0;
	cin>>n;
	vector <pii> v;
	map<int,int> mpx,mpy;
	for (i=1;i<=n;++i){
		cin>>x>>y;
		mpx[x]++;
		mpy[y]++;
		v.pb({x,y});
	}
	
	for (auto p:v){
		int x = p.fr,y = p.sc;
		ans += (mpx[x]-1)*(mpx[y]-1);
	}
	cout <<ans;
	
}






Compilation message

triangle.cpp:24:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   24 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -