Submission #899210

# Submission time Handle Problem Language Result Execution time Memory
899210 2024-01-05T15:37:41 Z pcc Star triangles (IZhO11_triangle) C++14
100 / 100
254 ms 5980 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


const int mxn = 3e5+10;
map<int,int> xcnt,ycnt;
pii arr[mxn];

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	for(int i = 0;i<n;i++){
		cin>>arr[i].fs>>arr[i].sc;
		xcnt[arr[i].fs]++;
		ycnt[arr[i].sc]++;
	}
	ll ans = 0;
	for(int i = 0;i<n;i++){
		ans += 1ll*(xcnt[arr[i].fs]-1)*(ycnt[arr[i].sc]-1);
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 5 ms 860 KB Output is correct
13 Correct 4 ms 860 KB Output is correct
14 Correct 7 ms 1116 KB Output is correct
15 Correct 79 ms 5416 KB Output is correct
16 Correct 92 ms 5684 KB Output is correct
17 Correct 96 ms 5460 KB Output is correct
18 Correct 79 ms 5460 KB Output is correct
19 Correct 211 ms 5712 KB Output is correct
20 Correct 164 ms 5980 KB Output is correct
21 Correct 232 ms 5860 KB Output is correct
22 Correct 254 ms 5712 KB Output is correct