Submission #93819

# Submission time Handle Problem Language Result Execution time Memory
93819 2019-01-11T18:07:21 Z Noam527 Star triangles (IZhO11_triangle) C++17
100 / 100
445 ms 12408 KB
#include <bits/stdc++.h>
#define CHECK cout << "ok" << endl
#define finish(x) return cout << x << endl, 0
typedef long long ll;
typedef long double ldb;
const int md = 1e9 + 7, inf = 1e9 + 7;
using namespace std;

void debug(string names) {
	cout << '\n';
}
template<typename A1, typename... A2>
void debug(string names, A1 par, A2... left) {
	int pos = 0;
	for (; pos < names.size() && names[pos] != ' ' && names[pos] != ','; pos++)
		cout << names[pos];
	cout << ": " << par << "  ";
	while (pos < names.size() && (names[pos] == ' ' || names[pos] == ',')) {
		pos++;
	}
	names.erase(names.begin(), names.begin() + pos);
	debug(names, left...);
}

int n;
vector<pair<int, int>> a;
map<int, int> x, y;
ll ans = 0;

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	cin >> n; 
	a.resize(n);
	for (auto &i : a) cin >> i.first >> i.second, x[i.first]++, y[i.second]++;

	for (auto &i : a) ans += (ll)(x[i.first] - 1) * (y[i.second] - 1);

	finish(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 384 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 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 9 ms 1016 KB Output is correct
13 Correct 9 ms 1116 KB Output is correct
14 Correct 13 ms 1400 KB Output is correct
15 Correct 158 ms 6292 KB Output is correct
16 Correct 151 ms 6584 KB Output is correct
17 Correct 134 ms 6160 KB Output is correct
18 Correct 146 ms 6288 KB Output is correct
19 Correct 410 ms 11656 KB Output is correct
20 Correct 288 ms 9464 KB Output is correct
21 Correct 438 ms 12408 KB Output is correct
22 Correct 445 ms 12392 KB Output is correct