結果

問題 No.2517 Right Triangles on Circle
ユーザー ikomaikoma
提出日時 2023-10-27 22:34:34
言語 Rust
(1.77.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 966 bytes
コンパイル時間 2,355 ms
コンパイル使用メモリ 189,916 KB
実行使用メモリ 8,872 KB
最終ジャッジ日時 2023-10-27 22:34:40
合計ジャッジ時間 4,424 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 0 ms
4,372 KB
testcase_02 AC 1 ms
4,372 KB
testcase_03 AC 1 ms
4,372 KB
testcase_04 AC 1 ms
4,372 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 1 ms
4,372 KB
testcase_07 AC 1 ms
4,372 KB
testcase_08 AC 1 ms
4,372 KB
testcase_09 AC 0 ms
4,372 KB
testcase_10 AC 1 ms
4,372 KB
testcase_11 AC 1 ms
4,372 KB
testcase_12 AC 0 ms
4,372 KB
testcase_13 AC 36 ms
8,872 KB
testcase_14 AC 15 ms
6,368 KB
testcase_15 AC 38 ms
8,872 KB
testcase_16 AC 37 ms
8,872 KB
testcase_17 AC 30 ms
8,448 KB
testcase_18 AC 32 ms
6,012 KB
testcase_19 AC 27 ms
5,808 KB
testcase_20 AC 28 ms
5,828 KB
testcase_21 AC 38 ms
8,856 KB
testcase_22 AC 6 ms
4,372 KB
testcase_23 AC 29 ms
5,908 KB
testcase_24 AC 13 ms
4,372 KB
testcase_25 AC 5 ms
4,372 KB
testcase_26 AC 32 ms
8,504 KB
testcase_27 AC 5 ms
4,372 KB
testcase_28 AC 6 ms
4,372 KB
testcase_29 AC 14 ms
4,372 KB
testcase_30 AC 8 ms
4,372 KB
testcase_31 AC 27 ms
5,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused_imports, dead_code, unused_macros, unused_variables, non_snake_case, unused_parens)]
use std::cmp::{min,max,Ordering,Reverse};
use std::mem::swap;
use std::collections::{VecDeque,LinkedList,HashMap,BTreeMap,HashSet,BTreeSet,BinaryHeap};



fn main() {
	let (n, m): (i64,i64) = {
		let mut line: String = String::new();
		std::io::stdin().read_line(&mut line).unwrap();
		let mut iter = line.split_whitespace();
		(
			iter.next().unwrap().parse().unwrap(),
			iter.next().unwrap().parse().unwrap()
		)
	};
	let A: Vec<i64> = {
		let mut line: String = String::new();
		std::io::stdin().read_line(&mut line).unwrap();
		line.split_whitespace()
			.map(|x| x.parse().unwrap())
			.collect()
	};
	if m%2==1 {
		println!("0");
		return;
	}
	let b = A.iter().map(|&a| a.rem_euclid(m)).collect::<HashSet<_>>();
	let mut ans = 0;
	let h = m>>1;
	for a in A.iter() {
		if b.contains(&((a+h).rem_euclid(m))) {
			ans += n-2;
		}
	}
	println!("{}", ans>>1);

}
0