結果
問題 | No.335 門松宝くじ |
ユーザー | HIROPON87069639 |
提出日時 | 2016-02-11 16:28:34 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,279 bytes |
コンパイル時間 | 89 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-09-22 00:40:26 |
合計ジャッジ時間 | 6,443 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 11 ms
13,760 KB |
testcase_01 | AC | 11 ms
6,944 KB |
testcase_02 | AC | 11 ms
6,944 KB |
testcase_03 | AC | 11 ms
6,944 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 1,576 ms
6,944 KB |
testcase_07 | TLE | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
ソースコード
# 2016.2.11 def omikuji(inp): global N total = 0 kuji = map(int, inp.split()) sec1max = kuji[0] sec1min = kuji[0] for i in range(0, N-1): if sec1max < kuji[i-1] and i != 0: sec1max = kuji[i-1] if sec1min > kuji[i-1] and i != 0: sec1min = kuji[i-1] A = kuji[i] sec2max = kuji[i+1] sec2min = kuji[i+1] for j in range(i+1, N): if sec2max < kuji[j-1] and j != i+1: sec2max = kuji[j-1] if sec2min > kuji[j-1] and j != i+1: sec2min = kuji[j-1] B = kuji[j] flag = 0 if A < B: if sec1max > A: flag = 1 if sec2min < A: flag = 1 if max(sec1max, sec2max) > B: flag = 2 if flag == 0 and j != N-1: sec3min = kuji[j+1] for k in range(j+1, N): if sec3min > kuji[k]: sec3min = kuji[k] if sec3min < B: flag = 1 flag2point = max(sec1max, sec2max) elif A > B: if sec1min < A: flag = 1 if sec2min < B: flag = 1 if sec2max > A: flag = 2 sec3max = 0 if j != N-1: sec3max = kuji[j+1] for k in range(j+1, N): if sec3max < kuji[k]: sec3max = kuji[k] if B < sec3max < A and flag != 2: flag = 1 if sec3max > A: flag = 2 flag2point = max(sec2max, sec3max) if flag == 1: total += max(A, B) elif flag == 2: total += flag2point return total NM = map(int, raw_input().split()) N = NM[0] M = NM[1] totalpoint = [0 for no in range(0, M)] for no in range(0, M): totalpoint[no] = omikuji((raw_input())) totalpointmax = 0 ans = 0 for i in range(0, M): if totalpointmax < totalpoint[i]: totalpointmax = totalpoint[i] ans = i print ans