# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
976553 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 390 ms | 14260 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |