Submission #1100549

# Submission time Handle Problem Language Result Execution time Memory
1100549 2024-10-14T08:41:58 Z vjudge1 Star triangles (IZhO11_triangle) C++14
100 / 100
113 ms 22384 KB
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define S second
#define F first
#define inputt freopen("triangles.txt","r",stdin);freopen("triangles.txt","w",stdout);
#define ahah ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

const int N=1e6+7;
const int MOD=1e9+7;

int x[N],y[N];
unordered_map<int,vector<int>>mpx;
unordered_map<int,vector<int>>mpy;

signed main() {
	ahah
	
	int n;
	cin >> n;
	for(int i = 1 ; i <= n ; i++){
		cin >> x[i] >> y[i];
		mpx[x[i]].pb(y[i]);
		mpy[y[i]].pb(x[i]);
	}
	int ans=0;
	for(int i = 1 ; i <= n ; i++){
		ans+=((int)mpx[x[i]].size()-1)*((int)mpy[y[i]].size()-1);
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 1 ms 2384 KB Output is correct
7 Correct 1 ms 2384 KB Output is correct
8 Correct 1 ms 2384 KB Output is correct
9 Correct 1 ms 2384 KB Output is correct
10 Correct 1 ms 2384 KB Output is correct
11 Correct 1 ms 2384 KB Output is correct
12 Correct 5 ms 3408 KB Output is correct
13 Correct 4 ms 3408 KB Output is correct
14 Correct 6 ms 3920 KB Output is correct
15 Correct 45 ms 13568 KB Output is correct
16 Correct 54 ms 14080 KB Output is correct
17 Correct 42 ms 13576 KB Output is correct
18 Correct 40 ms 13532 KB Output is correct
19 Correct 103 ms 19468 KB Output is correct
20 Correct 77 ms 16900 KB Output is correct
21 Correct 113 ms 22272 KB Output is correct
22 Correct 112 ms 22384 KB Output is correct