#include <bits/stdc++.h>
#define PI 3.1415926535897932384626
using namespace std;
struct vec
{
long double x,y;
bool operator ==(const vec &a) const{
return x==a.x&&y==a.y;
}
bool operator <(const vec &a) const{
if(a.x!=x) return x<a.x;
return y<a.y;
}
vec operator +(const vec &a) const{
return {x+a.x,y+a.y};
}
vec operator *(const long double &a) const{
return {x*a,y*a};
}
vec operator -(const vec &a) const{
return {x-a.x,y-a.y};
}
vec operator /(const long double &a) const{
return {x/a,y/a};
}
long double len() const{
return sqrt(x*x+y*y);
}
long double dot(const vec &a) const{
return x*a.x+y*a.y;
}
long double crs(const vec &a) const{
return x*a.y-y*a.x;
}
vec proj(const vec &a) const{
return (a/a.len())*(*this).dot(a)/a.len();
}
};
struct P
{
int x,y,z;
bool operator <(const P &a) const{
return y>a.y;
}
};
bool as(P a,P b)
{
if(a.x!=b.x)
return a.x<b.x;
return a.y<b.y;
}
bool asd(P a,P b)
{
if(a.z!=b.z)
return a.z<b.z;
return a.x<b.x;
}
bool asdf(P a,P b)
{
if(a.y!=b.y)
return a.y<b.y;
return a.z<b.z;
}
long long x,y,z,mod=1000000007;
vector<int> v[1];
int i,n,m,k,a,d,b,c,dx[10]={1,0,-1,0},dy[10]={0,1,0,-1};
int e;
int o[1];
int l[1];
int par[1];
int j[1];
//stack<int> s;
set<int> s;
queue<int> q,q1;
P u[211111];
char r[1];
//string r,r1;
//2147483647
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
map<int,int> p;
//v.resize(unique(v.begin(),v.end())-v.begin());
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//rng();
int main()
{
scanf("%d",&a);
for(int t=1;t<=a;t++)
scanf("%d",&u[t].x);
for(int t=1;t<=a;t++)
scanf("%d",&u[t].y);
for(int t=1;t<=a;t++)
scanf("%d",&u[t].z);
sort(u+1,u+a+1,as);
n=1,m=1;
for(int t=1;t<=a+1;t++)
{
if(u[t].x!=u[n].x||u[t].y!=u[n].y)
{
x-=(long long)(t-n)*(t-n-1)/2;
n=t;
}
if(u[t].x!=u[m].x)
{
x+=(long long)(t-m)*(t-m-1)/2;
m=t;
}
}
n=1,m=1;
sort(u+1,u+a+1,asd);
for(int t=1;t<=a+1;t++)
{
if(u[t].x!=u[n].x||u[t].z!=u[n].z)
{
x-=(long long)(t-n)*(t-n-1)/2;
n=t;
}
if(u[t].z!=u[m].z)
{
x+=(long long)(t-m)*(t-m-1)/2;
m=t;
}
}
n=1,m=1;
sort(u+1,u+a+1,asdf);
for(int t=1;t<=a+1;t++)
{
if(u[t].y!=u[n].y||u[t].z!=u[n].z)
{
x-=(long long)(t-n)*(t-n-1)/2;
n=t;
}
if(u[t].y!=u[m].y)
{
x+=(long long)(t-m)*(t-m-1)/2;
m=t;
}
}
n=1;
for(int t=1;t<=a+1;t++)
{
if(u[t].y!=u[n].y||u[t].z!=u[n].z||u[t].x!=u[n].x)
{
x+=(long long)(t-n)*(t-n-1)/2*3;
n=t;
}
}
printf("%lld",x);
}
Compilation message
museum.cpp: In function 'int main()':
museum.cpp:102:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&a);
~~~~~^~~~~~~~~
museum.cpp:104:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&u[t].x);
~~~~~^~~~~~~~~~~~~~
museum.cpp:106:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&u[t].y);
~~~~~^~~~~~~~~~~~~~
museum.cpp:108:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&u[t].z);
~~~~~^~~~~~~~~~~~~~
/tmp/ccBpGI9n.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccL3f1q0.o:museum.cpp:(.text.startup+0x0): first defined here
/tmp/ccBpGI9n.o: In function `main':
grader.cpp:(.text.startup+0x201): undefined reference to `CountSimilarPairs(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status