結果

問題 No.3021 データベースの練習
ユーザー maimai
提出日時 2018-08-20 20:32:36
言語 Ruby
(3.3.0)
結果
AC  
実行時間 533 ms / 5,000 ms
コード長 495 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 11,280 KB
実行使用メモリ 31,420 KB
平均クエリ数 540.42
最終ジャッジ日時 2023-09-23 16:13:18
合計ジャッジ時間 5,607 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 210 ms
31,172 KB
testcase_01 AC 315 ms
31,420 KB
testcase_02 AC 385 ms
31,112 KB
testcase_03 AC 402 ms
30,980 KB
testcase_04 AC 391 ms
31,220 KB
testcase_05 AC 394 ms
30,860 KB
testcase_06 AC 229 ms
31,420 KB
testcase_07 AC 307 ms
30,748 KB
testcase_08 AC 391 ms
31,224 KB
testcase_09 AC 332 ms
30,676 KB
testcase_10 AC 298 ms
30,900 KB
testcase_11 AC 533 ms
31,300 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

gets.to_i.times do
    x1,x2,y1,y2 = gets.split.map(&:to_i)
    if x1 == x2 && y1 == y2
        puts "SELECT count(*) FROM point WHERE #{x1}=x AND #{y1}=y;"
    elsif x1 == x2
        puts "SELECT count(*) FROM point WHERE #{x1}=x AND #{y1}<=y AND y<=#{y2};"
    elsif y1 == y2
        puts "SELECT count(*) FROM point WHERE #{x1}<=x AND x<=#{x2} AND #{y1}=y;"
    else
        puts "SELECT count(*) FROM point WHERE #{x1}<=x AND x<=#{x2} AND #{y1}<=y AND y<=#{y2};"
    end
    STDOUT.flush
end
0