結果
問題 | No.1141 田グリッド |
ユーザー | tonyu0 |
提出日時 | 2020-07-31 23:18:18 |
言語 | Rust (1.77.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,286 bytes |
コンパイル時間 | 1,360 ms |
コンパイル使用メモリ | 148,624 KB |
実行使用メモリ | 7,096 KB |
最終ジャッジ日時 | 2023-09-21 02:45:34 |
合計ジャッジ時間 | 3,400 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
コンパイルメッセージ
warning: unused import: `std::cmp::*` --> Main.rs:1:5 | 1 | use std::cmp::*; | ^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: 1 warning emitted
ソースコード
use std::cmp::*; use std::io::*; const MOD: u64 = 1_000_000_007; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let h: usize = itr.next().unwrap().parse().unwrap(); let w: usize = itr.next().unwrap().parse().unwrap(); let mut a = vec![vec![0u64; w]; h]; let mut row = vec![0; h]; let mut col = vec![0; w]; let mut ans = 1u64; for i in 0..h { for j in 0..w { a[i][j] = itr.next().unwrap().parse().unwrap(); ans = ans * a[i][j]; } } for i in 0..h { let mut tmp = 1; for j in 0..w { tmp = tmp * a[i][j]; } row[i] = tmp; } for j in 0..w { let mut tmp = 1; for i in 0..h { tmp = tmp * a[i][j]; } col[j] = tmp; } let mut out = Vec::new(); let q: usize = itr.next().unwrap().parse().unwrap(); for _ in 0..q { let r: usize = itr.next().unwrap().parse::<usize>().unwrap() - 1; let c: usize = itr.next().unwrap().parse::<usize>().unwrap() - 1; let now = ans / (row[r] / a[r][c]) / col[c] % MOD; writeln!(out, "{}", now).ok(); } stdout().write_all(&out).unwrap(); }