Submission #671619

# Submission time Handle Problem Language Result Execution time Memory
671619 2022-12-13T11:25:36 Z smartmonky Star triangles (IZhO11_triangle) C++14
100 / 100
277 ms 9084 KB
#include <bits/stdc++.h>
  
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define int long long
using namespace std;
 
int n;
map <int,int> x, y;
main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	vector <pair <int,int> > vp(n);
	for(int i = 0; i < n; i++){
		cin >> vp[i].ff >> vp[i].ss;
		x[vp[i].ff]++;
		y[vp[i].ss]++;
	}
	int ans = 0;
	for(auto f : vp){
		ans += (x[f.ff] - 1) * (y[f.ss] - 1);
	}
	cout << ans;
}

Compilation message

triangle.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 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 5 ms 1108 KB Output is correct
13 Correct 7 ms 1108 KB Output is correct
14 Correct 9 ms 1552 KB Output is correct
15 Correct 98 ms 5832 KB Output is correct
16 Correct 110 ms 5864 KB Output is correct
17 Correct 99 ms 5708 KB Output is correct
18 Correct 97 ms 5664 KB Output is correct
19 Correct 277 ms 8800 KB Output is correct
20 Correct 186 ms 7476 KB Output is correct
21 Correct 273 ms 9032 KB Output is correct
22 Correct 277 ms 9084 KB Output is correct