結果

問題 No.3219 Ruler to Maximize
ユーザー flippergo
提出日時 2025-08-03 13:19:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 463 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 82,032 KB
実行使用メモリ 76,596 KB
最終ジャッジ日時 2025-08-03 13:19:32
合計ジャッジ時間 8,418 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
ans = "B"*N
m = 0
for n in range(1<<13):
    W = 0
    B = 0
    row = ""
    for a in A:
        flag = True
        for k in range(14):
            if ((n>>k)&1)<((a>>k)&1):
                flag = False
                break
        if flag:
            W = W|a
            row += "W"
        else:
            B = B|a
            row += "B"
    if m<W*B:
        m = W*B
        ans = row
print(m)
print(ans)
0