結果
問題 | No.800 四平方定理 |
ユーザー | 👑 horiesiniti |
提出日時 | 2023-02-04 19:46:56 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 386 bytes |
コンパイル時間 | 384 ms |
コンパイル使用メモリ | 11,496 KB |
実行使用メモリ | 111,664 KB |
最終ジャッジ日時 | 2023-09-16 16:18:37 |
合計ジャッジ時間 | 29,271 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 103 ms
16,652 KB |
testcase_01 | AC | 126 ms
17,952 KB |
testcase_02 | AC | 111 ms
17,112 KB |
testcase_03 | AC | 116 ms
17,968 KB |
testcase_04 | AC | 110 ms
17,160 KB |
testcase_05 | AC | 113 ms
16,968 KB |
testcase_06 | AC | 134 ms
17,724 KB |
testcase_07 | AC | 122 ms
17,960 KB |
testcase_08 | AC | 135 ms
18,008 KB |
testcase_09 | AC | 128 ms
17,904 KB |
testcase_10 | AC | 1,812 ms
86,632 KB |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | AC | 1,907 ms
88,196 KB |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | AC | 79 ms
15,132 KB |
testcase_21 | AC | 80 ms
15,036 KB |
testcase_22 | TLE | - |
testcase_23 | TLE | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
n,d=gets.split(" ").map{|e| e.to_i} hs={} hs2={} 1.upto(n){|x| x.upto(n){|y| t=x**2+y**2 hs[t]=0 if hs.member?(t)==false hs[t]+=(x==y)?(1):(2) t2=d+(x+y)*(x-y) hs2[t2]=0 if hs2.member?(t2)==false hs2[t2]+=1 next if x==y t2=d+(y-x)*(x+y) hs2[t2]=0 if hs2.member?(t2)==false hs2[t2]+=1 } } ans=0 hs.each{|k,v| next if hs2.member?(k)==false ans+=v*hs2[k] } puts ans