Submission #1113741

# Submission time Handle Problem Language Result Execution time Memory
1113741 2024-11-17T09:29:46 Z Agageldi Star triangles (IZhO11_triangle) C++17
100 / 100
272 ms 12104 KB
/*
ID: agageld1
LANG: C++17
TASK:
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define N 400005
#define ff first
#define ss second
#define pb push_back
#define sz(s) (int)s.size()

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll n, t;
pair <int,int> a[N];
map <int,int> vis,m;

int main () {
	ios::sync_with_stdio(0);cin.tie(0);
	cin >> n;
	for(int i=1;i<=n;i++) {
		cin >> a[i].ff >> a[i].ss;
		vis[a[i].ff]++;
		m[a[i].ss]++;
	}
	int ans = 0;
	for(int i =1;i<=n;i++) {
		ans += (vis[a[i].ff] - 1) * (m[a[i].ss] - 1);
	}
	cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 504 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 512 KB Output is correct
12 Correct 5 ms 1156 KB Output is correct
13 Correct 5 ms 1104 KB Output is correct
14 Correct 10 ms 1360 KB Output is correct
15 Correct 86 ms 7564 KB Output is correct
16 Correct 94 ms 7864 KB Output is correct
17 Correct 87 ms 7752 KB Output is correct
18 Correct 93 ms 7752 KB Output is correct
19 Correct 239 ms 11592 KB Output is correct
20 Correct 180 ms 9868 KB Output is correct
21 Correct 268 ms 12104 KB Output is correct
22 Correct 272 ms 12104 KB Output is correct