Submission #62517013
Source Code Expand
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
use proconio::marker::Usize1;
fn main() {
input!{
n: usize,
p: [Usize1; n],
q: [Usize1; n],
}
let ans = (0..n).sorted_unstable_by_key(|i| q[*i]).map(|i| 1+q[p[i]]).collect_vec();
println!("{}", ans.iter().join(" "));
}
pub trait Debuggable {
fn debug_string(&self) -> String;
}
impl<T: std::fmt::Debug + std::fmt::Display> Debuggable for Vec<T> {
fn debug_string(&self) -> String {
use itertools::Itertools;
use std::iter::repeat;
if let Some(max_size) = self.iter()
.enumerate()
.map(|(i, x)| (format!("{:?}", x).len()).max(format!("{:?}", i).len()))
.max() {
let mut idx = String::from("idx |");
let mut val = String::from("val |");
for (i, xi) in self.iter().enumerate() {
idx.push_str(
&format!(" {:>w$} |", i, w=max_size)
);
val.push_str(
&format!(" {:>w$} |", xi, w=max_size)
);
}
format!("{}\n{}\n{}\n", idx, repeat('-').take(idx.len()).join(""), val)
} else {
format!("idx | \nval |\n")
}
}
}
impl<T: std::fmt::Debug + std::fmt::Display> Debuggable for std::collections::BTreeSet<T> {
fn debug_string(&self) -> String {
use itertools::Itertools;
format!("{{ {} }}", self.iter().join(", "))
}
}
impl<T, U> Debuggable for std::collections::BTreeMap<T, U>
where T: std::fmt::Debug + std::fmt::Display, U: std::fmt::Debug + std::fmt::Display
{
fn debug_string(&self) -> String {
use itertools::Itertools;
format!(
"{{\n{}\n }}", self.iter()
.map(|(k, v)| format!("{k} -> {v}, "))
.join("\n")
)
}
}
// lg! マクロの定義
#[macro_export]
macro_rules! lg {
($val:expr) => {
#[cfg(feature = "local")]
{
{
use Debuggable;
let val = &$val;
eprintln!(
"[{}:{}] {} = \n{}",
file!(),
line!(),
stringify!($val),
val.debug_string()
);
val
}
}
}
}
Submission Info
Submission Time
2025-02-08 21:10:44+0900
Task
C - Bib
User
ardRiriy
Language
Rust (rustc 1.70.0)
Score
300
Code Size
2430 Byte
Status
AC
Exec Time
42 ms
Memory
15288 KiB
Compile Error
warning: the item `Itertools` is imported redundantly
--> src/main.rs:22:13
|
2 | use itertools::Itertools;
| -------------------- the item `Itertools` is already imported here
...
22 | use itertools::Itertools;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: the item `Itertools` is imported redundantly
--> src/main.rs:48:13
|
2 | use itertools::Itertools;
| -------------------- the item `Itertools` is already imported here
...
48 | use itertools::Itertools;
| ^^^^^^^^^^^^^^^^^^^^
warning: the item `Itertools` is imported redundantly
--> src/main.rs:57:13
|
2 | use itertools::Itertools;
| -------------------- the item `Itertools` is already imported here
...
57 | use itertools::Itertools;
| ^^^^^^^^^^^^^^^^^^^^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
300 / 300
Status
Set Name
Test Cases
Sample
sample_01.txt, sample_02.txt
All
min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, sample_01.txt, sample_02.txt
Case Name
Status
Exec Time
Memory
min.txt
AC
1 ms
1928 KiB
random_01.txt
AC
42 ms
15216 KiB
random_02.txt
AC
2 ms
2204 KiB
random_03.txt
AC
41 ms
15288 KiB
random_04.txt
AC
6 ms
3552 KiB
random_05.txt
AC
42 ms
15200 KiB
random_06.txt
AC
9 ms
4716 KiB
random_07.txt
AC
41 ms
15220 KiB
random_08.txt
AC
38 ms
13992 KiB
random_09.txt
AC
41 ms
15216 KiB
random_10.txt
AC
18 ms
7480 KiB
sample_01.txt
AC
1 ms
1948 KiB
sample_02.txt
AC
1 ms
1980 KiB