結果
問題 | No.1623 三角形の制作 |
ユーザー | silversmith |
提出日時 | 2021-07-25 19:08:24 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 1,360 bytes |
コンパイル時間 | 15,014 ms |
コンパイル使用メモリ | 382,460 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2024-07-21 03:37:19 |
合計ジャッジ時間 | 15,984 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
6,812 KB |
testcase_01 | AC | 15 ms
6,816 KB |
testcase_02 | AC | 37 ms
11,648 KB |
testcase_03 | AC | 36 ms
11,136 KB |
testcase_04 | AC | 35 ms
11,136 KB |
testcase_05 | AC | 52 ms
18,688 KB |
testcase_06 | AC | 21 ms
6,944 KB |
testcase_07 | AC | 36 ms
11,264 KB |
testcase_08 | AC | 21 ms
6,940 KB |
testcase_09 | AC | 35 ms
10,496 KB |
testcase_10 | AC | 46 ms
15,872 KB |
testcase_11 | AC | 39 ms
12,800 KB |
testcase_12 | AC | 26 ms
7,552 KB |
testcase_13 | AC | 28 ms
8,704 KB |
testcase_14 | AC | 27 ms
8,448 KB |
testcase_15 | AC | 46 ms
18,560 KB |
testcase_16 | AC | 46 ms
18,432 KB |
testcase_17 | AC | 46 ms
18,432 KB |
testcase_18 | AC | 48 ms
19,072 KB |
testcase_19 | AC | 31 ms
11,008 KB |
testcase_20 | AC | 15 ms
6,944 KB |
コンパイルメッセージ
warning: unused import: `std::collections::HashMap` --> src/main.rs:1:5 | 1 | use std::collections::HashMap; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
ソースコード
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:i64=n[0].parse().unwrap(); let r=getline(); let r:Vec<_>=r.trim().split(' ').collect(); let r:Vec<i64>=r.iter().map(|v| v.parse().unwrap()).collect(); let g=getline(); let g:Vec<_>=g.trim().split(' ').collect(); let g:Vec<i64>=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<i64>=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:i64=0; let mut ar = vec![0; 3001]; 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; 3001]; aar[0] = ar[0]; for i in 1..3001 { aar[i as usize] = aar[(i-1) as usize] + ar[i]; } for j in 1..3001 { for k in 1..3001 { let bi = std::cmp::min(j + k -1, 3000); let si = std::cmp::max(j,k) -1; let add = (aar[bi] - aar[si]) * ag[j as usize] * ab[k as usize]; ans = ans + add; } } println!("{}", ans) }