shehddhks   2년 전

why my code is wrong?

ingyu1008   2년 전

First of all, you should count the number of people the company is hiring. The code is calculating the opposite.

Secondly, the code is comparing kth element of v1 with the wrong value, which are v1[0].second, v2[0].second.
sort(v1.begin(), v1.end()) will sort the pair in the order of smallest v1[i].first as first element therefore v1[0].second can be larger than smallest element of v1[i].second.


This is the sample case of such situation;

shehddhks   2년 전

NO this is not the reason
my code's ouput is 2

readiz   2년 전

If you don't run your code, why are you asking?

Based on your code, its output is 3.

conu   2년 전

질문한 분이 잘했다는 건 아닌데, 두 성적 순위는 모두 1위부터 N위까지 동석차 없이 결정된다고 가정한다. 라는 조건이 있어서 위 반례는 문제 조건을 만족시키지 않습니다. 나중에 이 글에 들어오실 분을 위해 댓글 남깁니다..

댓글을 작성하려면 로그인해야 합니다.