結果

問題 No.3145 Astral Parentheses Sequence
ユーザー Blue_S
提出日時 2025-05-16 22:58:56
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 866 bytes
コンパイル時間 12,282 ms
コンパイル使用メモリ 400,436 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-05-16 22:59:13
合計ジャッジ時間 13,813 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 10 WA * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `proconio::marker::*`
 --> src/main.rs:1:5
  |
1 | use proconio::marker::*;
  |     ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `m`
  --> src/main.rs:15:9
   |
15 |         m: usize,
   |         ^ help: if this is intentional, prefix it with an underscore: `_m`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `k`
  --> src/main.rs:26:9
   |
26 |     for k in 1..=n / 3 {
   |         ^ help: if this is intentional, prefix it with an underscore: `_k`

warning: variable does not need to be mutable
  --> src/main.rs:23:9
   |
23 |     let mut ans = 0;
   |         ----^^^
   |         |
   |         help: remove this `mut`
   |
   = note: `#[warn(unused_mut)]` on by default

warning: type alias `Map` is never used
 --> src/main.rs:5:6
  |
5 | type Map<K, V> = BTreeMap<K, V>;
  |      ^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: type alias `Set` is never used
 --> src/main.rs:6:6
  |
6 | type Set<T> = BTreeSet<T>;
  |      ^^^

warning: type alias `Deque` is never used
 --> src/main.rs:7:6
  |
7 | type Deque<T> = VecDeque<T>;
  |      ^^^^^

warning: type alias `Heap` is never used
 --> src/main.rs:8:6
  |
8 | type Heap<T> = BinaryHeap<T>;
  |      ^^^^

warning: constant `MOD` is never used
  --> src/main.rs:10:7
   |
10 | const MOD: u64 = 998_244_353;
   |       ^^^

warning: function `pow_mod` is never used
  --> src/main.rs:33:4
   |
33 | fn pow_mod(mut a: usize, mut n: usize, m: usize) -> usize {
   |    ^^^^^^^

ソースコード

diff #

use proconio::marker::*;
use proconio::*;
use std::collections::*;

type Map<K, V> = BTreeMap<K, V>;
type Set<T> = BTreeSet<T>;
type Deque<T> = VecDeque<T>;
type Heap<T> = BinaryHeap<T>;

const MOD: u64 = 998_244_353;

fn main() {
    input! {
        n: usize,
        m: usize,
    }

    if n % 3 != 0 {
        println!("0");
        return;
    }

    let mut ans = 0;
    // 正しい括弧列の中で、 `()` が `k` 個あるようなもの `f(k)`
    // `sum f(k) * 2.pow(n / 3 - k)`
    for k in 1..=n / 3 {
        // `f` をどうやって求めるのかわかりません。
    }

    println!("{}", ans);
}

fn pow_mod(mut a: usize, mut n: usize, m: usize) -> usize {
    let mut res = 1;
    while n > 0 {
        if n & 1 == 1 {
            res *= a;
            res %= m;
        }
        a *= a;
        a %= m;
        n >>= 1;
    }
    res
}
0