Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
ArXiv:
Tags:
competitive-programming
code-generation
specification-generation
proof-generation
verification
rust
License:
Download codeforces/cf2020B/code.rs from Gax-c/VeriContest_Lite: direct link, hf CLI and curl.
- Browser
- Download file 796 Bytes
-
https://huggingface.co/datasets/Gax-c/VeriContest_Lite/resolve/main/codeforces/cf2020B/code.rs
- Command line
-
hf download hf://datasets/Gax-c/VeriContest_Lite/codeforces/cf2020B/code.rs
-
curl -L -o code.rs https://huggingface.co/datasets/Gax-c/VeriContest_Lite/resolve/main/codeforces/cf2020B/code.rs
796 Bytes
| impl Solution { | |
| pub fn floor_sqrt_u64(x: u64) -> u64 { | |
| let mut lo = 1u64; | |
| let mut hi = 2_000_000_001u64; | |
| while lo < hi { | |
| let mid = lo + (hi - lo) / 2; | |
| if mid * mid <= x { | |
| lo = mid + 1; | |
| } else { | |
| hi = mid; | |
| } | |
| } | |
| let r = lo - 1; | |
| r | |
| } | |
| pub fn min_bulbs_n(k: u64) -> u64 { | |
| let ub = k + 2_000_000_000u64 + 1000u64; | |
| let mut lo = 1u64; | |
| let mut hi = ub; | |
| while lo < hi { | |
| let mid = lo + (hi - lo) / 2; | |
| let s = Self::floor_sqrt_u64(mid); | |
| let cnt = mid - s; | |
| if cnt >= k { | |
| hi = mid; | |
| } else { | |
| lo = mid + 1; | |
| } | |
| } | |
| lo | |
| } | |
| } | |