RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00253

Orehnjaca

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(4^{th}\) round, January \(19^{th}\), 2013

These days, the TV studio has started shooting another new season of Jamie Oliver's cooking show.
This season, Jamie plans to introduce the delights of Croatian cuisine to the world. In the first episode,
the master chef has baked a walnut roll L meters long, the longest ever baked in this part of the world.
After hours of sweating and toiling in the kitchen, he has decided to reward each one of his N faithful
spectators in the studio.
He has chopped the walnut roll into one meter long chops and marked them with numbers from 1 do
L, from left to right. Each spectator has received a unique number ID (a positive integer from 1 to N),
as well as a paper with two integers, P and K. Each spectator was then allowed to take all chops from
the \(P-th\) to the \(K-th\), inclusive. Spectators were allowed to take their share in order of their ID numbers
(spectator 1 first, followed by spectator 2, etc.). This order resulted in some spectators receiving fewer
chops than they initially thought they would get. The following image corresponds to the first example
test case:

Write a program to determine which spectator expected to get the most walnut roll chops, and which
spectator actually got the most.

제약

If the first number is correct, the solution is awarded 60% of points for that test case, and if the second
number is correct, the solution is awarded 40% of points for that test case.
\(4^{th}\) round, January \(19^{th}\), 2013

입력 형식

The first line of input contains the positive integer L (\(1 \le L \le 1000\)), the length of the walnut roll.
The second line of input contains the positive integer N (\(1 \le N \le 1000\)), the number of spectators.
Each of the following N lines contains two positive integers P_{i} and K_{i} (\(1 \le P_{i} \le K_{i} \le L\), \(i = 1\)..N), the
values P and K as described in the problem statement for spectator number i.

출력 형식

The first line of output must contain the ID number of the spectator who was expecting to receive the
most walnut roll chops.
The second line of output must contain the ID number of the spectator who actually received the most
walnut roll chops in the end.
In both cases, if there is more than one spectator satisfying the condition, output the one with the
smallest ID.

예제 1
입력
10
3
2 4
7 8
6 9
출력
3
1
예제 2
입력
10
3
1 3
5 7
8 9
출력
1
1
예제 3
입력
10
5
1 1
1 2
1 3
1 4
7 8
출력
4
5
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2012/2013 Contest 4

평가 및 의견

Orehnjaca

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Orehnjaca

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8