結果

問題 No.1623 三角形の制作
ユーザー 夜
提出日時 2021-07-23 21:44:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,062 bytes
コンパイル時間 933 ms
コンパイル使用メモリ 94,548 KB
実行使用メモリ 77,092 KB
最終ジャッジ日時 2023-09-25 21:38:54
合計ジャッジ時間 6,951 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int r[200020], g[200020], b[200020];
int co1[3030], co2[3030], co3[3030];
int sum[3030][6060] = {};
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> r[i];
		co1[r[i]]++;
	}
	sort(r, r + n);
	for (int i = 0; i < n; i++) {
		cin >> g[i];
		co2[g[i]]++;
	}
	sort(g, g + n);
	for (int i = 0; i < n; i++) {
		cin >> b[i];
		co3[b[i]]++;
	}
	sort(b, b + n);
	for (int i = 1; i <= 3000; i++) {
		for (int j = 1; j <= 3000; j++) {
			sum[max(i, j)][i + j] += co2[i] * co3[j];
		}
	}
	for (int i = 1; i <= 3000; i++) {
		for (int j = 2; j <= 3000; j++) {
			sum[i][j] += sum[i][j - 1];
		}
	}
	long long ans = 0;
	for (int i = 1; i <= 3000; i++) {
		for (int j = 1; j <= i; j++) {
			ans += co1[i] * (sum[j][3000] - sum[j][i]);
		}
	}
	cout << ans << endl;
}

0