結果

問題 No.1241 Eternal Tours
ユーザー 👑 hos.lyrichos.lyric
提出日時 2020-09-06 00:41:22
言語 Ruby
(3.2.2)
結果
AC  
実行時間 5,559 ms / 6,000 ms
コード長 664 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 11,480 KB
実行使用メモリ 422,484 KB
最終ジャッジ日時 2023-08-19 16:57:04
合計ジャッジ時間 102,108 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
15,056 KB
testcase_01 AC 70 ms
15,172 KB
testcase_02 AC 4,344 ms
360,252 KB
testcase_03 AC 78 ms
15,560 KB
testcase_04 AC 71 ms
15,192 KB
testcase_05 AC 72 ms
15,336 KB
testcase_06 AC 70 ms
15,124 KB
testcase_07 AC 70 ms
15,140 KB
testcase_08 AC 76 ms
15,232 KB
testcase_09 AC 72 ms
15,260 KB
testcase_10 AC 72 ms
15,420 KB
testcase_11 AC 74 ms
15,192 KB
testcase_12 AC 71 ms
15,268 KB
testcase_13 AC 72 ms
15,256 KB
testcase_14 AC 2,952 ms
180,296 KB
testcase_15 AC 67 ms
15,296 KB
testcase_16 AC 751 ms
60,188 KB
testcase_17 AC 5,292 ms
422,384 KB
testcase_18 AC 5,537 ms
357,840 KB
testcase_19 AC 5,447 ms
356,272 KB
testcase_20 AC 88 ms
16,044 KB
testcase_21 AC 153 ms
20,952 KB
testcase_22 AC 5,559 ms
356,224 KB
testcase_23 AC 233 ms
26,344 KB
testcase_24 AC 68 ms
15,112 KB
testcase_25 AC 74 ms
15,172 KB
testcase_26 AC 68 ms
15,252 KB
testcase_27 AC 69 ms
15,036 KB
testcase_28 AC 4,544 ms
330,304 KB
testcase_29 AC 4,700 ms
344,072 KB
testcase_30 AC 4,924 ms
360,260 KB
testcase_31 AC 2,777 ms
174,684 KB
testcase_32 AC 5,189 ms
410,932 KB
testcase_33 AC 5,109 ms
323,556 KB
testcase_34 AC 5,471 ms
354,024 KB
testcase_35 AC 5,047 ms
341,236 KB
testcase_36 AC 71 ms
15,184 KB
testcase_37 AC 70 ms
15,232 KB
testcase_38 AC 5,369 ms
313,700 KB
testcase_39 AC 5,400 ms
349,724 KB
testcase_40 AC 5,531 ms
360,420 KB
testcase_41 AC 4,798 ms
422,484 KB
testcase_42 AC 4,785 ms
349,500 KB
testcase_43 AC 5,024 ms
360,192 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