Submission #545019

# Submission time Handle Problem Language Result Execution time Memory
545019 2022-04-03T10:19:10 Z MilosMilutinovic Star triangles (IZhO11_triangle) C++14
100 / 100
269 ms 12168 KB
#include<bits/stdc++.h>

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template<typename T> bool chkmin(T&x,T y){return x>y?x=y,1:0;}
template<typename T> bool chkmax(T&x,T y){return x<y?x=y,1:0;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int n,x[300005],y[300005];
map<int,int> cx,cy;

int main(){
	n=readint();
	for(int i=1;i<=n;i++)x[i]=readint(),y[i]=readint(),cx[x[i]]++,cy[y[i]]++;
	ll ans=0;
	for(int i=1;i<=n;i++)ans+=(cx[x[i]]-1)*1LL*(cy[y[i]]-1);
	printf("%lld\n",ans);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 7 ms 980 KB Output is correct
13 Correct 5 ms 980 KB Output is correct
14 Correct 9 ms 1364 KB Output is correct
15 Correct 104 ms 6164 KB Output is correct
16 Correct 109 ms 6420 KB Output is correct
17 Correct 95 ms 6176 KB Output is correct
18 Correct 115 ms 6196 KB Output is correct
19 Correct 262 ms 11520 KB Output is correct
20 Correct 212 ms 9220 KB Output is correct
21 Correct 269 ms 12084 KB Output is correct
22 Correct 257 ms 12168 KB Output is correct