結果

問題 No.1241 Eternal Tours
ユーザー 👑 hos.lyrichos.lyric
提出日時 2020-09-06 00:41:22
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 664 bytes
コンパイル時間 37 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 415,308 KB
最終ジャッジ日時 2024-11-29 11:02:52
合計ジャッジ時間 115,619 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
12,416 KB
testcase_01 AC 84 ms
12,416 KB
testcase_02 AC 5,307 ms
359,936 KB
testcase_03 AC 92 ms
13,056 KB
testcase_04 AC 84 ms
12,544 KB
testcase_05 AC 80 ms
12,288 KB
testcase_06 AC 80 ms
12,288 KB
testcase_07 AC 80 ms
12,032 KB
testcase_08 AC 85 ms
12,416 KB
testcase_09 AC 83 ms
12,288 KB
testcase_10 AC 86 ms
12,544 KB
testcase_11 AC 85 ms
12,416 KB
testcase_12 AC 79 ms
12,160 KB
testcase_13 AC 83 ms
12,416 KB
testcase_14 AC 3,178 ms
186,624 KB
testcase_15 AC 81 ms
12,160 KB
testcase_16 AC 844 ms
58,624 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 101 ms
13,312 KB
testcase_21 AC 170 ms
17,536 KB
testcase_22 TLE -
testcase_23 AC 269 ms
23,424 KB
testcase_24 AC 78 ms
12,160 KB
testcase_25 AC 85 ms
12,544 KB
testcase_26 AC 77 ms
12,160 KB
testcase_27 AC 75 ms
12,288 KB
testcase_28 AC 5,072 ms
332,928 KB
testcase_29 AC 5,207 ms
350,464 KB
testcase_30 AC 5,820 ms
360,960 KB
testcase_31 AC 3,002 ms
179,584 KB
testcase_32 TLE -
testcase_33 AC 5,411 ms
321,408 KB
testcase_34 TLE -
testcase_35 AC 5,612 ms
341,888 KB
testcase_36 AC 79 ms
12,160 KB
testcase_37 AC 83 ms
12,160 KB
testcase_38 AC 5,787 ms
310,400 KB
testcase_39 TLE -
testcase_40 TLE -
testcase_41 AC 5,571 ms
415,308 KB
testcase_42 AC 5,640 ms
345,216 KB
testcase_43 AC 5,987 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