結果
| 問題 | No.133 カードゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-06 15:04:41 |
| 言語 | Rust (1.99.0 + proconio + num + itertools + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 0 ms / 5,000 ms |
| + 825µs | |
| コード長 | 802 bytes |
| 記録 | |
| コンパイル時間 | 7,243 ms |
| コンパイル使用メモリ | 185,432 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-10-06 15:04:55 |
| 合計ジャッジ時間 | 6,521 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
use itertools::{Itertools, iproduct};
use proconio::input;
// https://maguro.dev/blog/debug-macro/
#[allow(unused_macros)]
macro_rules! debug {
($($a:expr),* $(,)*) => {
#[cfg(debug_assertions)]
eprintln!(concat!($("| ", stringify!($a), " = {:?} "),*, "|"), $(&$a),*);
};
}
fn main() {
input! {
n: usize,
a: [usize; n],
b: [usize; n]
}
let mut all = 0;
let mut win = 0;
for (u, v) in iproduct!(a.iter().permutations(n), b.iter().permutations(n)) {
let mut cnt = 0;
for i in 0..n {
if u[i] > v[i] {
cnt += 1;
}
}
win += (n / 2 < cnt) as usize;
all += 1;
}
debug!(all, win);
let res = (win as f64) / (all as f64);
println!("{res}");
}