Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

Правка en1, от balleballe, 2024-10-11 10:00:45

Hello codeforces!

https://mirror.codeforces.com/contest/12/problem/D

this is the problem and here is my submission:

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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский balleballe 2024-10-11 10:05:02 594
en1 Английский balleballe 2024-10-11 10:00:45 1303 Initial revision (published)