Submission #34108012
Source Code Expand
Copy
use std::collections::HashMap;use proconio::input;fn main() {input! {n: usize,a: [usize; n],};let f = |a1: &[usize], a2: &[usize]| {println!("Yes");println!("{} {}",a1.len(),a1.iter().copied().map(|j| format!("{}", j + 1)).collect::<Vec<String>>().join(" "));
use std::collections::HashMap; use proconio::input; fn main() { input! { n: usize, a: [usize; n], }; let f = |a1: &[usize], a2: &[usize]| { println!("Yes"); println!( "{} {}", a1.len(), a1.iter() .copied() .map(|j| format!("{}", j + 1)) .collect::<Vec<String>>() .join(" ") ); println!( "{} {}", a2.len(), a2.iter() .copied() .map(|j| format!("{}", j + 1)) .collect::<Vec<String>>() .join(" ") ); }; let a = a.into_iter().map(|a_i| a_i % 200).collect::<Vec<usize>>(); let mut map = HashMap::new(); for (i, a_i) in a.iter().copied().enumerate() { map.entry(a_i).or_insert_with(Vec::new).push(i); } for (_, is) in map { if is.len() >= 2 { f(&[is[0]], &[is[1]]); return; } } let mut used = vec![vec![]; 200]; for (i, a_i) in a.iter().copied().enumerate() { if !used[a_i].is_empty() { f(&used[a_i], &[i]); return; } let mut next = used.clone(); for j in 0..200 { if used[j].is_empty() { continue; } let x = (j + a_i) % 200; if !used[x].is_empty() { let mut next_y = vec![]; next_y.extend(&used[j]); next_y.push(i); f(&used[x], &next_y); return; } if next[x].is_empty() { next[x].extend(&used[j]); next[x].push(i); } else { let mut next_y = vec![]; next_y.extend(&used[j]); next_y.push(i); f(&next[x], &next_y); return; } } if next[a_i].is_empty() { next[a_i].push(i); } else { f(&next[a_i], &[i]); return; } used = next; } println!("No"); }
Submission Info
Submission Time | |
---|---|
Task | D - Happy Birthday! 2 |
User | bouzuya |
Language | Rust (1.42.0) |
Score | 400 |
Code Size | 2139 Byte |
Status | AC |
Exec Time | 6 ms |
Memory | 2212 KB |
Judge Result
Set Name | Sample | All | after_contest | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | 0 / 0 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt |
after_contest | after_contest_01.txt, after_contest_02.txt, after_contest_03.txt, after_contest_04.txt, after_contest_05.txt, after_contest_06.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
after_contest_01.txt | AC | 6 ms | 1984 KB |
after_contest_02.txt | AC | 1 ms | 2036 KB |
after_contest_03.txt | AC | 1 ms | 2200 KB |
after_contest_04.txt | AC | 1 ms | 2104 KB |
after_contest_05.txt | AC | 2 ms | 2208 KB |
after_contest_06.txt | AC | 2 ms | 2108 KB |
sample_01.txt | AC | 1 ms | 2136 KB |
sample_02.txt | AC | 1 ms | 1996 KB |
sample_03.txt | AC | 1 ms | 2112 KB |
test_01.txt | AC | 1 ms | 2172 KB |
test_02.txt | AC | 1 ms | 2164 KB |
test_03.txt | AC | 2 ms | 2124 KB |
test_04.txt | AC | 1 ms | 2064 KB |
test_05.txt | AC | 1 ms | 1964 KB |
test_06.txt | AC | 2 ms | 2104 KB |
test_07.txt | AC | 2 ms | 2144 KB |
test_08.txt | AC | 1 ms | 2012 KB |
test_09.txt | AC | 1 ms | 2044 KB |
test_10.txt | AC | 1 ms | 2012 KB |
test_11.txt | AC | 1 ms | 2072 KB |
test_12.txt | AC | 1 ms | 2132 KB |
test_13.txt | AC | 1 ms | 2152 KB |
test_14.txt | AC | 3 ms | 2144 KB |
test_15.txt | AC | 1 ms | 1984 KB |
test_16.txt | AC | 3 ms | 2000 KB |
test_17.txt | AC | 1 ms | 2172 KB |
test_18.txt | AC | 2 ms | 2192 KB |
test_19.txt | AC | 3 ms | 2116 KB |
test_20.txt | AC | 2 ms | 2064 KB |
test_21.txt | AC | 2 ms | 2104 KB |
test_22.txt | AC | 3 ms | 1928 KB |
test_23.txt | AC | 1 ms | 2040 KB |
test_24.txt | AC | 1 ms | 2204 KB |
test_25.txt | AC | 1 ms | 1960 KB |
test_26.txt | AC | 1 ms | 2064 KB |
test_27.txt | AC | 1 ms | 1924 KB |
test_28.txt | AC | 1 ms | 2020 KB |
test_29.txt | AC | 1 ms | 2152 KB |
test_30.txt | AC | 1 ms | 2088 KB |
test_31.txt | AC | 1 ms | 2212 KB |
test_32.txt | AC | 2 ms | 2104 KB |
test_33.txt | AC | 1 ms | 2176 KB |
test_34.txt | AC | 2 ms | 2176 KB |
test_35.txt | AC | 1 ms | 2060 KB |