what is wrong in my solution to this problem? D. Ball

Revision en1, by balleballe, 2024-10-11 10:00:45

Hello codeforces!

https://codeforces.net/contest/12/problem/D

this is the problem and here is my submission:

https://codeforces.net/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 :)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English balleballe 2024-10-11 10:05:02 594
en1 English balleballe 2024-10-11 10:00:45 1303 Initial revision (published)