結果
問題 |
No.2593 Reorder and Mod 120
|
ユーザー |
|
提出日時 | 2023-12-30 22:59:39 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,527 bytes |
コンパイル時間 | 141 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-09-27 16:55:30 |
合計ジャッジ時間 | 1,934 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 RE * 21 |
ソースコード
ss = int(input()) a=[i for i in range(120)] n_str=input() n_int=int(n_str) n_str_list=list(n_str) n_int_list=sorted([int(i) for i in n_str_list]) exchange_list_1 = [] exchange_list_10 = [] exchange_list_100 = [] n_div_120 = 0 for i in n_int_list: n_div_120 += i n_div_120 = n_div_120 % 120 three_list = [n_int_list[0], n_int_list[1], n_int_list[2]] for _ in range(3): n_int_list.pop(0) while True: three_int = three_list[0]*100 + three_list[1]*10 + three_list[2] x = (120 + n_div_120 - (three_list[0] + three_list[1] + three_list[2]))%120 y = three_int % 120 z = (40*x + y) % 120 if z in a: a.remove(z) exchange_list_1.append(three_list[2]) for i in range(len(n_str)-3): if n_int_list[i]>=three_list[2]: n_int_list.insert(i, three_list[2]) break else: n_int_list.append(three_list[2]) three_list.pop() for i in n_int_list: if i not in exchange_list_1: three_list.append(i) n_int_list.remove(i) break else: exchange_list_1.clear() exchange_list_10.append(three_list[1]) for i in range(len(n_str)-2): if n_int_list[i]>=three_list[1]: n_int_list.insert(i, three_list[1]) break else: n_int_list.append(three_list[1]) three_list.pop() for i in n_int_list: if i not in exchange_list_10: three_list.append(i) n_int_list.remove(i) three_list.append(n_int_list[0]) n_int_list.pop(0) break else: exchange_list_10.clear() exchange_list_100.append(three_list[0]) for i in range(len(n_str)-1): if n_int_list[i]>=three_list[0]: n_int_list.insert(i, three_list[0]) break else: n_int_list.append(three_list[0]) three_list.pop() for i in n_int_list: if i not in exchange_list_100: three_list.append(i) n_int_list.remove(i) three_list.append(n_int_list[0]) n_int_list.pop(0) three_list.append(n_int_list[0]) n_int_list.pop(0) break else: print(120 - len(a)) break