# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
971964 | vjudge1 | 별들과 삼각형 (IZhO11_triangle) | C++17 | 1 ms | 428 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |