結果

問題 No.1633 Sorting Integers (Multiple of 2^K)
ユーザー googol_S0googol_S0
提出日時 2021-07-30 21:11:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 1,870 ms
コンパイル使用メモリ 86,376 KB
実行使用メモリ 604,340 KB
最終ジャッジ日時 2023-10-14 02:34:25
合計ジャッジ時間 9,364 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,244 KB
testcase_01 AC 74 ms
71,228 KB
testcase_02 AC 149 ms
78,220 KB
testcase_03 AC 73 ms
71,104 KB
testcase_04 AC 70 ms
71,192 KB
testcase_05 AC 71 ms
71,024 KB
testcase_06 AC 75 ms
71,304 KB
testcase_07 AC 69 ms
71,132 KB
testcase_08 WA -
testcase_09 AC 74 ms
71,180 KB
testcase_10 AC 74 ms
71,220 KB
testcase_11 AC 75 ms
71,020 KB
testcase_12 AC 73 ms
71,248 KB
testcase_13 AC 73 ms
71,468 KB
testcase_14 AC 74 ms
71,232 KB
testcase_15 AC 73 ms
71,228 KB
testcase_16 AC 73 ms
71,384 KB
testcase_17 AC 72 ms
71,180 KB
testcase_18 AC 72 ms
71,124 KB
testcase_19 AC 74 ms
71,236 KB
testcase_20 AC 74 ms
71,176 KB
testcase_21 AC 72 ms
71,020 KB
testcase_22 AC 74 ms
71,240 KB
testcase_23 MLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
C=list(map(int,input().split()))
A=[]
for i in range(9):
  for j in range(C[i]):
    A.append(i+1)
ANS=0
M=(N+1)>>1
L=N>>1
t=0
for u in range(5,-1,-1):
  t+=(1<<u)
  mod=1<<t
  P=[pow(10,i,mod) for i in range(N+1)]
  DP=[set() for i in range(1<<N)]
  DP[0]=set([0])
  for i in range(1<<N):
    c=bin(i).count('1')
    if c>=L:
      x=((1<<N)-1)^i
      for j in DP[i]:
        if (-j*P[N-c])%mod in DP[x]:
          ANS=t
          break
      if ANS==t:
        break
    if c>=M:
      continue
    for j in range(N):
      if (i>>j)&1:
        continue
      for k in DP[i]:
        DP[i|(1<<j)].add((k*10+A[j])%mod)
  if ANS<t:
    t-=(1<<u)
print(ANS)
0