結果
問題 | No.2037 NAND Pyramid |
ユーザー |
![]() |
提出日時 | 2025-02-11 21:34:35 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 454 bytes |
コンパイル時間 | 282 ms |
コンパイル使用メモリ | 82,412 KB |
実行使用メモリ | 130,776 KB |
最終ジャッジ日時 | 2025-02-11 21:34:41 |
合計ジャッジ時間 | 4,912 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 39 |
ソースコード
def nands(c1,c2): if c1=='1' and c2=='1': return '0' return '1' n,k=map(int,input().split()) s=str(input()) k=n-k t1=[] t2=[] for i in range(n-1): t1.append(nands(s[i],s[i+1])) if k==1: print(''.join(t1)) else: for i in range(n-2): t2.append(nands(t1[i],t1[i+1])) if k%2==0: start=k//2-1 print(''.join(t2[start:start+n-k])) else: start=k//2 print(''.join(t1[start:start+n-k]))