結果

問題 No.1623 三角形の制作
ユーザー 夜
提出日時 2021-07-23 21:45:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,087 bytes
コンパイル時間 954 ms
コンパイル使用メモリ 94,980 KB
実行使用メモリ 150,928 KB
最終ジャッジ日時 2023-09-25 21:39:19
合計ジャッジ時間 7,935 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 178 ms
144,152 KB
testcase_01 AC 174 ms
148,408 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 AC 216 ms
148,404 KB
testcase_13 AC 226 ms
148,280 KB
testcase_14 AC 223 ms
148,340 KB
testcase_15 AC 298 ms
149,176 KB
testcase_16 AC 299 ms
149,052 KB
testcase_17 AC 301 ms
148,844 KB
testcase_18 AC 320 ms
149,020 KB
testcase_19 AC 227 ms
148,332 KB
testcase_20 AC 176 ms
148,408 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;
#define int long long
int r[200020], g[200020], b[200020];
int co1[3030], co2[3030], co3[3030];
int sum[3030][6060] = {};
signed 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