結果

問題 No.1623 三角形の制作
ユーザー atjh16atjh16
提出日時 2021-09-07 20:01:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 1,451 ms
コンパイル使用メモリ 165,160 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 12:19:50
合計ジャッジ時間 4,134 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 67 ms
4,380 KB
testcase_03 AC 65 ms
4,376 KB
testcase_04 AC 63 ms
4,376 KB
testcase_05 AC 111 ms
4,380 KB
testcase_06 AC 20 ms
4,384 KB
testcase_07 AC 64 ms
4,380 KB
testcase_08 AC 23 ms
4,376 KB
testcase_09 AC 59 ms
4,384 KB
testcase_10 AC 93 ms
4,380 KB
testcase_11 AC 73 ms
4,376 KB
testcase_12 AC 34 ms
4,376 KB
testcase_13 AC 41 ms
4,376 KB
testcase_14 AC 40 ms
4,380 KB
testcase_15 AC 98 ms
4,380 KB
testcase_16 AC 101 ms
4,380 KB
testcase_17 AC 97 ms
4,384 KB
testcase_18 AC 118 ms
4,376 KB
testcase_19 AC 41 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int n, t;
long long r[3001], g[3001], b[3001];
long long m = 0;

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> t;
		r[t]++;
	}

	for (int i = 0; i < n; i++) {
		cin >> t;
		g[t]++;
	}

	for (int i = 0; i < n; i++) {
		cin >> t;
		b[t]++;
	}

	for (int i = 1; i <= 3000; i++) {
		b[i] = b[i] + b[i - 1];
	}

	for (int i = 1; i <= 3000; i++) {
		if (r[i] > 0) {
			for (int j = 1; j <= i; j++) {
				m += r[i] * g[j] * (b[i] - b[i - j]);
			}
		}
	}

	cout << m << endl;
}
0