結果
問題 | No.335 門松宝くじ |
ユーザー | HIROPON87069639 |
提出日時 | 2016-02-11 16:52:36 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,091 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-09-22 00:43:35 |
合計ジャッジ時間 | 7,784 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 11 ms
12,544 KB |
testcase_01 | AC | 11 ms
6,272 KB |
testcase_02 | AC | 11 ms
6,272 KB |
testcase_03 | AC | 11 ms
6,272 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 869 ms
6,400 KB |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
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: k = j+1 while flag == 0 and k <= N-1: if B > kuji[k]: flag = 1 k += 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 = max(kuji[j+1:N]) 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