Submission #168100

# Submission time Handle Problem Language Result Execution time Memory
168100 2019-12-11T11:19:15 Z GioChkhaidze Star triangles (IZhO11_triangle) C++14
100 / 100
529 ms 15608 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=3e5+5;
ll n,x[N],y[N],ans;
map < ll , ll > f1,f2;
main () {
	scanf("%d",&n);
	for (int i=1; i<=n; i++) {
		scanf("%d%d",&x[i],&y[i]);
		f1[x[i]]++,f2[y[i]]++;
	}
	
	for (int i=1; i<=n; i++) 
		ans+=(f1[x[i]]-1)*(f2[y[i]]-1);
		
	printf("%lld\n",ans);
}

Compilation message

triangle.cpp:7:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
triangle.cpp: In function 'int main()':
triangle.cpp:8:15: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
  scanf("%d",&n);
             ~~^
triangle.cpp:10:27: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   scanf("%d%d",&x[i],&y[i]);
                ~~~~~      ^
triangle.cpp:10:27: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
triangle.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
triangle.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&x[i],&y[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 11 ms 1272 KB Output is correct
13 Correct 10 ms 1272 KB Output is correct
14 Correct 17 ms 1784 KB Output is correct
15 Correct 169 ms 8056 KB Output is correct
16 Correct 257 ms 8316 KB Output is correct
17 Correct 173 ms 8064 KB Output is correct
18 Correct 188 ms 7972 KB Output is correct
19 Correct 484 ms 14880 KB Output is correct
20 Correct 339 ms 11896 KB Output is correct
21 Correct 508 ms 15608 KB Output is correct
22 Correct 529 ms 15608 KB Output is correct