Hello codeforces!
https://codeforces.me/contest/12/problem/D
this is the problem and here is my submission:
https://codeforces.me/contest/12/submission/285268512
this is failing on 2nd test case which is
Input
5
2 8 10 0 7
7 7 3 0 10
2 8 3 2 2
Output
0
Answer
1
Checker Log
wrong answer 1st numbers differ — expected: '1', found: '0'
but where is a lady which is dominating any other lady in all three aspects, so answer should be zero.
sorry i am stupid i am stuck at this question. so i need help.
here is the main part of my code
struct lady
{
ll x, y, z;
};
bool cmp(lady A, lady B)
{
return (A.x > B.x);
}
void solve()
{
ll n;
cin >> n;
vector a(n);
for (ll i = 0; i < n; ++i)
{
cin >> a[i].x;
}
for (ll i = 0; i < n; ++i)
{
cin >> a[i].y;
}
for (ll i = 0; i < n; ++i)
{
cin >> a[i].z;
}
sort(a.begin(), a.end(), cmp);
vector d = {a[0]};
for (ll i = 1; i < n; ++i)
{
auto temp = d.back();
if ((temp.x > a[i].x) && (temp.y > a[i].y) && (temp.z > a[i].z))
{
continue;
}
else
{
d.push_back(a[i]);
}
}
ll ans = n — d.size();
cout << ans << endl;
}
thanks :)