Submission #71314183
Source Code Expand
fun main() {
val cin = System.`in`.bufferedReader()
val cout = System.out.bufferedWriter()
repeat(cin.readLine().toInt()) {
var (n, h) = cin.readLine().split(" ").map { it.toInt() }
var ans = true
var min = h.toLong()
var max = min
var currt = 0L
repeat(n) {
val (t, l, u) = cin.readLine().split(" ").map { it.toLong() }
val dt = t - currt
if ((max + dt < l) || (min - dt > u)) {
ans = false
return@repeat
}
max = minOf(u, max + dt)
min = maxOf(l, min - dt)
currt = t
}
cout.write(if (ans) "Yes" else "No")
cout.newLine()
}
cout.flush()
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Flapping Takahashi |
| User | jagbarrameda |
| Language | Kotlin (Kotlin/JVM 2.2.10) |
| Score | 300 |
| Code Size | 774 Byte |
| Status | AC |
| Exec Time | 352 ms |
| Memory | 67664 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt |
| All | 00_sample_00.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 01_small_07.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 83 ms | 42364 KiB |
| 01_small_00.txt | AC | 352 ms | 67664 KiB |
| 01_small_01.txt | AC | 307 ms | 66752 KiB |
| 01_small_02.txt | AC | 302 ms | 65060 KiB |
| 01_small_03.txt | AC | 283 ms | 66004 KiB |
| 01_small_04.txt | AC | 269 ms | 64488 KiB |
| 01_small_05.txt | AC | 266 ms | 64772 KiB |
| 01_small_06.txt | AC | 261 ms | 62748 KiB |
| 01_small_07.txt | AC | 256 ms | 62132 KiB |
| 02_random_00.txt | AC | 239 ms | 61640 KiB |
| 02_random_01.txt | AC | 255 ms | 61728 KiB |
| 02_random_02.txt | AC | 252 ms | 61784 KiB |
| 02_random_03.txt | AC | 247 ms | 61504 KiB |
| 02_random_04.txt | AC | 251 ms | 61932 KiB |
| 02_random_05.txt | AC | 253 ms | 61824 KiB |
| 02_random_06.txt | AC | 220 ms | 61264 KiB |
| 02_random_07.txt | AC | 244 ms | 61736 KiB |
| 02_random_08.txt | AC | 243 ms | 61192 KiB |
| 02_random_09.txt | AC | 199 ms | 60656 KiB |
| 02_random_10.txt | AC | 240 ms | 61452 KiB |
| 02_random_11.txt | AC | 245 ms | 61468 KiB |
| 02_random_12.txt | AC | 244 ms | 61444 KiB |
| 02_random_13.txt | AC | 243 ms | 61488 KiB |
| 02_random_14.txt | AC | 242 ms | 61448 KiB |
| 02_random_15.txt | AC | 243 ms | 62504 KiB |
| 02_random_16.txt | AC | 247 ms | 62104 KiB |
| 02_random_17.txt | AC | 245 ms | 61420 KiB |
| 02_random_18.txt | AC | 247 ms | 61624 KiB |
| 02_random_19.txt | AC | 248 ms | 61900 KiB |