結果

問題 No.1623 三角形の制作
コンテスト
ユーザー bal4u
提出日時 2021-08-10 19:48:24
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 916 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 203 ms
コンパイル使用メモリ 39,492 KB
最終ジャッジ日時 2026-02-22 07:47:44
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// yuki 1623 三角形の制作
// 2021.8.10

#include <stdio.h>

typedef long long ll;
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)

int in() {   // 非負整数の入力
	int n = 0; int c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}
void out(ll n) { // 非負整数の表示(出力)
	int i; char b[30];

	if (!n) pc('0');
	else {
		//		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

const int max = 3000;
int N;
int r[3005], g[3005], b[3005];

int main() {
	int i, j, ans = 0;

	N = in();
	for (i = 0; i < N; ++i) r[in()]++;
	for (i = 0; i < N; ++i) g[in()]++;
	for (i = 0; i < N; ++i) b[in()]++;
	for (i = 1; i <= max; ++i) b[i] += b[i-1];
	for (i = 1; i <= max; ++i) if (r[i]) {
		for (j = 1; j <= i; ++j) if (g[j]) {
			ans += r[i]*g[j]*(b[i]-b[i-j]);
		}
	}
	out(ans);
	return 0;
}
0