Submission #1071238
Source Code Expand
if !ENV['RUBY_THREAD_VM_STACK_SIZE'] exec({'RUBY_THREAD_VM_STACK_SIZE'=>'1000000000'}, '/usr/bin/ruby', $0) end GC.disable H, W = gets.split.map(&:to_i) As = [[0] * (W + 2)] + readlines.map{|l| [0] + l.split.map(&:to_i) + [0]} + [[0] * (W + 2)] MOD = 1_000_000_007 def dp(i, j) @dp[i][j] ||= [[i + 1, j], [i - 1, j], [i, j + 1], [i, j - 1]].inject(0) do |s, (h, w)| s + (As[h][w] > As[i][j] ? dp(h, w) : 0) end + 1 end @dp = Array.new(H + 2){Array.new(W + 2, nil)} puts [*1 .. H].product([*1 .. W]).inject(0){|s, (i, j)| (s + dp(i, j)) % MOD}
Submission Info
Submission Time | |
---|---|
Task | D - 経路 |
User | noriakiokubo |
Language | Ruby (2.3.3) |
Score | 0 |
Code Size | 556 Byte |
Status | TLE |
Exec Time | 2151 ms |
Memory | 706760 KB |
Judge Result
Set Name | sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample01.txt, sample02.txt |
All | 00.txt, 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, sample01.txt, sample02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00.txt | TLE | 2140 ms | 556364 KB |
01.txt | TLE | 2151 ms | 706760 KB |
02.txt | TLE | 2135 ms | 426180 KB |
03.txt | AC | 51 ms | 4176 KB |
04.txt | AC | 52 ms | 4168 KB |
05.txt | AC | 52 ms | 4164 KB |
06.txt | AC | 54 ms | 4296 KB |
07.txt | AC | 56 ms | 4676 KB |
08.txt | AC | 52 ms | 4300 KB |
09.txt | AC | 51 ms | 4172 KB |
10.txt | AC | 57 ms | 5324 KB |
11.txt | TLE | 2135 ms | 417864 KB |
12.txt | TLE | 2134 ms | 424136 KB |
13.txt | TLE | 2134 ms | 417996 KB |
14.txt | TLE | 2134 ms | 422856 KB |
15.txt | TLE | 2141 ms | 527432 KB |
16.txt | TLE | 2134 ms | 420296 KB |
17.txt | TLE | 2134 ms | 419908 KB |
18.txt | TLE | 2136 ms | 437572 KB |
19.txt | TLE | 2137 ms | 456140 KB |
sample01.txt | AC | 54 ms | 4168 KB |
sample02.txt | AC | 54 ms | 4164 KB |