제출 #1219552

#제출 시각아이디문제언어결과실행 시간메모리
1219552lizi14Star triangles (IZhO11_triangle)C++20
0 / 100
2095 ms328 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    vector<pair<int,int>>v(n);
    for(int i=0; i<n; i++){
        int j,k;
        cin>>j>>k;
        pair<int,int>p={j,k};
        v[i]=p;
    }
    long long ans=0;
    sort(v.begin(),v.end());
    for(int i=0; i<v.size(); i++){
        int h=0;
        for(int j=i+1; j<v.size(); j++){
            if(h==1 && v[j].first>v[i].first)break;
            int b=0;
            if(v[j].first==v[i].first){
                h=1;
                for(int t=0; t<v.size(); t++){
                    //if(v[t].second!=v[i].second && v[t].second!=v[j].second && b==1)break;
                    if(t!=i && t!=j){
                        if(v[t].second==v[i].second ){
                            ans++;
                            b=1;
                        }
                        if(v[t].second==v[j].second){
                            ans++; 
                            b=1;
                        }
                    }
                    
                }
            }
        }
    }
    cout<<ans<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...