Created
May 7, 2017 23:34
-
-
Save whatalnk/67147ada4be8dc0b55edc2f0590f84aa to your computer and use it in GitHub Desktop.
Codeforces #412 Div2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = gets.chomp.to_i | |
ratings = [] | |
n.times do | |
a, b = gets.chomp.split(" ").map(&:to_i) | |
if a != b then | |
puts "rated" | |
exit | |
else | |
ratings << b | |
end | |
end | |
(n-1).times do |i| | |
if ratings[i] < ratings[i+1] then | |
puts "unrated" | |
exit | |
end | |
end | |
puts "maybe" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p, x, y = gets.chomp.split(" ").map(&:to_i) | |
def tshirt(s) | |
ret = [] | |
i = (s / 50) % 475 | |
25.times do | |
i = (i * 96 + 42) % 475 | |
ret << (26 + i) | |
end | |
return ret | |
end | |
if x > y then | |
d = ((x - y) / 50.0).floor | |
xx = x - (d * 50) | |
while true | |
if tshirt(xx).include?(p) then | |
puts 0 | |
exit | |
elsif xx >= x then | |
break | |
end | |
xx += 50 | |
end | |
end | |
d = ([0, y - x].max / 50.0).ceil | |
x += (d * 50) | |
while true | |
break if tshirt(x).include?(p) | |
x += 50 | |
d += 1 | |
end | |
if d.even? | |
puts d / 2 | |
else | |
puts d / 2 + 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment