Submission #19993857


Source Code Expand

Copy
x,y,r = gets.split.map &:to_r
x = (x*10000).to_i
y = (y*10000).to_i
r = (r*10000).to_i
s = 0
((y-r+10000-1)/10000 .. (y+r)/10000).each{|b|
b *= 10000
a0 = ((x-r-10000) .. x).bsearch{|a| (a-x)**2 + (b-y)**2 <= r**2 }
# a1 = (x .. (x+r+10000)).bsearch{|a| (a-x)**2 + (b-y)**2 > r**2 }
a1 = x*2 - a0
s += a1/10000 - (a0+10000-1)/10000 + 1
}
p s
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
x,y,r = gets.split.map &:to_r
x = (x*10000).to_i
y = (y*10000).to_i
r = (r*10000).to_i
s = 0
((y-r+10000-1)/10000 .. (y+r)/10000).each{|b|
  b *= 10000
  a0 = ((x-r-10000) .. x).bsearch{|a| (a-x)**2 + (b-y)**2 <= r**2 }
  # a1 = (x .. (x+r+10000)).bsearch{|a| (a-x)**2 + (b-y)**2 > r**2 }
  a1 = x*2 - a0
  s += a1/10000 - (a0+10000-1)/10000 + 1
}
p s

Submission Info

Submission Time
Task D - Circle Lattice Points
User n4o847
Language Ruby (2.7.1)
Score 400
Code Size 351 Byte
Status AC
Exec Time 971 ms
Memory 14388 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 46
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All extreme_00.txt, extreme_01.txt, extreme_02.txt, extreme_03.txt, handmade_00.txt, handmade_01.txt, handmade_02.txt, handmade_marginal_00.txt, handmade_marginal_01.txt, handmade_marginal_02.txt, handmade_marginal_03.txt, handmade_marginal_04.txt, handmade_marginal_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_integer_00.txt, random_integer_01.txt, random_integer_02.txt, random_integer_03.txt, random_integer_04.txt, random_integer_05.txt, random_integer_06.txt, random_integer_07.txt, random_integer_08.txt, random_integer_09.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
extreme_00.txt AC 749 ms 14044 KB
extreme_01.txt AC 744 ms 14144 KB
extreme_02.txt AC 744 ms 14164 KB
extreme_03.txt AC 751 ms 14284 KB
handmade_00.txt AC 58 ms 14060 KB
handmade_01.txt AC 62 ms 14132 KB
handmade_02.txt AC 62 ms 14036 KB
handmade_marginal_00.txt AC 971 ms 14244 KB
handmade_marginal_01.txt AC 750 ms 14184 KB
handmade_marginal_02.txt AC 750 ms 14164 KB
handmade_marginal_03.txt AC 744 ms 14316 KB
handmade_marginal_04.txt AC 698 ms 14224 KB
handmade_marginal_05.txt AC 711 ms 14240 KB
random_00.txt AC 537 ms 14140 KB
random_01.txt AC 171 ms 14312 KB
random_02.txt AC 696 ms 14204 KB
random_03.txt AC 326 ms 14180 KB
random_04.txt AC 468 ms 14164 KB
random_05.txt AC 102 ms 14224 KB
random_06.txt AC 707 ms 13972 KB
random_07.txt AC 257 ms 14132 KB
random_08.txt AC 390 ms 14108 KB
random_09.txt AC 727 ms 14200 KB
random_10.txt AC 701 ms 14328 KB
random_11.txt AC 322 ms 14248 KB
random_12.txt AC 360 ms 14244 KB
random_13.txt AC 694 ms 14224 KB
random_14.txt AC 527 ms 14260 KB
random_15.txt AC 265 ms 14100 KB
random_16.txt AC 298 ms 14072 KB
random_17.txt AC 624 ms 14256 KB
random_18.txt AC 451 ms 14088 KB
random_19.txt AC 99 ms 14168 KB
random_integer_00.txt AC 339 ms 14180 KB
random_integer_01.txt AC 180 ms 14164 KB
random_integer_02.txt AC 602 ms 14080 KB
random_integer_03.txt AC 444 ms 14296 KB
random_integer_04.txt AC 273 ms 14216 KB
random_integer_05.txt AC 112 ms 14316 KB
random_integer_06.txt AC 432 ms 14176 KB
random_integer_07.txt AC 370 ms 14232 KB
random_integer_08.txt AC 204 ms 14192 KB
random_integer_09.txt AC 737 ms 14176 KB
sample_01.txt AC 64 ms 14164 KB
sample_02.txt AC 59 ms 14276 KB
sample_03.txt AC 744 ms 14388 KB


2025-04-05 (Sat)
02:34:13 +00:00