結果
問題 | No.1172 Add Recursive Sequence |
ユーザー | akakimidori |
提出日時 | 2021-05-06 02:37:17 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,489 bytes |
コンパイル時間 | 13,359 ms |
コンパイル使用メモリ | 383,700 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 19:01:10 |
合計ジャッジ時間 | 33,585 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
コンパイルメッセージ
warning: unused variable: `l` --> src/main.rs:48:10 | 48 | for (l, r) in p { | ^ help: if this is intentional, prefix it with an underscore: `_l` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `r` --> src/main.rs:48:13 | 48 | for (l, r) in p { | ^ help: if this is intentional, prefix it with an underscore: `_r`
ソースコード
fn read() -> (usize, Vec<u64>, Vec<u64>, Vec<(usize, usize)>) { let mut s = String::new(); use std::io::Read; std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let mut next = || it.next().unwrap().parse::<usize>().unwrap(); let k = next(); let n = next(); let m = next(); let mut a = vec![0; k]; for a in a.iter_mut() { *a = next() as u64; } let mut c = vec![0; k]; for c in c.iter_mut() { *c = next() as u64; } let mut p = vec![(0, 0); m]; for p in p.iter_mut() { p.0 = next(); p.1 = next(); } (n, a, c, p) } #[target_feature(enable = "avx2")] unsafe fn add(a: &mut [u64], b: &[u64]) { for (a, b) in a.iter_mut().zip(b) { *a += *b; } } fn run() { let (n, a, c, p) = read(); const MOD: u64 = 1_000_000_007; let mut dp = vec![0; n.max(a.len())]; for (i, a) in a.iter().enumerate() { dp[i] = *a; } for i in a.len()..n { let mut s = 0; for (dp, c) in dp[..i].iter().rev().zip(&c) { s = (s + *c * *dp) % MOD; } dp[i] = s; } let mut ans = vec![0; n]; for (l, r) in p { unsafe { add(&mut ans, &dp); } } use std::io::Write; let out = std::io::stdout(); let mut out = std::io::BufWriter::new(out.lock()); for a in ans { writeln!(out, "{}", a % MOD).ok(); } } fn main() { run(); }