Submission #64037771
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//#[derive_readable]
#[derive(Debug, Clone)]
struct Problem {
xs: Vec<i64>,
}
impl Problem {
fn read() -> Problem {
input! {
xs: [i64; 7],
}
Problem { xs }
}
fn solve(&self) -> Answer {
let xs = &self.xs;
let ans = xs.iter().copied().combinations(5).any(|ys| {
let cnts = ys
.iter()
.copied()
.counts()
.values()
.copied()
.sorted()
.collect_vec();
cnts == vec![2, 3]
});
Answer { ans }
}
#[allow(dead_code)]
fn solve_naive(&self) -> Answer {
todo!();
// let ans = 0;
// Answer { ans }
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
struct Answer {
ans: bool,
}
impl Answer {
fn print(&self) {
print_yesno(self.ans);
}
}
fn main() {
Problem::read().solve().print();
}
#[cfg(test)]
mod tests {
#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use rand::{rngs::SmallRng, seq::SliceRandom, *};
#[test]
fn test_problem() {
assert_eq!(1 + 1, 2);
}
#[allow(dead_code)]
#[derive(Debug)]
struct WrongTestCase {
problem: Problem,
main_ans: Answer,
naive_ans: Answer,
}
#[allow(dead_code)]
fn check(p: &Problem) -> Option<WrongTestCase> {
let main_ans = p.solve();
let naive_ans = p.solve_naive();
if main_ans != naive_ans {
Some(WrongTestCase {
problem: p.clone(),
main_ans,
naive_ans,
})
} else {
None
}
}
#[allow(dead_code)]
fn make_random_problem(rng: &mut SmallRng) -> Problem {
todo!()
// let n = rng.gen_range(1..=10);
// let p = Problem { _a: n };
// println!("{:?}", &p);
// p
}
#[allow(unreachable_code)]
#[test]
fn test_with_naive() {
let num_tests = 0;
let max_wrong_case = 10; // この件数間違いが見つかったら打ち切り
let mut rng = SmallRng::seed_from_u64(42);
// let mut rng = SmallRng::from_entropy();
let mut wrong_cases: Vec<WrongTestCase> = vec![];
for _ in 0..num_tests {
let p = make_random_problem(&mut rng);
let result = check(&p);
if let Some(wrong_test_case) = result {
wrong_cases.push(wrong_test_case);
}
if wrong_cases.len() >= max_wrong_case {
break;
}
}
if !wrong_cases.is_empty() {
for t in &wrong_cases {
println!("{:?}", t.problem);
println!("main ans : {:?}", t.main_ans);
println!("naive ans: {:?}", t.naive_ans);
println!();
}
println!("{} cases are wrong.", wrong_cases.len());
panic!();
}
}
}
// ====== import ======
#[allow(unused_imports)]
use itertools::{chain, iproduct, izip, Itertools};
#[allow(unused_imports)]
use proconio::{
derive_readable, fastout, input,
marker::{Bytes, Chars, Usize1},
};
#[allow(unused_imports)]
use std::cmp::Reverse;
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
// ====== output func ======
#[allow(unused_imports)]
use print_vec::*;
pub mod print_vec {
use itertools::Itertools;
use proconio::fastout;
#[fastout]
pub fn print_vec<T: std::fmt::Display>(arr: &[T]) {
for a in arr {
println!("{}", a);
}
}
#[fastout]
pub fn print_vec_1line<T: std::fmt::Display>(arr: &[T]) {
let msg = arr.iter().map(|x| format!("{}", x)).join(" ");
println!("{}", msg);
}
#[fastout]
pub fn print_vec2<T: std::fmt::Display>(arr: &Vec<Vec<T>>) {
for row in arr {
let msg = row.iter().map(|x| format!("{}", x)).join(" ");
println!("{}", msg);
}
}
pub fn print_bytes(bytes: &[u8]) {
let msg = String::from_utf8(bytes.to_vec()).unwrap();
println!("{}", msg);
}
pub fn print_chars(chars: &[char]) {
let msg = chars.iter().collect::<String>();
println!("{}", msg);
}
#[fastout]
pub fn print_vec_bytes(vec_bytes: &[Vec<u8>]) {
for row in vec_bytes {
let msg = String::from_utf8(row.to_vec()).unwrap();
println!("{}", msg);
}
}
}
#[allow(unused)]
fn print_yesno(ans: bool) {
let msg = if ans { "Yes" } else { "No" };
println!("{}", msg);
}
// ====== snippet ======
Submission Info
Submission Time |
|
Task |
B - Full House 3 |
User |
paruma184 |
Language |
Rust (rustc 1.70.0) |
Score |
250 |
Code Size |
4674 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
2092 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
250 / 250 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
All |
hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.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 |
Case Name |
Status |
Exec Time |
Memory |
hand_01.txt |
AC |
1 ms |
1924 KB |
hand_02.txt |
AC |
0 ms |
1940 KB |
hand_03.txt |
AC |
0 ms |
1980 KB |
hand_04.txt |
AC |
0 ms |
2084 KB |
sample_01.txt |
AC |
1 ms |
1908 KB |
sample_02.txt |
AC |
0 ms |
2052 KB |
sample_03.txt |
AC |
0 ms |
1876 KB |
sample_04.txt |
AC |
0 ms |
1928 KB |
test_01.txt |
AC |
0 ms |
1944 KB |
test_02.txt |
AC |
0 ms |
1932 KB |
test_03.txt |
AC |
1 ms |
1884 KB |
test_04.txt |
AC |
1 ms |
2076 KB |
test_05.txt |
AC |
0 ms |
1976 KB |
test_06.txt |
AC |
0 ms |
1940 KB |
test_07.txt |
AC |
1 ms |
1932 KB |
test_08.txt |
AC |
0 ms |
2008 KB |
test_09.txt |
AC |
0 ms |
1884 KB |
test_10.txt |
AC |
0 ms |
1932 KB |
test_11.txt |
AC |
0 ms |
1976 KB |
test_12.txt |
AC |
0 ms |
1944 KB |
test_13.txt |
AC |
0 ms |
1848 KB |
test_14.txt |
AC |
0 ms |
2020 KB |
test_15.txt |
AC |
0 ms |
2080 KB |
test_16.txt |
AC |
0 ms |
1960 KB |
test_17.txt |
AC |
0 ms |
2068 KB |
test_18.txt |
AC |
0 ms |
1928 KB |
test_19.txt |
AC |
0 ms |
1968 KB |
test_20.txt |
AC |
0 ms |
2088 KB |
test_21.txt |
AC |
0 ms |
1808 KB |
test_22.txt |
AC |
0 ms |
2092 KB |
test_23.txt |
AC |
0 ms |
1944 KB |
test_24.txt |
AC |
1 ms |
2088 KB |
test_25.txt |
AC |
0 ms |
1944 KB |
test_26.txt |
AC |
1 ms |
2088 KB |