結果
| 問題 | 
                            No.829 成長関数インフレ中
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-05-11 16:38:30 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                MLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 600 bytes | 
| コンパイル時間 | 228 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 817,564 KB | 
| 最終ジャッジ日時 | 2024-07-02 01:15:05 | 
| 合計ジャッジ時間 | 3,550 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 12 MLE * 1 -- * 9 | 
ソースコード
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import itertools
import sys
def main():
    n, b = map(int, input().split(' '))
    input_list = list(map(int, sys.stdin.readline().strip().split(' ')))
    result = 0
    pattern_list = list(itertools.permutations(input_list, n))
    for a_list in pattern_list:
        max_score = -1
        count = 0
        for each in a_list:
            if max_score < each:
                max_score = each
                count += 1
        result += (count * (b ** count))
    print(result % (10 ** 9 + 7))
if __name__ == '__main__':
    sys.exit(main())