結果

問題 No.241 出席番号(1)
ユーザー burita083burita083
提出日時 2021-06-17 02:01:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 128,668 KB
最終ジャッジ日時 2023-08-30 08:25:57
合計ジャッジ時間 16,599 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 163 ms
80,188 KB
testcase_01 AC 162 ms
79,976 KB
testcase_02 AC 162 ms
80,156 KB
testcase_03 AC 160 ms
79,988 KB
testcase_04 AC 158 ms
80,088 KB
testcase_05 AC 159 ms
79,948 KB
testcase_06 AC 161 ms
80,208 KB
testcase_07 AC 160 ms
80,140 KB
testcase_08 AC 157 ms
80,116 KB
testcase_09 AC 157 ms
80,008 KB
testcase_10 AC 159 ms
80,156 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 160 ms
79,976 KB
testcase_14 AC 169 ms
82,532 KB
testcase_15 AC 162 ms
81,376 KB
testcase_16 AC 92 ms
77,652 KB
testcase_17 AC 159 ms
79,956 KB
testcase_18 AC 159 ms
79,772 KB
testcase_19 AC 160 ms
80,016 KB
testcase_20 AC 160 ms
80,176 KB
testcase_21 AC 176 ms
79,980 KB
testcase_22 WA -
testcase_23 AC 167 ms
81,800 KB
testcase_24 AC 191 ms
82,816 KB
testcase_25 WA -
testcase_26 AC 170 ms
82,468 KB
testcase_27 WA -
testcase_28 AC 190 ms
82,704 KB
testcase_29 AC 167 ms
81,124 KB
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = []
for i in range(N):
  A.append(int(input()))
dp = [set() for i in range(N)]
for i, x in enumerate(A):
  for j in range(N):
    if j != x:
      dp[i].add(j)

ans = -float('inf')
import random
l = []
for i in range(300000):
  st = set()
  temp = 0
  for d in dp:
    d -= st
    while True:
      if len(d) == 0:
        break
      item = random.sample(d, 1)
      if not item[0] in st:
        st.add(item[0])
        l.append(item[0])
        temp += 1
        break
  if temp == N:
    break
if len(l) < N:
  print(-1)
  exit()
for d in l:
  print(d)
0