Submission #20814

# Submission time Handle Problem Language Result Execution time Memory
20814 2017-02-16T09:03:06 Z jjwdi0 Star triangles (IZhO11_triangle) C++11
0 / 100
9 ms 29300 KB
#include <stdio.h>
#include <set>
#define sz(x) ((int)(x).size())
using namespace std;

set<int> s1[300005], s2[300005];
int N;
long long ans;

int main() {
	scanf("%d", &N);
	for(int i=0, x, y; i<N; i++) {
		scanf("%d %d", &x, &y);
		s1[x].insert(y);
		s2[y].insert(x);
	}
	for(int i=1; i<=100000; i++) {
		if(sz(s1[i]) >= 2) {
			for(auto it : s1[i]) {
				ans += (long long)(sz(s1[i]) - 1) * (sz(s2[it]) - 1);
			}
		}
	}
	printf("%lld", ans);
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:11:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
                 ^
triangle.cpp:13:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &x, &y);
                         ^
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 29300 KB Output isn't correct
2 Halted 0 ms 0 KB -