Submission #165988

# Submission time Handle Problem Language Result Execution time Memory
165988 2019-11-30T04:30:01 Z Gurban Star triangles (IZhO11_triangle) C++11
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>

#define pb push_back
#define ss second
#define ff first
#define N 100005
#define inf 1000000009
#define ll long long
#define mid(a,b) (a+b)/2

using namespace std;

int n,sum;
pair <int,int> a[N];
map <int,int> m,p;

int main()
{
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
		scanf("%d%d",&a[i].ff,&a[i].ss);
		m[a[i].ff]++;
		p[a[i].ss]++;
	}
	for(int i = 1;i <= n;i++)
		sum += ((m[a[i].ff] - 1) * (m[a[i].ss] - 1));
	cout << sum << '\n';	
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
triangle.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&a[i].ff,&a[i].ss);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -