Submission #1219561

#TimeUsernameProblemLanguageResultExecution timeMemory
1219561lizi14별들과 삼각형 (IZhO11_triangle)C++20
0 / 100
2095 ms448 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;
    }
    int ans=0;
    sort(v.begin(),v.end());
    for(int i=0; i<v.size(); i++){
        for(int j=i+1; j<v.size(); j++){
            if( v[j].first>v[i].first)break;
            if(v[j].first==v[i].first){
                
                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...