Submission #166757

# Submission time Handle Problem Language Result Execution time Memory
166757 2019-12-03T17:01:28 Z Lightning Star triangles (IZhO11_triangle) C++14
100 / 100
561 ms 9248 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>
 
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
 
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
//#define int ll
 
const int N = 4e5;
const int INF = 1e9;
 
int n, x[N], y[N];
ll ans;
map <int, int> cntX, cntY;
 
int main () {
	ios_base::sync_with_stdio(false);
	cin >> n;
	fo(i, 1, n, 1) {
		cin >> x[i] >> y[i];
		++cntX[x[i]];
		++cntY[y[i]];
	}	
	fo(i, 1, n, 1) {
		ans += 1ll * (cntX[x[i]] - 1) * (cntY[y[i]] - 1);	
	}
	cout << ans;
	return 0;
}
# 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 3 ms 380 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 10 ms 1016 KB Output is correct
13 Correct 10 ms 1144 KB Output is correct
14 Correct 17 ms 1528 KB Output is correct
15 Correct 171 ms 6240 KB Output is correct
16 Correct 176 ms 6484 KB Output is correct
17 Correct 174 ms 6212 KB Output is correct
18 Correct 161 ms 6136 KB Output is correct
19 Correct 561 ms 8312 KB Output is correct
20 Correct 346 ms 9248 KB Output is correct
21 Correct 538 ms 8124 KB Output is correct
22 Correct 508 ms 8312 KB Output is correct