結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー yudedakoyudedako
提出日時 2020-12-01 19:38:59
言語 Rust
(1.77.0 + proconio)
結果
WA  
実行時間 -
コード長 5,541 bytes
コンパイル時間 13,594 ms
コンパイル使用メモリ 402,108 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-12 10:50:44
合計ジャッジ時間 15,477 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
6,812 KB
testcase_01 AC 14 ms
6,940 KB
testcase_02 AC 6 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 5 ms
6,940 KB
testcase_05 AC 5 ms
6,940 KB
testcase_06 AC 6 ms
6,940 KB
testcase_07 AC 5 ms
6,944 KB
testcase_08 WA -
testcase_09 AC 5 ms
6,944 KB
testcase_10 AC 6 ms
6,944 KB
testcase_11 AC 6 ms
6,940 KB
testcase_12 AC 6 ms
6,940 KB
testcase_13 AC 6 ms
6,940 KB
testcase_14 AC 6 ms
6,940 KB
testcase_15 AC 5 ms
6,944 KB
testcase_16 AC 6 ms
6,944 KB
testcase_17 AC 15 ms
6,940 KB
testcase_18 AC 5 ms
6,944 KB
testcase_19 AC 5 ms
6,940 KB
testcase_20 AC 6 ms
6,940 KB
testcase_21 AC 15 ms
6,944 KB
testcase_22 AC 6 ms
6,944 KB
testcase_23 AC 6 ms
6,940 KB
testcase_24 AC 6 ms
6,944 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 40 ms
6,940 KB
testcase_31 AC 67 ms
6,940 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 40 ms
6,940 KB
testcase_39 AC 76 ms
6,940 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
04_evil_A_01 RE -
04_evil_A_02 RE -
04_evil_A_03 RE -
04_evil_A_04 RE -
04_evil_A_05 RE -
04_evil_A_06 RE -
04_evil_A_07 RE -
04_evil_A_08 RE -
04_evil_A_09 RE -
04_evil_A_10 RE -
05_evil_B_01 RE -
05_evil_B_02 RE -
05_evil_B_03 RE -
05_evil_B_04 RE -
05_evil_B_05 RE -
05_evil_B_06 RE -
05_evil_B_07 RE -
05_evil_B_08 RE -
05_evil_B_09 RE -
05_evil_B_10 RE -
06_evil_C_01 RE -
06_evil_C_02 RE -
06_evil_C_03 RE -
06_evil_C_04 RE -
06_evil_C_05 RE -
06_evil_C_06 RE -
06_evil_C_07 RE -
06_evil_C_08 RE -
06_evil_C_09 RE -
06_evil_C_10 AC 4 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused imports: `collections::BTreeMap`, `collections::BTreeSet`, `ops::AddAssign`, `ops::Neg`, `ops::RangeInclusive`, `rc::Rc`
 --> src/main.rs:1:11
  |
1 | use std::{collections::BTreeMap, collections::BTreeSet, ops::AddAssign, ops::Neg, ops::RangeInclusive, rc::Rc};
  |           ^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^  ^^^^^^^^  ^^^^^^^^^^^^^^^^^^^  ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused imports: `collections::HashMap`, `collections::HashSet`, `ops::Add`, `ops::Div`, `ops::Mul`, `ops::Sub`
 --> src/main.rs:2:11
  |
2 | use std::{ops::Add, ops::Sub, ops::Mul, ops::Div, collections::HashMap, collections::HashSet};
  |           ^^^^^^^^  ^^^^^^^^  ^^^^^^^^  ^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^

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

warning: unused imports: `BinaryHeap`, `VecDeque`
 --> src/main.rs:4:24
  |
4 | use std::collections::{VecDeque, BinaryHeap};
  |                        ^^^^^^^^  ^^^^^^^^^^

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

warning: unused import: `std::fmt::Display`
 --> src/main.rs:6:5
  |
6 | use std::fmt::Display;
  |     ^^^^^^^^^^^^^^^^^

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

warning: unused imports: `DivAssign`, `IndexMut`, `Index`, `MulAssign`, `SubAssign`
  --> src/main.rs:11:16
   |
11 | use std::ops::{Index, IndexMut, SubAssign, MulAssign, DivAssign};
   |                ^^^^^  ^^^^^^^^  ^^^^^^^^^  ^^^^^^^^^  ^^^^^^^^^

warning: unused imports: `Hash`, `Hasher`
  --> src/main.rs:12:17
   |
12 | use std::hash::{Hash, Hasher};
   |                 ^^^^  ^^^^^^

warning: unused import: `std::collections::hash_map::Entry::Vacant`
  --> src/main.rs:13:5
   |
13 | use std::collections::hash_map::Entry::Vacant;
   |     ^

ソースコード

diff #

use std::{collections::BTreeMap, collections::BTreeSet, ops::AddAssign, ops::Neg, ops::RangeInclusive, rc::Rc};
use std::{ops::Add, ops::Sub, ops::Mul, ops::Div, collections::HashMap, collections::HashSet};
use std::cmp::Reverse;
use std::collections::{VecDeque, BinaryHeap};
use std::str::FromStr;
use std::fmt::Display;
use std::cmp::max;
use std::cmp::min;
use std::cmp::Ordering;
use std::fmt::Debug;
use std::ops::{Index, IndexMut, SubAssign, MulAssign, DivAssign};
use std::hash::{Hash, Hasher};
use std::collections::hash_map::Entry::Vacant;
use std::io::BufRead;
use std::borrow::Borrow;

