Nộp bài | Các bài nộp | Làm tốt nhất | Về danh sách bài |
NKTEAM - Team Selection |
English | Vietnamese |
The Interpeninsular Olympiad in Informatics is coming and the leaders of the Balkan Peninsula Team have to choose the best contestants on the Balkans. Fortunately, the leaders could choose the members of the team among N very good contestants, numbered from 1 to N (3 ≤ N ≤ 500000). In order to select the best contestants the leaders organized three competitions. Each of the N contestants took part in all three competitions and there were no two contestants with equal results on any of the competitions. We say that contestant А is better than another contestant В when А is ranked before В in all of the competitions. A contestant A is said to be excellent if no other contestant is better than A. The leaders of the Balkan Peninsula Team would like to know the number of excellent contestants.
Write a program, which for given N and the three competitions results, computes the number of excellent contestants.
Input
The input data are given as four lines. The first line contains the number N. The next three lines show the rankings for the three competitions. Each of these lines contains the identification numbers of the contestants, separated by single spaces, in the order of their ranking from first to last place.
Output
The output should contain one line with a single number written on it: the number of the excellent.
Example
Input 3 2 3 1 3 1 2 1 2 3 Output 3
Note: No contestant is better than any other contestant, hence all three are excellent.
Input 10 2 5 3 8 10 7 1 6 9 4 1 2 3 4 5 6 7 8 9 10 3 8 7 10 5 4 1 2 6 9 Output 4
Note: The excellent contestants are those numbered with 1, 2, 3 and 5.
Được gửi lên bởi: | Jimmy |
Ngày: | 2007-12-16 |
Thời gian chạy: | 1s |
Giới hạn mã nguồn: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Ngôn ngữ cho phép: | Tất cả ngoại trừ: ERL GOSU JS-RHINO NODEJS PERL6 PYPY RUST SED VB.NET |
Nguồn bài: | Balkan OI 2004 |
hide comments
|
|||||||
2021-05-27 18:03:08
Tham khảo: https://vnspoj.github.io/problems/NKTEAM |
|||||||
2020-03-27 19:25:40
bài hay |
|||||||
2020-03-27 11:57:02
đề tiếng anh bảo giới hạn 500000 mà sang vietnam thì chuyển thành 100000 :v |
|||||||
2018-06-28 16:09:12
đề troll vãi, không có thí sinh nào giỏi hơn A không đồng nghĩa A là 1 trong số những thí sinh giỏi nhất, ở ví dụ 2 5 có lớn hơn 4 đâu :))) |
|||||||
2018-01-03 10:57:48
giải thích đề hộ. không hiểu |
|||||||
2017-08-22 20:10:57 Ðặng Minh Tiến
https://kienthuc24h.com/nkteam-spoj-team-selection/ |
|||||||
2016-12-06 02:23:35
đã dùng IT nlogn k hiểu sao vẫn cứ 54.55 |
|||||||
2016-07-14 09:01:44
Yeah! Phấn khích vlù |
|||||||
2016-07-11 16:49:00 noname00.pas
Oạch, "là chỉ số của các thí sinh ...", cứ tưởng điểm :D Last edit: 2016-07-11 17:11:42 |
|||||||
2016-05-29 17:02:30
Trâu 90.91 =)) Last edit: 2016-07-13 11:52:17 |