結果

問題 No.1241 Eternal Tours
ユーザー 👑 hos.lyrichos.lyric
提出日時 2020-09-06 00:41:22
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 664 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 415,136 KB
最終ジャッジ日時 2024-05-06 23:55:36
合計ジャッジ時間 20,813 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
12,032 KB
testcase_01 AC 74 ms
12,032 KB
testcase_02 AC 5,163 ms
359,552 KB
testcase_03 AC 91 ms
12,800 KB
testcase_04 AC 80 ms
12,032 KB
testcase_05 AC 75 ms
12,160 KB
testcase_06 AC 75 ms
12,032 KB
testcase_07 AC 82 ms
12,288 KB
testcase_08 AC 82 ms
12,160 KB
testcase_09 AC 79 ms
12,160 KB
testcase_10 AC 80 ms
12,160 KB
testcase_11 AC 79 ms
12,416 KB
testcase_12 AC 75 ms
12,160 KB
testcase_13 AC 83 ms
12,160 KB
testcase_14 AC 3,057 ms
186,496 KB
testcase_15 AC 80 ms
12,160 KB
testcase_16 AC 822 ms
58,496 KB
testcase_17 AC 5,937 ms
414,972 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 105 ms
13,440 KB
testcase_21 AC 162 ms
17,920 KB
testcase_22 AC 5,878 ms
383,488 KB
testcase_23 AC 252 ms
23,424 KB
testcase_24 AC 77 ms
12,160 KB
testcase_25 AC 80 ms
12,544 KB
testcase_26 AC 73 ms
12,032 KB
testcase_27 AC 73 ms
12,288 KB
testcase_28 AC 4,925 ms
332,672 KB
testcase_29 AC 5,127 ms
350,336 KB
testcase_30 AC 5,710 ms
360,832 KB
testcase_31 AC 2,967 ms
179,712 KB
testcase_32 TLE -
testcase_33 AC 5,493 ms
321,280 KB
testcase_34 TLE -
testcase_35 AC 5,553 ms
341,760 KB
testcase_36 AC 78 ms
12,032 KB
testcase_37 AC 80 ms
12,288 KB
testcase_38 AC 5,760 ms
310,400 KB
testcase_39 TLE -
testcase_40 TLE -
testcase_41 AC 5,437 ms
415,136 KB
testcase_42 AC 5,551 ms
344,960 KB
testcase_43 AC 5,746 ms
360,448 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:21: warning: `+' after local variable or literal is interpreted as binary operator
Main.rb:21: warning: even though it seems like unary operator
Main.rb:22: warning: `+' after local variable or literal is interpreted as binary operator
Main.rb:22: warning: even though it seems like unary operator
Main.rb:23: warning: `+' after local variable or literal is interpreted as binary operator
Main.rb:23: warning: even though it seems like unary operator
Main.rb:24: warning: `+' after local variable or literal is interpreted as binary operator
Main.rb:24: warning: even though it seems like unary operator
Main.rb:25: warning: `+' after local variable or literal is interpreted as binary operator
Main.rb:25: warning: even though it seems like unary operator
Syntax OK

ソースコード

diff #

MO=998244353
G=3

$<.map{|line|
  x,y,t,a,b,c,d=line.split.map &:to_i
  
  m=1<<(x+1)
  n=1<<(y+1)
  gm=[0]*m
  gn=[0]*n
  gm[0]=1
  gn[0]=1
  gm[1]=G.pow((MO-1)/m,MO)
  gn[1]=G.pow((MO-1)/n,MO)
  (2...m).map{|i|gm[i]=(gm[i-1]*gm[1])%MO}
  (2...n).map{|j|gn[j]=(gn[j-1]*gn[1])%MO}
  
  z=0
  (0...m).map{|i|(0...n).map{|j|
    f=(0\
      +gm[0]*gn[0]\
      +gm[i]*gn[0]\
      +gm[0]*gn[j]\
      +gm[-i]*gn[0]\
      +gm[0]*gn[-j]\
    ).pow(t,MO)
    (0...2).map{|s|(0...2).map{|t|
      ii=((-1)**s*c-a)&(m-1)
      jj=((-1)**t*d-b)&(n-1)
      z+=(-1)**(s+t)*gm[(-i*ii)&(m-1)]*gn[(-j*jj)&(n-1)]*f
    }}
  }}
  z*=(m*n).pow(MO-2,MO)
  z=(z%MO+MO)%MO
  p z
}
0