結果
| 問題 |
No.2374 ASKT Subsequences
|
| コンテスト | |
| ユーザー |
とろちゃ
|
| 提出日時 | 2023-07-07 22:57:06 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1,551 ms / 2,000 ms |
| コード長 | 1,444 bytes |
| コンパイル時間 | 14,489 ms |
| コンパイル使用メモリ | 378,940 KB |
| 実行使用メモリ | 33,280 KB |
| 最終ジャッジ日時 | 2024-07-21 19:14:08 |
| 合計ジャッジ時間 | 21,280 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(clippy::needless_range_loop)]
#![allow(clippy::comparison_chain)]
#![allow(clippy::nonminimal_bool)]
#![allow(clippy::neg_multiply)]
#![allow(dead_code)]
// use itertools::Itertools;
// use std::collections::{BTreeSet, HashSet, VecDeque};
// use std::f64::consts::PI;
// use proconio::fastout;
// use proconio::*;
// use std::cmp::{max, min};
macro_rules! input(($($tt:tt)*) => (
let stdin = std::io::stdin();
let mut stdin = proconio::source::line::LineSource::new(std::io::BufReader::new(stdin));
proconio::input!(from &mut stdin, $($tt)*);
));
// #[fastout]
fn main() {
input! {
n: usize,
a: [usize; n],
}
let mut countList: Vec<Vec<usize>> = vec![vec![0; 2001]; n];
for i in (0..n).rev() {
for j in 0..2001 {
if i < n - 1 {
countList[i][j] = countList[i + 1][j];
}
}
countList[i][a[i]] += 1;
}
let mut ans = 0;
for i in 0..n {
for j in i + 1..n {
if (a[j] as i128) - (a[i] as i128) - 10 <= 0 {
continue;
}
let diff = a[j] - a[i] - 10;
for k in j + 1..n {
if (a[k] == a[j] - diff) && (a[k] + diff + 1 < 2001) {
ans += countList[k][a[k] + diff + 1];
}
}
}
}
println!("{}", ans);
}
とろちゃ