結果

問題 No.241 出席番号(1)
ユーザー burita083burita083
提出日時 2021-06-17 02:05:32
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 86,800 KB
最終ジャッジ日時 2023-08-30 08:33:07
合計ジャッジ時間 16,055 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 176 ms
80,064 KB
testcase_01 AC 174 ms
80,180 KB
testcase_02 AC 177 ms
80,176 KB
testcase_03 AC 174 ms
79,844 KB
testcase_04 AC 180 ms
80,244 KB
testcase_05 AC 177 ms
80,220 KB
testcase_06 AC 173 ms
80,180 KB
testcase_07 AC 175 ms
80,020 KB
testcase_08 AC 177 ms
80,080 KB
testcase_09 AC 176 ms
80,180 KB
testcase_10 WA -
testcase_11 AC 616 ms
83,072 KB
testcase_12 WA -
testcase_13 AC 173 ms
80,136 KB
testcase_14 AC 186 ms
82,324 KB
testcase_15 AC 174 ms
81,540 KB
testcase_16 AC 103 ms
77,660 KB
testcase_17 AC 174 ms
79,992 KB
testcase_18 AC 170 ms
79,840 KB
testcase_19 AC 177 ms
80,500 KB
testcase_20 AC 174 ms
79,852 KB
testcase_21 AC 178 ms
79,980 KB
testcase_22 AC 175 ms
80,236 KB
testcase_23 AC 178 ms
81,704 KB
testcase_24 AC 184 ms
82,600 KB
testcase_25 AC 181 ms
82,652 KB
testcase_26 AC 183 ms
82,460 KB
testcase_27 AC 1,288 ms
84,992 KB
testcase_28 WA -
testcase_29 AC 182 ms
80,648 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
for i in range(400000):
  st = set()
  temp = 0
  l = []
  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