結果

問題 No.1623 三角形の制作
ユーザー bal4ubal4u
提出日時 2021-08-10 19:48:24
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 916 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 30,288 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 05:03:54
合計ジャッジ時間 1,761 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 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 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'in':
main.c:7:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
    7 | #define gc() getchar_unlocked()
      |              ^~~~~~~~~~~~~~~~
main.c:11:28: note: in expansion of macro 'gc'
   11 |         int n = 0; int c = gc();
      |                            ^~
main.c: In function 'out':
main.c:8:15: warning: implicit declaration of function 'putchar_unlocked' [-Wimplicit-function-declaration]
    8 | #define pc(c) putchar_unlocked(c)
      |               ^~~~~~~~~~~~~~~~
main.c:18:17: note: in expansion of macro 'pc'
   18 |         if (!n) pc('0');
      |                 ^~

ソースコード

diff #

// 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