Submission #944473

#TimeUsernameProblemLanguageResultExecution timeMemory
944473Zena_HossamStar triangles (IZhO11_triangle)C++14
100 / 100
751 ms37492 KiB
#include <bits/stdc++.h> using namespace std; #define fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll double #define ll long long //#define ll1 long long #define F first #define S second #define sz size() #define all(s) s.begin(),s.end() #define all1(s) s.rbegin(),s.rend() int main() { // freopen("measurement.in","r",stdin);freopen("measurement.out","w",stdout); ll T=1; //cin>>T;ll oo=0; while(T--) { ll n; cin>>n; pair<ll,ll>a[n];map<ll,map<ll,ll>>m; map<ll,ll>x,b; for(ll i=0;i<n;i++){ cin>>a[i].first>>a[i].second;x[a[i].F]++;b[a[i].S]++; m[a[i].first][a[i].second]++; }ll c=0; for(ll i=0;i<n;i++){ll g=a[i].first,h=a[i].second; c+=(x[g]-1)*(b[h]-1)-(m[g][h]-1); }cout<<c; } }

Compilation message (stderr)

triangle.cpp:5: warning: "ll" redefined
    5 | #define ll long long
      | 
triangle.cpp:4: note: this is the location of the previous definition
    4 | #define ll double
      |
#Verdict Execution timeMemoryGrader output
Fetching results...