시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 24 13 12 54.545%

문제

창영이의 수학 공책에는 길이가 N이고 정수로 이루어진 수열 두 개가 적혀져 있다. 두 수열의 흐릿함을 계산하려면, 두 번째 수열을 뒤집은 다음, 같은 위치에 있는 두 수의 곱을 더해야 한다.

예를 들어, 위의 두 수열의 흐릿함은 3×2 + (-4)×3 + (-3)×(-1) + (-2)×5 + 2×0 + 0×(-3) = -13 이다.

창영이는 앞에서부터 B개, 뒤에서부터 E개를 지워서 두 수열의 흐릿함을 되도록 크게 만드려고 한다. B와 E는 0일 수도 있으며, 수를 지울 때는 두 수열에서 동시에 지워야 한다.

흐릿함을 가장 크게 만드려면, B와 E가 몇이 되어야 하는지 구하는 프로그램을 작성하시오.

입력

첫째 줄에 수열의 길이 N (1 ≤ N ≤ 2000)이 주어진다.

다음 두 줄에 걸쳐서 두 수열이 주어진다. 모든 숫자는 -1000보다 크거나 같고, 1000보다 작거나 같다.

출력

첫째 줄에 B와 E를 출력한다. (0 ≤ B, E < N, B+E < N)

둘째 줄에는 흐릿함의 최대값을 출력한다.

흐릿함을 최대로 만드는 B와 E가 여러가지인 경우에는 아무거나 출력한다.

예제 입력 1

6
3 -4 -3 -2 2 0
-3 0 5 -1 3 2

예제 출력 1

0 3
24
W3sicHJvYmxlbV9pZCI6Ijg5NzMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMyMThcdWQ1NTkgXHVhY2Y1XHVjYzQ1IiwiZGVzY3JpcHRpb24iOiI8cD5cdWNjM2RcdWM2MDFcdWM3NzRcdWM3NTggXHVjMjE4XHVkNTU5IFx1YWNmNVx1Y2M0NVx1YzVkMFx1YjI5NCBcdWFlMzhcdWM3NzRcdWFjMDAgTlx1Yzc3NFx1YWNlMCBcdWM4MTVcdWMyMThcdWI4NWMgXHVjNzc0XHViOGU4XHVjNWI0XHVjOWM0IFx1YzIxOFx1YzVmNCBcdWI0NTAgXHVhYzFjXHVhYz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