Submission #976553

#TimeUsernameProblemLanguageResultExecution timeMemory
976553vjudge1Star triangles (IZhO11_triangle)C++17
100 / 100
390 ms14260 KiB
#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 timeMemoryGrader output
Fetching results...