Submission #74786696


Source Code Expand

use proconio::input;
use itertools::{Itertools,sorted};
use core::num;
use std::collections::{HashMap, HashSet, BTreeSet, BTreeMap};
use std::cmp::min;
use std::io::{self, BufRead};
use std::vec;
use std::cmp::max;
use std::cmp::Reverse;




fn main() {
 input! {
    n: usize,
 };
 let mut set = HashSet::new();
 let mut res = true;
 let arr1 = ['H', 'D', 'C', 'S'];
 let arr2 = ['A' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'T' , 'J' , 'Q' , 'K'];
 for i in 0..n {
    input!{
        mut s: String,
    };
    if set.contains(&s) {
        res = false;
        break;
    }
    set.insert(s.clone());
     let _s: Vec<char> = s.chars().collect();
    if !arr1.contains(&_s[0]) {
        res = false;
        break;
    }

    if !arr2.contains(&_s[1]) {
        res = false;
        break;
    }

 }
 if res {
    println!("Yes");
 } else {
    println!("No");
 }
    
}

Submission Info

Submission Time
Task C - Playing Cards Validation
User harugumoFM
Language Rust (rustc 1.89.0)
Score 200
Code Size 932 Byte
Status AC
Exec Time 1 ms
Memory 2228 KiB

Compile Error

warning: unused import: `sorted`
 --> src/main.rs:2:27
  |
2 | use itertools::{Itertools,sorted};
  |                           ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `core::num`
 --> src/main.rs:3:5
  |
3 | use core::num;
  |     ^^^^^^^^^

warning: unused imports: `BTreeMap`, `BTreeSet`, and `HashMap`
 --> src/main.rs:4:24
  |
4 | use std::collections::{HashMap, HashSet, BTreeSet, BTreeMap};
  |                        ^^^^^^^           ^^^^^^^^  ^^^^^^^^

warning: unused import: `std::cmp::min`
 --> src/main.rs:5:5
  |
5 | use std::cmp::min;
  |     ^^^^^^^^^^^^^

warning: unused imports: `BufRead` and `self`
 --> src/main.rs:6:15
  |
6 | use std::io::{self, BufRead};
  |               ^^^^  ^^^^^^^

warning: unused import: `std::vec`
 --> src/main.rs:7:5
  |
7 | use std::vec;
  |     ^^^^^^^^

warning: unused import: `std::cmp::max`
 --> src/main.rs:8:5
  |
8 | use std::cmp::max;
  |     ^^^^^^^^^^^^^

warning: unused import: `std::cmp::Reverse`
 --> src/main.rs:9:5
  |
9 | use std::cmp::Reverse;
  |     ^^^^^^^^^^^^^^^^^

warning: unused import: `Itertools`
 --> src/main.rs:2:17
  |
2 | use itertools::{Itertools,sorted};
  |                 ^^^^^^^^^

warning: unused variable: `i`
  --> src/main.rs:22:6
   |
22 |  for i in 0..n {
   |      ^ help: if this is intentional, prefix it with an underscore: `_i`
   |
   = note: `#[warn(unused_variables)]` on by default

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 19
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt, example3.txt
All example0.txt, example1.txt, example2.txt, example3.txt, max0.txt, random0.txt, random1.txt, random10.txt, random11.txt, random12.txt, random13.txt, random2.txt, random3.txt, random4.txt, random5.txt, random6.txt, random7.txt, random8.txt, random9.txt
Case Name Status Exec Time Memory
example0.txt AC 1 ms 1976 KiB
example1.txt AC 1 ms 1912 KiB
example2.txt AC 1 ms 2044 KiB
example3.txt AC 1 ms 2052 KiB
max0.txt AC 1 ms 2036 KiB
random0.txt AC 1 ms 1952 KiB
random1.txt AC 1 ms 2076 KiB
random10.txt AC 1 ms 1996 KiB
random11.txt AC 1 ms 1916 KiB
random12.txt AC 1 ms 2068 KiB
random13.txt AC 1 ms 2080 KiB
random2.txt AC 1 ms 1996 KiB
random3.txt AC 1 ms 1996 KiB
random4.txt AC 1 ms 2060 KiB
random5.txt AC 1 ms 1872 KiB
random6.txt AC 1 ms 2076 KiB
random7.txt AC 1 ms 2228 KiB
random8.txt AC 1 ms 2088 KiB
random9.txt AC 1 ms 1876 KiB