結果
問題 |
No.241 出席番号(1)
|
ユーザー |
|
提出日時 | 2015-07-10 22:47:28 |
言語 | Python2 (2.7.18) |
結果 |
RE
|
実行時間 | - |
コード長 | 815 bytes |
コンパイル時間 | 531 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 02:03:36 |
合計ジャッジ時間 | 3,667 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 3 RE * 11 |
ソースコード
N = int(raw_input()) A = [int(raw_input()) for i in xrange(N)] if N == 1: print -1 exit() hist = [0] * N for a in A: hist[a] += 1 if N in hist: print -1 exit() priority = sorted([[h, i] for i, h in enumerate(hist)], reverse = True) used = [False] * N ans = [-1] * N for h, i in priority: for j in xrange(N): if A[j] != i and not used[j]: ans[j] = i used[j] = True break else: for j in xrange(N): if not used[j]: ans[j] = i used[j] = True break if -1 not in ans: for a in ans: print a else: print -1