結果
問題 |
No.241 出席番号(1)
|
ユーザー |
|
提出日時 | 2015-07-11 00:39:03 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 505 bytes |
コンパイル時間 | 59 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2024-11-30 21:28:55 |
合計ジャッジ時間 | 1,628 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
N = int(raw_input()) A = [int(raw_input()) for i in xrange(N)] hist = [0] * 50 for a in A: hist[a] += 1 if N in hist[:N]: print -1 exit() priority = sorted([[h, i] for i, h in enumerate(hist[:N])], 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 for a in ans: print a