const PARSE_ERROR: &str = "Can't Parse";
const EOF_ERROR: &str = "No Line";
macro_rules! freeze {
    ($($id:ident), *) => {
        $(let $id = $id;)*
    };
}
macro_rules! read_line {
    () => {
        {
            let mut buffer = String::new();
            std::io::stdin().read_line(&mut buffer).expect(EOF_ERROR);
            buffer.trim().to_owned()
        }
    };
    (&mut $buffer: ident) => {
        {
            std::io::stdin().read_line(&mut $buffer).expect(EOF_ERROR);
            $buffer.trim().to_owned()
        }
    };
}
macro_rules! read {
    () => {
        read_line!()
    };
    ([[char]; $size: expr]) => {
        (0 .. $size).into_iter().map(|_| read!([char])).collect::<Vec<_>>()
    };
    ([[$ty:ty]; $size: expr]) => {
        (0 .. $size).into_iter().map(|_| read!([$ty])).collect::<Vec<_>>()
    };
    ([$ty:ty; $size: expr]) => {
        (0 .. $size).into_iter().map(|_| read!($ty)).collect::<Vec<_>>()
    };
    ([$block: block; $size: expr]) => {
        (0 .. $size).into_iter().map(|_| read!($block)).collect::<Vec<_>>()
    };
    ([$($tt: tt)*] ASC) => {
        {
            read!(mut vec: [$($tt)*]);
            vec.sort();
            vec
        }
    };
    ([$($tt: tt)*] DESC) => {
        {
            read!(mut vec: [$($tt)*]);
            vec.sort_by_key(|&v| Reverse(v));
            vec
        }
    };
    ([char]) => {
        read_line!().chars().collect::<Vec<_>>()
    };
    ([String]) => {
        read_line!().split_whitespace().map(|s| s.to_owned()).collect::<Vec<String>>();
    };
    ([$ty: ty]) => {
        read_line!().split_whitespace().map(|x| x.parse().ok().expect(PARSE_ERROR)).collect::<Vec<$ty>>()
    };
    ($ty: ty) => {
        read_line!().parse::<$ty>().ok().expect(PARSE_ERROR)
    };
    ($block: block) => {
        $block
    };
    ($ident: ident: [$($tt:tt)*]) => {
        let $ident = read!([$($tt)*]);
    };
    (mut $ident: ident: [$($tt:tt)*]) => {
        let mut $ident = read!([$($tt)*]);
    };
    ($ident: ident: [$($tt:tt)*] ASC) => {
        let $ident = read!([$($tt)*] ASC);
    };
    ($ident: ident: [$($tt:tt)*] DESC) => {
        let $ident = read!([$($tt)*] DESC);
    };
    ($ident: ident: String) => {
        let $ident = read!();
    };
    (mut $ident: ident: String) => {
        let mut $ident = read!();
    };
    ($($token: tt)*) => {
        let line = read_line!();
        let mut iter = line.split_whitespace().into_iter();
        read_from_iter!(iter; $($token)*);
    };
}
macro_rules! read_from_iter {
    ($iter:expr; mut $ident:ident:$ty:ty, $($rest:tt)*) => {
        let mut $ident = $iter.next().unwrap().parse::<$ty>().expect(PARSE_ERROR);
        read_from_iter!($iter; $($rest)*);
    };
    ($iter:expr; $ident:ident:$ty:ty, $($rest:tt)*) => {
        let $ident = $iter.next().unwrap().parse::<$ty>().expect(PARSE_ERROR);
        read_from_iter!($iter; $($rest)*);
    };
    ($iter:expr; mut $ident:ident:$ty:ty) => {
        let mut $ident = $iter.next().unwrap().parse::<$ty>().expect(PARSE_ERROR);
    };
    ($iter:expr; $ident:ident:$ty:ty) => {
        let $ident = $iter.next().unwrap().parse::<$ty>().expect(PARSE_ERROR);
    };
    ($iter: expr; ) => {};
}
struct KeyValue<K, V> {
    key: K,
    value: V
}
impl <K: PartialOrd, V> PartialEq for KeyValue<K, V> {
    fn eq(&self, other: &Self) -> bool {
        self.key.eq(&other.key)
    }
}
impl <K: PartialOrd, V> Eq for KeyValue<K, V> {}
impl <K: PartialOrd, V> PartialOrd for KeyValue<K, V> {
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        self.key.partial_cmp(&other.key)
    }
}
impl <K: PartialOrd, V> Ord for KeyValue<K, V> {
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.key.partial_cmp(&other.key).ok_or("Can't Compare").unwrap()
    }
}
fn sorted<T: Ord>(mut vec: Vec<T>) -> Vec<T> {
    vec.sort();
    vec
}
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
struct OrdF64(f64);
impl Ord for OrdF64 {
    fn cmp(&self, other: &Self) -> Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}
impl Eq for OrdF64 {}

fn main() {
    read!(n: usize, k: usize, x: usize, y: usize);
    read!(values: [usize]);
    const MOD: i64 = 9982443353;
    let mut count = vec![0; 1 << 10];
    for v in values {
        count[v] += 1;
    }
    let mut memo = vec![vec![0i64; 1 << 10]; n + 1];
    memo[0][0] = 1;
    for i in 1 ..= n {
        for x in 0..1024 {
            for y in 0..1024 {
                memo[i][x] += memo[i - 1][x ^ y] * count[y] % MOD;
                if i >= 3 {
                    memo[i][x] += memo[i - 3][x ^ y] * count[y] % MOD;
                }
            }
            if i >= 2 {
                memo[i][x] = (memo[i][x] - memo[i - 2][x] * (k as i64) % MOD + MOD) % MOD
            }
        }
    }
    let mut result = 0;
    for i in x ..= min(y, 1023) {
        result += memo[n][i];
    }
    println!("{}", result % MOD);
}
0