結果
問題 | No.2247 01 ZigZag |
ユーザー | FromBooska |
提出日時 | 2023-05-01 12:50:46 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,214 bytes |
コンパイル時間 | 331 ms |
コンパイル使用メモリ | 82,272 KB |
実行使用メモリ | 109,804 KB |
最終ジャッジ日時 | 2024-11-20 12:15:03 |
合計ジャッジ時間 | 9,350 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
53,280 KB |
testcase_01 | AC | 39 ms
52,304 KB |
testcase_02 | AC | 38 ms
52,532 KB |
testcase_03 | WA | - |
testcase_04 | AC | 39 ms
51,884 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 39 ms
52,260 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 39 ms
52,892 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 39 ms
53,068 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 39 ms
51,748 KB |
testcase_19 | AC | 39 ms
52,328 KB |
testcase_20 | AC | 38 ms
52,492 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 40 ms
52,564 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 38 ms
52,600 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | AC | 39 ms
53,172 KB |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 40 ms
53,644 KB |
testcase_44 | AC | 39 ms
52,944 KB |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | AC | 40 ms
52,736 KB |
testcase_50 | AC | 39 ms
52,328 KB |
testcase_51 | AC | 40 ms
52,004 KB |
ソースコード
# K=1なら000000111 # K=3なら00000101111 # K=5なら0000010101111 # K=2なら00000111110 # K=4なら000001011110 N, M, K = map(int, input().split()) if N == M: K_max = N*2-1 else: K_max = min(N, M)*2 if K > K_max or K == 0: print(-1) exit() # 後ろから決めていく ans_rev = '' N_remainder = N M_remainder = M K_remainder = K if K_remainder%2 == 1: M_use = M_remainder-(K_remainder-1)//2 ans_rev += '1'*M_use M_remainder -= M_use K_remainder -= 1 elif K_remainder == N*2: M_use = max(0, M_remainder-N) ans_rev += '1'*M_use M_remainder -= M_use K_remainder -= 1 #print(ans_rev, N_remainder, M_remainder, K_remainder) for k in range(K_remainder//2): ans_rev += '0' N_remainder -= 1 M_use = M_remainder-(K_remainder-1)//2 ans_rev += '1'*M_use M_remainder -= M_use K_remainder -= 1 #print(ans_rev, N_remainder, M_remainder, K_remainder) if N_remainder > 0: ans_rev += '0'*N_remainder N_remainder = 0 #print(ans_rev, N_remainder, M_remainder, K_remainder) if M_remainder > 0: ans_rev += '1'*M_remainder M_remainder = 0 #print(ans_rev, N_remainder, M_remainder, K_remainder) print(ans_rev[::-1])