結果
| 問題 | 
                            No.489 株に挑戦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tnishinaga
                         | 
                    
| 提出日時 | 2017-02-27 04:27:05 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,004 bytes | 
| コンパイル時間 | 260 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 25,228 KB | 
| 最終ジャッジ日時 | 2024-06-11 17:51:21 | 
| 合計ジャッジ時間 | 14,881 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 31 TLE * 4 | 
ソースコード
import bisect
def problem_input():
    ndk = input().split()
    n = int(ndk[0], 10)
    d = int(ndk[1], 10)
    k = int(ndk[2], 10)
    xlist = [int(input(), 10) for i in range(n)]
    return n, d, k, xlist
def test_input():
    n = 7
    d = 2
    k = 1000
    xlist = [1,3,5,1,4,4,7]
    return n, d, k, xlist
def test_input1():
    n = 5
    d = 4
    k = 100
    xlist = [1,2,1,2,1]
    return n, d, k, xlist
def test_input2():
    n = 5
    d = 1
    k = 100
    xlist = [5,4,3,3,1]
    return n, d, k, xlist
# main
n,d,k,xlist = problem_input()
# n,d,k,xlist = test_input1()
sorted_list = [(xlist[0], 0)]
diff_max = 0
for i in range(1, n):
    while (i - sorted_list[0][1]) > d:
        sorted_list = sorted_list[1:]
    if diff_max < (xlist[i] - sorted_list[0][0]):
        diff_max = xlist[i] - sorted_list[0][0]
        result = (sorted_list[0][1], i)
    bisect.insort(sorted_list, (xlist[i], i))
print(diff_max * k)
if diff_max != 0:
    print("{0} {1}".format(result[0], result[1]))
            
            
            
        
            
tnishinaga