# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974974 | vjudge1 | Star triangles (IZhO11_triangle) | C++17 | 940 ms | 34548 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define forn(i,n) for(int i = 1; i<=n; i++)
#define fi first
#define sc second
using namespace std;
int main(){
map<ll,ll> mpx,mpy;
map<pair<ll,ll>, ll> mpdup;
ll n;
cin >> n;
pair<ll,ll> arr[n+99];
forn(i,n){
ll x,y;
cin >> x >> y;
mpx[x]++;
mpy[y]++;
mpdup[{x,y}]++;
arr[i] = {x,y};
}
ll sum = 0;
forn(i,n){
ll x = arr[i].fi,y = arr[i].sc;
if(mpdup[{x,y}] == 0)continue;
ll dup = mpdup[{x,y}];
if(mpdup[{x,y}] == 1){
sum += (mpx[x]-1) * (mpy[y]-1);
}else{
sum += (mpx[x] - dup )*(mpy[y] - dup )*(dup);
}
mpdup[{x,y}] = 0;
}
cout<<sum;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |