Submission #888004

# Submission time Handle Problem Language Result Execution time Memory
888004 2023-12-15T18:13:55 Z Hovhannes1234 Star triangles (IZhO11_triangle) C++17
100 / 100
374 ms 9916 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	map <long long, long long> mpx,mpy;
	vector <pair<int,int>> vec;
	for(int i=1; i<=n; i++){
		long long x,y;
		cin>>x>>y;
		vec.push_back({x,y});
		mpx[x]++;
		mpy[y]++;
	}
	long long ans=0;
	for(int i=0; i<vec.size(); i++){
		ans+=(mpx[vec[i].first]-1) * (mpy[vec[i].second]-1);
	}
	cout<<ans<<endl;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:17:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for(int i=0; i<vec.size(); i++){
      |               ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 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 1 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 8 ms 1116 KB Output is correct
13 Correct 9 ms 984 KB Output is correct
14 Correct 12 ms 1372 KB Output is correct
15 Correct 126 ms 5016 KB Output is correct
16 Correct 140 ms 5236 KB Output is correct
17 Correct 132 ms 4956 KB Output is correct
18 Correct 125 ms 5088 KB Output is correct
19 Correct 342 ms 9916 KB Output is correct
20 Correct 246 ms 6596 KB Output is correct
21 Correct 374 ms 9660 KB Output is correct
22 Correct 373 ms 8852 KB Output is correct