Submission #16883620
Source Code Expand
Copy
N,K = gets.split.map(&:to_i)LR = K.times.map{ gets.split.map(&:to_i) }D = [0]*Nd,D[0],D[1] = 0,1,-1(0..N-1).each{|i|d += D[i]next if d == 0LR.each{|l,r|D[i+l] = (D[i+l] + d) if i+l < ND[i+r+1] = (D[i+r+1] - d) if i+r+1 < N}}p d%998244353
N,K = gets.split.map(&:to_i) LR = K.times.map{ gets.split.map(&:to_i) } D = [0]*N d,D[0],D[1] = 0,1,-1 (0..N-1).each{|i| d += D[i] next if d == 0 LR.each{|l,r| D[i+l] = (D[i+l] + d) if i+l < N D[i+r+1] = (D[i+r+1] - d) if i+r+1 < N } } p d%998244353
Submission Info
Submission Time | |
---|---|
Task | D - Leaping Tak |
User | ds14050 |
Language | Ruby (2.7.1) |
Score | 0 |
Code Size | 273 Byte |
Status | TLE |
Exec Time | 2294 ms |
Memory | 2840356 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt, s4.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, s1.txt, s2.txt, s3.txt, s4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 64 ms | 14184 KB |
02.txt | AC | 69 ms | 14044 KB |
03.txt | AC | 60 ms | 14120 KB |
04.txt | AC | 65 ms | 14176 KB |
05.txt | AC | 68 ms | 14176 KB |
06.txt | AC | 65 ms | 14228 KB |
07.txt | AC | 70 ms | 14240 KB |
08.txt | AC | 60 ms | 14116 KB |
09.txt | AC | 64 ms | 14044 KB |
10.txt | AC | 66 ms | 14068 KB |
11.txt | AC | 74 ms | 14172 KB |
12.txt | TLE | 2294 ms | 2840356 KB |
13.txt | AC | 80 ms | 15784 KB |
14.txt | AC | 93 ms | 15664 KB |
15.txt | AC | 78 ms | 15576 KB |
16.txt | TLE | 2263 ms | 1673284 KB |
17.txt | TLE | 2254 ms | 1370248 KB |
18.txt | TLE | 2244 ms | 1079140 KB |
19.txt | TLE | 2246 ms | 1140528 KB |
20.txt | TLE | 2261 ms | 1559304 KB |
21.txt | AC | 73 ms | 15592 KB |
22.txt | AC | 81 ms | 15752 KB |
23.txt | AC | 80 ms | 15672 KB |
24.txt | AC | 75 ms | 15688 KB |
s1.txt | AC | 64 ms | 14200 KB |
s2.txt | AC | 70 ms | 14060 KB |
s3.txt | AC | 68 ms | 14036 KB |
s4.txt | AC | 67 ms | 14088 KB |