結果
| 問題 |
No.2374 ASKT Subsequences
|
| コンテスト | |
| ユーザー |
とろちゃ
|
| 提出日時 | 2023-07-07 22:52:48 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,465 bytes |
| コンパイル時間 | 13,715 ms |
| コンパイル使用メモリ | 393,640 KB |
| 実行使用メモリ | 33,280 KB |
| 最終ジャッジ日時 | 2024-07-21 19:08:41 |
| 合計ジャッジ時間 | 21,043 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 TLE * 1 |
ソースコード
#![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);
}
とろちゃ