Submission #976553

# Submission time Handle Problem Language Result Execution time Memory
976553 2024-05-06T17:32:04 Z vjudge1 Star triangles (IZhO11_triangle) C++17
100 / 100
390 ms 14260 KB
#include <iostream>
#include <map>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
	ll n; cin >> n;
	map <ll, ll> row, col;
	vector<pair<ll, ll>> titik;

	for (ll i = 0; i < n; i++) {
		ll r, c; cin >> r >> c;
		titik.push_back({ r, c });
		row[r]++;
		col[c]++;
	}

	ll sum = 0;

	//JANGAN LUPA KURANGIN SATU!

	for (auto i : titik) {
		ll total_r = row[i.first] - 1;
		ll total_c = col[i.second] - 1;
		sum = sum + (total_r * total_c);
 	}

	cout << sum << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 428 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 600 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 9 ms 1116 KB Output is correct
13 Correct 9 ms 1240 KB Output is correct
14 Correct 12 ms 1496 KB Output is correct
15 Correct 129 ms 5820 KB Output is correct
16 Correct 155 ms 6068 KB Output is correct
17 Correct 128 ms 5904 KB Output is correct
18 Correct 133 ms 5780 KB Output is correct
19 Correct 371 ms 14260 KB Output is correct
20 Correct 251 ms 8892 KB Output is correct
21 Correct 390 ms 12780 KB Output is correct
22 Correct 386 ms 13920 KB Output is correct