Submission #547819

# Submission time Handle Problem Language Result Execution time Memory
547819 2022-04-11T19:55:11 Z racsosabe Star triangles (IZhO11_triangle) C++14
100 / 100
309 ms 13344 KB
#include <bits/stdc++.h>
using namespace std;

int n;
map<int, int> X;
map<int, int> Y;

int main(){
	scanf("%d", &n);
	vector<pair<int, int>> v;
	for(int i = 0; i < n; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		X[x]++;
		Y[y]++;
		v.emplace_back(make_pair(x, y));
	}
	long long ans = 0;
	for(auto e : v){
		ans += 1ll * (X[e.first] - 1) * (Y[e.second] - 1);
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
triangle.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d %d", &x, &y);
      |   ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 300 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 7 ms 952 KB Output is correct
13 Correct 7 ms 980 KB Output is correct
14 Correct 11 ms 1364 KB Output is correct
15 Correct 118 ms 6156 KB Output is correct
16 Correct 112 ms 6468 KB Output is correct
17 Correct 105 ms 6100 KB Output is correct
18 Correct 102 ms 6092 KB Output is correct
19 Correct 297 ms 13312 KB Output is correct
20 Correct 241 ms 9144 KB Output is correct
21 Correct 290 ms 13276 KB Output is correct
22 Correct 309 ms 13344 KB Output is correct