Submission #1219534

#TimeUsernameProblemLanguageResultExecution timeMemory
1219534lizi14별들과 삼각형 (IZhO11_triangle)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){
    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=0; j<v.size(); j++){
            //if(h==1 && v[j].first!=v[i].first)break;
            if(v[j].first==v[i].first && j!=i){
                h=1;
                for(int t=0; t<v.size(); t++){
                    
                    if(t!=i && t!=j){
                        if(v[t].second==v[i].second ){
                            ans++;
                        }
                        if(v[t].second==v[j].second)ans++;    
                    }
                    
                }
            }
        }
    }
    cout<<ans<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...