# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
522963 | TheKingAleks | 별들과 삼각형 (IZhO11_triangle) | C++14 | 164 ms | 11808 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int MAX_N = 3e5+2;
pair<int,int> a[MAX_N];
unordered_map<int,int> on_y;
unordered_map<int,int> on_x_res;
bool cmp(pair<int,int> e1, pair<int,int> e2)
{
if(e1.second == e2.second) return e1.first < e2.first;
return e1.second < e2.second;
}
int ans = 0;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,x0,y0;
cin>>n;
for(int i=0; i<n; i++)
{
cin>>x0>>y0;
a[i] = {x0,y0};
on_y[y0]++;
}
sort(a,a+n,cmp);
for(int i=0; i<n; i++)
{
if(on_x_res.find(a[i].first) != on_x_res.end()) ans += on_x_res[a[i].first];
on_x_res[a[i].first] += on_y[a[i].second]-1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |