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/cf227B/code.rs from Gax-c/VeriContest_Lite: direct link, hf CLI and curl.
- Browser
- Download file 797 Bytes
-
https://huggingface.co/datasets/Gax-c/VeriContest_Lite/resolve/main/codeforces/cf227B/code.rs
- Command line
-
hf download hf://datasets/Gax-c/VeriContest_Lite/codeforces/cf227B/code.rs
-
curl -L -o code.rs https://huggingface.co/datasets/Gax-c/VeriContest_Lite/resolve/main/codeforces/cf227B/code.rs
797 Bytes
| impl Solution { | |
| pub fn effective_approach(permutation: Vec<i32>, queries: Vec<i32>) -> (i64, i64) { | |
| let n = permutation.len(); | |
| let mut positions = Vec::new(); | |
| let mut t = 0usize; | |
| while t <= n { | |
| positions.push(0i64); | |
| t += 1; | |
| } | |
| let mut i = 0usize; | |
| while i < n { | |
| let value = permutation[i] as usize; | |
| positions[value] = i as i64 + 1; | |
| i += 1; | |
| } | |
| let mut vasya = 0i64; | |
| let mut petya = 0i64; | |
| let mut j = 0usize; | |
| while j < queries.len() { | |
| let value = queries[j] as usize; | |
| let p = positions[value]; | |
| vasya += p; | |
| petya += n as i64 - p + 1; | |
| j += 1; | |
| } | |
| (vasya, petya) | |
| } | |
| } | |