結果

問題 No.3820 TSG BINGO (All Language)
コンテスト
ユーザー alcea
提出日時 2026-11-21 00:03:35
言語 Rust
(1.99.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 1 ms / 2,000 ms
+ 102µs
コード長 1,073 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,086 ms
コンパイル使用メモリ 185,056 KB
実行使用メモリ 9,872 KB
スコア 50
最終ジャッジ日時 2026-11-21 14:34:24
合計ジャッジ時間 4,583 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge5_0
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `A` should have a snake case name
  --> src/main.rs:29:5
   |
29 |     A: [[i32; 5]; 5],
   |     ^ help: convert the identifier to snake case: `a`
   |
   = note: `#[warn(non_snake_case)]` (part of `#[warn(nonstandard_style)]`) on by default

warning: variable `N` should have a snake case name
  --> src/main.rs:30:5
   |
30 |     N: usize,
   |     ^ help: convert the identifier to snake case: `n`

warning: variable `B` should have a snake case name
  --> src/main.rs:31:5
   |
31 |     B: [i32; N],
   |     ^ help: convert the identifier to snake case: `b`

warning: variable `B_i` should have a snake case name
  --> src/main.rs:35:7
   |
35 |   for B_i in B {
   |       ^^^ help: convert the identifier to snake case: `b_i`

warning: variable `C` should have a snake case name
  --> src/main.rs:53:14
   |
53 |     .filter(|C| {
   |              ^ help: convert the identifier to snake case (notice the capitalization): `c`

warning: variable `D` should have a snake case name
  --> src/main.rs:54:37
   |
54 |       C.iter().enumerate().all(|(i, D)| {
   |                                     ^ help: convert the identifier to snake case: `d`

ソースコード

diff #
raw source code

use proconio::input;

const TSG: [[&str; 5]; 3] = [
  [
    "ooooo",
    "--o--",
    "--o--",
    "--o--",
    "--o--",
  ],
  [
    "ooooo",
    "o----",
    "ooooo",
    "----o",
    "ooooo",
  ],
  [
    "ooooo",
    "o----",
    "o--oo",
    "o---o",
    "ooooo",
  ],
];

fn main() {
  input! {
    A: [[i32; 5]; 5],
    N: usize,
    B: [i32; N],
  }
  let mut bingo = [[false; 5]; 5];
  bingo[2][2] = true;
  for B_i in B {
    for i in 0..5 {
      for j in 0..5 {
        if A[i][j] == B_i {
          bingo[i][j] = true;
        }
      }
    }
    let mut ans = 0;
    ans += (0..5).filter(|&i| {
      (0..5).all(|j| bingo[i][j])
    }).count();
    ans += (0..5).filter(|&i| {
      (0..5).all(|j| bingo[j][i])
    }).count();
    ans += (0..5).all(|i| bingo[i][i]) as usize;
    ans += (0..5).all(|i| bingo[i][4 - i]) as usize;
    ans += TSG.iter()
    .filter(|C| {
      C.iter().enumerate().all(|(i, D)| {
        D.chars().enumerate().all(|(j, c)| {
          c == '-' || bingo[i][j]
        })
      })
    })
    .count();
    println!("{ans}");
  }
}
0