結果
問題 | No.1136 Four Points Tour |
ユーザー | yuruhiya |
提出日時 | 2020-07-27 17:27:20 |
言語 | Crystal (1.11.2) |
結果 |
AC
|
実行時間 | 583 ms / 2,000 ms |
コード長 | 1,260 bytes |
コンパイル時間 | 10,681 ms |
コンパイル使用メモリ | 297,196 KB |
実行使用メモリ | 13,888 KB |
最終ジャッジ日時 | 2024-06-30 20:52:03 |
合計ジャッジ時間 | 71,130 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
13,752 KB |
testcase_01 | AC | 2 ms
9,756 KB |
testcase_02 | AC | 2 ms
13,884 KB |
testcase_03 | AC | 2 ms
9,760 KB |
testcase_04 | AC | 2 ms
13,888 KB |
testcase_05 | AC | 2 ms
9,888 KB |
testcase_06 | AC | 1 ms
13,884 KB |
testcase_07 | AC | 158 ms
9,884 KB |
testcase_08 | AC | 2 ms
13,884 KB |
testcase_09 | AC | 2 ms
9,760 KB |
testcase_10 | AC | 321 ms
13,884 KB |
testcase_11 | AC | 6 ms
9,756 KB |
testcase_12 | AC | 42 ms
9,628 KB |
testcase_13 | AC | 2 ms
9,888 KB |
testcase_14 | AC | 44 ms
13,884 KB |
testcase_15 | AC | 6 ms
9,756 KB |
testcase_16 | AC | 50 ms
13,884 KB |
testcase_17 | AC | 50 ms
9,888 KB |
testcase_18 | AC | 239 ms
13,888 KB |
testcase_19 | AC | 583 ms
9,760 KB |
testcase_20 | AC | 19 ms
13,884 KB |
testcase_21 | AC | 251 ms
9,760 KB |
01_Sample03_evil.txt | TLE | - |
04_Rnd_large_evil1.txt | TLE | - |
04_Rnd_large_evil2.txt | TLE | - |
04_Rnd_large_evil3.txt | TLE | - |
04_Rnd_large_evil4.txt | TLE | - |
04_Rnd_large_evil5.txt | TLE | - |
04_Rnd_large_evil6.txt | TLE | - |
04_Rnd_large_evil7.txt | TLE | - |
04_Rnd_large_evil8.txt | TLE | - |
04_Rnd_large_evil9.txt | TLE | - |
04_Rnd_large_evil10.txt | TLE | - |
05_Rnd_huge_evil1.txt | TLE | - |
05_Rnd_huge_evil2.txt | TLE | - |
05_Rnd_huge_evil3.txt | TLE | - |
05_Rnd_huge_evil4.txt | TLE | - |
05_Rnd_huge_evil5.txt | TLE | - |
05_Rnd_huge_evil6.txt | TLE | - |
05_Rnd_huge_evil7.txt | TLE | - |
99_evil_01.txt | TLE | - |
ソースコード
struct ModInt @@MOD = 1_000_000_007i64 def self.mod @@MOD end def self.zero ModInt.new(0) end def initialize(n) @n = n.to_i64 % @@MOD end getter n : Int64 def + : self self end def - : self ModInt.new(n != 0 ? @@MOD - @n : 0) end def +(m) ModInt.new(@n + m.to_i64 % @@MOD) end def -(m) ModInt.new(@n - m.to_i64 % @@MOD) end def *(m) ModInt.new(@n * m.to_i64 % @@MOD) end def /(m) raise DivisionByZeroError.new if m == 0 a, b, u, v = m.to_i64, @@MOD, 1i64, 0i64 while b != 0 t = a // b a -= t * b a, b = b, a u -= t * v u, v = v, u end ModInt.new(@n * u) end def //(m) self / m end def **(m) t, res = self, ModInt.new(1) while m > 0 res *= t if m.odd? t *= t m >>= 1 end res end def ==(m) @n == m.to_i64 end def !=(m) @n != m.to_i64 end def succ self + 1 end def pred self - 1 end def to_i64 : Int64 @n end delegate to_s, to: @n delegate inspect, to: @n end n = read_line.to_i64 dp = [1, 0, 0, 0].map { |i| ModInt.new(i) } n.times do dp = (0...4).map { |i| (0...4).select { |j| i != j }.sum { |j| dp[j] } } end puts dp[0]