Submission #22278088
Source Code Expand
Copy
import itertoolsN,K = map(int, input().split())LAMP = list(map(int, input().split()))for i in range(K):TABLE = [0]*(N+1)for j in range(N):TABLE[max(0,j-LAMP[j])]+=1TABLE[min(N,j+LAMP[j]+1)]-=1LAMP = list(itertools.accumulate(TABLE))#K回まで全て頼むとTLEすることがあるため、最大の強さになった場合は打ち切るif LAMP[0]==N and LAMP[N-1]==N:breakprint(*LAMP[:N])
import itertools N,K = map(int, input().split()) LAMP = list(map(int, input().split())) for i in range(K): TABLE = [0]*(N+1) for j in range(N): TABLE[max(0,j-LAMP[j])]+=1 TABLE[min(N,j+LAMP[j]+1)]-=1 LAMP = list(itertools.accumulate(TABLE)) #K回まで全て頼むとTLEすることがあるため、最大の強さになった場合は打ち切る if LAMP[0]==N and LAMP[N-1]==N: break print(*LAMP[:N])
Submission Info
Submission Time | |
---|---|
Task | C - Lamps |
User | H20 |
Language | PyPy3 (7.3.0) |
Score | 500 |
Code Size | 462 Byte |
Status | AC |
Exec Time | 371 ms |
Memory | 179980 KB |
Judge Result
Set Name | $Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
$Sample | sample01.txt, sample02.txt |
All | sample01.txt, sample02.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, sample01.txt, sample02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in01.txt | AC | 160 ms | 110532 KB |
in02.txt | AC | 368 ms | 179136 KB |
in03.txt | AC | 371 ms | 178892 KB |
in04.txt | AC | 294 ms | 168276 KB |
in05.txt | AC | 297 ms | 162692 KB |
in06.txt | AC | 295 ms | 166960 KB |
in07.txt | AC | 274 ms | 156540 KB |
in08.txt | AC | 292 ms | 168552 KB |
in09.txt | AC | 149 ms | 107712 KB |
in10.txt | AC | 169 ms | 111100 KB |
in11.txt | AC | 189 ms | 131820 KB |
in12.txt | AC | 242 ms | 152448 KB |
in13.txt | AC | 312 ms | 166964 KB |
in14.txt | AC | 289 ms | 167576 KB |
in15.txt | AC | 137 ms | 106084 KB |
in16.txt | AC | 353 ms | 178396 KB |
in17.txt | AC | 355 ms | 179980 KB |
in18.txt | AC | 203 ms | 146392 KB |
in19.txt | AC | 229 ms | 144912 KB |
sample01.txt | AC | 55 ms | 61468 KB |
sample02.txt | AC | 51 ms | 61332 KB |