시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 4333 1192 890 30.459%

문제

10,000 이하의 자연수로 이루어진 길이 N짜리 수열이 주어진다. 이 수열에서 연속된 수들의 부분합 중에 그 합이 S 이상이 되는 것 중, 가장 짧은 것의 길이를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 N (10 ≤ N < 100,000)과 S (0 < S ≤ 100,000,000)가 주어진다. 둘째 줄에는 수열이 주어진다. 수열의 각 원소는 공백으로 구분되어져 있으며, 10,000이하의 자연수이다.

출력

첫째 줄에 구하고자 하는 최소의 길이를 출력한다. 만일 그러한 합을 만드는 것이 불가능하다면 0을 출력하면 된다.

예제 입력 1

10 15
5 1 3 5 10 7 4 9 2 8

예제 출력 1

2

힌트

W3sicHJvYmxlbV9pZCI6IjE4MDYiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWJkODBcdWJkODRcdWQ1NjkiLCJkZXNjcmlwdGlvbiI6IjxwPjEwLDAwMCBcdWM3NzRcdWQ1NThcdWM3NTggXHVjNzkwXHVjNWYwXHVjMjE4XHViODVjIFx1Yzc3NFx1YjhlOFx1YzViNFx1YzljNCBcdWFlMzhcdWM3NzQgTlx1YzlkY1x1YjlhYyBcdWMyMThcdWM1ZjRcdWM3NzQgXHVjOGZjXHVjNWI0XHVjOWM0XHViMmU0LiBcdWM3NzQgXHVjMjE4XHVjNWY0XHVjNWQwXHVjMTFjIFx1YzVmMFx1YzE4ZFx1YjQxYyBcdWMyMThcdWI0ZTRcdWM3NTggXHViZDgwXHViZDg0XHVkNTY5IFx1YzkxMVx1YzVkMCBcdWFkZjggXHVkNTY5XHVjNzc0IFMgXHVjNzc0XHVjMGMxXHVjNzc0IFx1YjQxOFx1YjI5NCBcdWFjODMgXHVjOTExLCBcdWFjMDBcdWM3YTUgXHVjOWU3XHVjNzQwIFx1YWM4M1x1Yzc1OCBcdWFlMzhcdWM3NzRcdWI5N2MgXHVhZDZjXHVkNTU4XHViMjk0IF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jxcL3A+XHJcbiIsIm91dHB1dCI6IjxwPkZvciBlYWNoIHRoZSBjYXNlIHRoZSBwcm9ncmFtIGhhcyB0byBwcmludCB0aGUgcmVzdWx0IG9uIHNlcGFyYXRlIGxpbmUgb2YgdGhlIG91dHB1dCBmaWxlLjxcL3A+XHJcbiIsImhpbnQiOiIiLCJvcmlnaW5hbCI6IjEiLCJwcm9ibGVtX2xhbmdfY29kZSI6Ilx1YzYwMVx1YzViNCJ9XQ==

출처

ACM-ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2006 B번

  • 문제를 번역한 사람: author5
  • 시간 제한을 수정한 사람: cheetose
  • 잘못된 조건을 찾은 사람: isku
  • 데이터를 추가한 사람: wookje
  • 문제의 오타를 찾은 사람: ZZangZZang