結果

問題 No.1623 三角形の制作
ユーザー 小野寺健小野寺健
提出日時 2021-12-20 10:41:44
言語 Go
(1.22.1)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 849 bytes
コンパイル時間 12,316 ms
コンパイル使用メモリ 210,456 KB
実行使用メモリ 7,988 KB
最終ジャッジ日時 2023-10-13 19:29:01
合計ジャッジ時間 16,684 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,372 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 155 ms
7,948 KB
testcase_03 AC 149 ms
7,948 KB
testcase_04 AC 148 ms
7,944 KB
testcase_05 AC 257 ms
7,988 KB
testcase_06 AC 45 ms
4,368 KB
testcase_07 AC 149 ms
7,944 KB
testcase_08 AC 49 ms
5,648 KB
testcase_09 AC 139 ms
7,944 KB
testcase_10 AC 220 ms
7,984 KB
testcase_11 AC 175 ms
7,952 KB
testcase_12 AC 77 ms
5,700 KB
testcase_13 AC 99 ms
7,944 KB
testcase_14 AC 91 ms
7,940 KB
testcase_15 AC 227 ms
7,988 KB
testcase_16 AC 230 ms
7,984 KB
testcase_17 AC 223 ms
7,984 KB
testcase_18 AC 232 ms
7,988 KB
testcase_19 AC 109 ms
5,684 KB
testcase_20 AC 1 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"bufio"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	MAX := 3001
	cnt_r := make([]int, MAX)
	cnt_g := make([]int, MAX)
	cnt_b := make([]int, MAX)
	var n int
	fmt.Fscan(r, &n)
	for i := 0; i < n; i++ {
		var x int
		fmt.Fscan(r, &x)
		cnt_r[x]++
	}
	for i := 0; i < n; i++ {
		var x int
		fmt.Fscan(r, &x)
		cnt_g[x]++
	}
	for i := 0; i < n; i++ {
		var x int
		fmt.Fscan(r, &x)
		cnt_b[x]++
	}
	for i := 1; i < MAX; i++ {
		cnt_r[i] += cnt_r[i-1]
		cnt_g[i] += cnt_g[i-1]
		cnt_b[i] += cnt_b[i-1]
	}
	cnt := 0
	for a := 1; a < MAX; a++ {
		if cnt_r[a] == cnt_r[a-1] {
			continue
		}
		rn := cnt_r[a] - cnt_r[a-1]
		for j := 1; j <= a; j++ {
			gn := cnt_g[j] - cnt_g[j-1]
			bn := cnt_b[a] - cnt_b[a-j]
			cnt += rn * gn * bn
		}
	}
	fmt.Fprintln(w, cnt)
}
0