# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
971964 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 1 ms | 428 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 <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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |