結果

問題 No.1623 三角形の制作
ユーザー laneguelanegue
提出日時 2021-07-23 22:00:53
言語 D
(dmd 2.105.2)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 1,409 ms
コンパイル使用メモリ 161,264 KB
実行使用メモリ 17,544 KB
最終ジャッジ日時 2023-09-04 13:27:24
合計ジャッジ時間 3,623 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,376 KB
testcase_01 AC 10 ms
4,376 KB
testcase_02 AC 52 ms
10,672 KB
testcase_03 AC 51 ms
12,192 KB
testcase_04 AC 51 ms
11,236 KB
testcase_05 AC 84 ms
16,092 KB
testcase_06 AC 20 ms
5,836 KB
testcase_07 AC 48 ms
8,072 KB
testcase_08 AC 21 ms
6,352 KB
testcase_09 AC 48 ms
12,164 KB
testcase_10 AC 71 ms
14,728 KB
testcase_11 AC 57 ms
13,088 KB
testcase_12 AC 30 ms
7,732 KB
testcase_13 AC 37 ms
9,968 KB
testcase_14 AC 34 ms
7,808 KB
testcase_15 AC 71 ms
15,380 KB
testcase_16 AC 72 ms
15,332 KB
testcase_17 AC 72 ms
15,320 KB
testcase_18 AC 82 ms
17,544 KB
testcase_19 AC 38 ms
11,192 KB
testcase_20 AC 10 ms
4,380 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 ulong[MAX + 1];
	auto gcount = new ulong[MAX + 1];
	auto bsum = new ulong[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 = 0UL;
	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