結果

問題 No.1623 三角形の制作
ユーザー laneguelanegue
提出日時 2021-07-23 21:57:49
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 619 bytes
コンパイル時間 1,790 ms
コンパイル使用メモリ 161,192 KB
実行使用メモリ 18,016 KB
最終ジャッジ日時 2023-09-04 13:27:20
合計ジャッジ時間 4,277 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
4,376 KB
testcase_01 AC 10 ms
4,380 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 9 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;
int MAX = 3 * 10 ^^ 3;

void main(){
	int n = readln.chomp.to!int;
	auto r = readln.split.to!(int[]);
	auto g = readln.split.to!(int[]);
	auto b = readln.split.to!(int[]);
	auto rcount = new int[MAX + 1];
	auto gcount = new int[MAX + 1];
	auto bsum = new int[MAX + 1];
	foreach(v; r){
		rcount[v] += 1;
	}
	foreach(v; g){
		gcount[v] += 1;
	}
	foreach(v; b){
		bsum[v] += 1;
	}
	for(auto i = 1; i <= MAX; i++){
		bsum[i] += bsum[i-1];
	}
	auto result = 0;
	for(auto i = 1; i <= MAX; i++){
		for(auto j = 1; j <= i; j++){
			result += rcount[i] * gcount[j] * (bsum[i] - bsum[i-j]);
		}
	}
	result.writeln;
}
0