diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2023-07-24 13:11:33 +0300 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2023-07-24 13:11:33 +0300 |
| commit | 6b548332bfc6469756526002971c422f43f86d0a (patch) | |
| tree | 261fde23f07c3e20cea375030f0c52863b59228c /codeforces/TubeTubeFeed | |
| parent | cff8cae22ee9c25d193ff976143813f93e658e55 (diff) | |
| download | competitive-programming-6b548332bfc6469756526002971c422f43f86d0a.tar.xz competitive-programming-6b548332bfc6469756526002971c422f43f86d0a.zip | |
Removed some empty *.cpp files and Solved some new problems
Diffstat (limited to 'codeforces/TubeTubeFeed')
| -rw-r--r-- | codeforces/TubeTubeFeed/main.rs | 51 | ||||
| -rw-r--r-- | codeforces/TubeTubeFeed/rust-project.json | 16 |
2 files changed, 67 insertions, 0 deletions
diff --git a/codeforces/TubeTubeFeed/main.rs b/codeforces/TubeTubeFeed/main.rs new file mode 100644 index 0000000..477d31a --- /dev/null +++ b/codeforces/TubeTubeFeed/main.rs @@ -0,0 +1,51 @@ +use std::io; +use std::str::FromStr; + +#[allow(unused_variables)] +#[allow(dead_code)] + +fn read_line() -> String { + let mut buffer = String::new(); + io::stdin() + .read_line(&mut buffer) + .expect("failed to read line"); + + buffer +} + +#[allow(dead_code)] +fn read<T: FromStr>() -> Result<T, T::Err> { + read_line().trim().parse::<T>() +} + +#[allow(dead_code)] +fn read_vec<T: FromStr>() -> Result<Vec<T>, T::Err> { + read_line() + .split_whitespace() + .map(|x| x.parse::<T>()) + .collect() +} + +fn solve() { + let v: Vec<i32> = read_vec().unwrap(); + let (_, mut t) = (v[0], v[1]); + let a: Vec<i32> = read_vec().unwrap(); + let b: Vec<i32> = read_vec().unwrap(); + let mut mx = 0; + let mut idx = -1; + for i in 0..a.len() { + if t >= a[i] && b[i] > mx { + idx = i as i32 + 1; + mx = b[i]; + } + t -= 1; + } + println!("{idx}"); +} + +fn main() { + let t = read::<i32>().unwrap(); + for _i in 0..t { + solve(); + } +} diff --git a/codeforces/TubeTubeFeed/rust-project.json b/codeforces/TubeTubeFeed/rust-project.json new file mode 100644 index 0000000..9c76ee9 --- /dev/null +++ b/codeforces/TubeTubeFeed/rust-project.json @@ -0,0 +1,16 @@ +{ + "crates": [ + { + "root_module": "main.rs", + "edition": "2021", + "deps": [], + "cfg": [], + "env": {}, + "source": { + "include_dirs": ["."], + "exclude_dirs": [] + } + } + ], + "sysroot_src": "/home/omar/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library" +} |
