Logo
(追記) (追記ここまで)

14977번 - Amusement Anticipation 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB2121099757.059%

문제

It is was late Saturday morning at the end of October. The amusement park was going to be open that afternoon for the first time after months of prolonged reconstruction.

Josse and Murry were sitting in the basement of the office building at the park gate. They have just finished debugging their advanced AI system management of all fantastic attractions in the park. “Work is done,” said Josse. “Now for some amusement. Can you think of any algorithmic problem?”

“Yes, of course,” replied Murry and grinned at his friend from his heavily cluttered desk. “Consider, for example, finite sequences of numbers. For me, the most interesting sequences are those that end with a long arithmetic sequence. In other words, I like arithmetic sequences that span from some index to the very last member. As there may be many such subsequences, in order to truly appreciate how interesting some sequence is, it is necessary to determine which one is the longest. Here is your initial sequence. You have to find the start of the longest continuous arithmetic subsequence spanning to its end.”

“OK,” said Josse when he marked the correct place in the sequence. “That was easy. What next?” “What next?” Repeated Murry and hesitated for a moment. Then he raised himself determinedly from the chair. “Let’s go out to the park and find some tougher problems there!”

입력

There are more test cases. Each case consists of two lines. The first line contains one integer N (1 ≤ N ≤ 1 000) specifying the length of the sequence. The second line contains a sequence of N integers Xi (0 ≤ Xi ≤ 109), separated by spaces.

출력

For each test case, print a single line with the index of the first member of the longest continuous arithmetic subsequence that spans to the end of the given sequence. The index of the first element in the sequence is always 1.

제한

예제 입력 1

5
1 2 3 4 5
7
1 2 3 4 5 8 8
3
7 5 2

예제 출력 1

1
6
2

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > CTU Open Contest > CTU Open Contest 2017 A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /