Submission #30553026
Source Code Expand
# frozen_string_literal: true
require 'set'
N, K = gets.chomp.split.map(&:to_i)
A = gets.chomp.split.map(&:to_i)
B = gets.chomp.split.map(&:to_i)
available_numbers = Set[A.pop, B.pop]
until A.empty?
tmp = Set.new
a, b = A.pop, B.pop
available_numbers.each do |n|
if (a - n).abs <= K
tmp.add(a)
end
if (b - n).abs <= K
tmp.add(b)
end
end
available_numbers = tmp
end
puts available_numbers.size.nonzero? ? 'Yes' : 'No'
Submission Info
| Submission Time | |
|---|---|
| Task | C - Choose Elements |
| User | Aruma256 |
| Language | Ruby (2.7.1) |
| Score | 300 |
| Code Size | 483 Byte |
| Status | AC |
| Exec Time | 344 ms |
| Memory | 71992 KiB |
Judge Result
| Set Name | Sample | after_contest | All | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 0 | 300 / 300 | ||||||
| Status |
|
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt, example2.txt |
| after_contest | after_contest_001.txt, after_contest_002.txt, after_contest_003.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, example0.txt, example1.txt, example2.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 84 ms | 17772 KiB |
| 001.txt | AC | 59 ms | 14364 KiB |
| 002.txt | AC | 78 ms | 17816 KiB |
| 003.txt | AC | 56 ms | 14340 KiB |
| 004.txt | AC | 55 ms | 14212 KiB |
| 005.txt | AC | 56 ms | 14332 KiB |
| 006.txt | AC | 340 ms | 69848 KiB |
| 007.txt | AC | 292 ms | 62608 KiB |
| 008.txt | AC | 257 ms | 49376 KiB |
| 009.txt | AC | 240 ms | 48980 KiB |
| 010.txt | AC | 344 ms | 70824 KiB |
| 011.txt | AC | 312 ms | 63008 KiB |
| 012.txt | AC | 341 ms | 71000 KiB |
| 013.txt | AC | 312 ms | 63824 KiB |
| 014.txt | AC | 340 ms | 70060 KiB |
| 015.txt | AC | 269 ms | 58436 KiB |
| 016.txt | AC | 344 ms | 69976 KiB |
| 017.txt | AC | 309 ms | 63620 KiB |
| 018.txt | AC | 303 ms | 63556 KiB |
| 019.txt | AC | 197 ms | 43420 KiB |
| 020.txt | AC | 343 ms | 70084 KiB |
| 021.txt | AC | 264 ms | 55620 KiB |
| 022.txt | AC | 340 ms | 71992 KiB |
| 023.txt | AC | 258 ms | 55588 KiB |
| after_contest_001.txt | AC | 58 ms | 14200 KiB |
| after_contest_002.txt | AC | 57 ms | 14384 KiB |
| after_contest_003.txt | AC | 56 ms | 14412 KiB |
| example0.txt | AC | 58 ms | 14372 KiB |
| example1.txt | AC | 58 ms | 14320 KiB |
| example2.txt | AC | 57 ms | 14276 KiB |