Submission #971964

#TimeUsernameProblemLanguageResultExecution timeMemory
971964vjudge1Star triangles (IZhO11_triangle)C++17
0 / 100
1 ms428 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; vector<pair<int, int>> p; int main(){ int n; cin >> n; p.resize(n); for(int i = 0; i < n; i++) { int x, y; cin >> x >> y; p[i].first = x; p[i].second = y; } std::map<int, int> horizontal, vertical; for (auto const & x : p) { horizontal[x.first]++; vertical[x.second]++; } int ans = 0; for(int i = 0; i < n; i++) { int h = horizontal[p[i].first]-1; int v = vertical[p[i].second]-1; if(h > 0 && v > 0){ horizontal[p[i].first]--; vertical[p[i].second]--; ans++; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...