結果
問題 | No.1623 三角形の制作 |
ユーザー | silversmith |
提出日時 | 2021-07-25 11:54:23 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,426 bytes |
コンパイル時間 | 13,060 ms |
コンパイル使用メモリ | 378,452 KB |
実行使用メモリ | 16,512 KB |
最終ジャッジ日時 | 2024-07-20 19:46:37 |
合計ジャッジ時間 | 15,288 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 25 ms
5,376 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
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 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 25 ms
5,376 KB |
コンパイルメッセージ
warning: unused import: `std::collections::HashMap` --> src/main.rs:1:5 | 1 | use std::collections::HashMap; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unnecessary parentheses around `if` condition --> src/main.rs:52:7 | 52 | if (aar[bi] == 0){ | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 52 - if (aar[bi] == 0){ 52 + if aar[bi] == 0 { | warning: unnecessary parentheses around `if` condition --> src/main.rs:55:7 | 55 | if (aar[si] == 0){ | ^ ^ | help: remove these parentheses | 55 - if (aar[si] == 0){ 55 + if aar[si] == 0 { |
ソースコード
use std::collections::HashMap; fn getline() -> String{ let mut __ret=String::new(); std::io::stdin().read_line(&mut __ret).ok(); return __ret; } fn main() { let n=getline(); let n:Vec<_>=n.trim().split(' ').collect(); let n:i32=n[0].parse().unwrap(); let r=getline(); let r:Vec<_>=r.trim().split(' ').collect(); let r:Vec<i32>=r.iter().map(|v| v.parse().unwrap()).collect(); let g=getline(); let g:Vec<_>=g.trim().split(' ').collect(); let g:Vec<i32>=g.iter().map(|v| v.parse().unwrap()).collect(); let mut ag = vec![0; 3001]; for i in 0..n { ag[g[i as usize] as usize] = ag[g[i as usize] as usize] + 1; } let b=getline(); let b:Vec<_>=b.trim().split(' ').collect(); let b:Vec<i32>=b.iter().map(|v| v.parse().unwrap()).collect(); let mut ab = vec![0; 3001]; for i in 0..n { ab[b[i as usize] as usize] = ab[b[i as usize] as usize] + 1; } let mut ans:i32=0; let mut ar = vec![0; 6002]; for i in 0..n { ar[r[i as usize] as usize] = ar[r[i as usize] as usize] + 1; } let mut aar = vec![0; 6002]; aar[0] = ar[0]; for i in 1..6002 { aar[i as usize] = aar[(i-1) as usize] + ar[i]; } for j in 1..3001 { for k in 1..3001 { let bi = j + k -1; let si = std::cmp::max(j,k) -1; if (aar[bi] == 0){ continue; } if (aar[si] == 0){ continue; } let add = (aar[bi] - aar[si]) * ag[j as usize] * ab[k as usize]; ans = ans + add; } } println!("{}", ans) }