結果
問題 | No.1623 三角形の制作 |
ユーザー | gorugo30 |
提出日時 | 2021-05-05 23:36:53 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 1,302 ms / 2,000 ms |
コード長 | 1,335 bytes |
コンパイル時間 | 2,144 ms |
コンパイル使用メモリ | 73,636 KB |
実行使用メモリ | 239,316 KB |
最終ジャッジ日時 | 2023-09-25 20:39:11 |
合計ジャッジ時間 | 25,518 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 430 ms
232,640 KB |
testcase_01 | AC | 430 ms
230,720 KB |
testcase_02 | AC | 1,065 ms
214,144 KB |
testcase_03 | AC | 1,125 ms
214,332 KB |
testcase_04 | AC | 1,024 ms
210,472 KB |
testcase_05 | AC | 1,238 ms
206,980 KB |
testcase_06 | AC | 893 ms
207,204 KB |
testcase_07 | AC | 1,155 ms
211,308 KB |
testcase_08 | AC | 981 ms
207,900 KB |
testcase_09 | AC | 1,108 ms
212,960 KB |
testcase_10 | AC | 1,196 ms
217,372 KB |
testcase_11 | AC | 1,137 ms
236,528 KB |
testcase_12 | AC | 966 ms
214,652 KB |
testcase_13 | AC | 1,073 ms
220,872 KB |
testcase_14 | AC | 1,071 ms
214,896 KB |
testcase_15 | AC | 1,236 ms
206,952 KB |
testcase_16 | AC | 1,234 ms
239,316 KB |
testcase_17 | AC | 1,302 ms
222,216 KB |
testcase_18 | AC | 1,231 ms
214,488 KB |
testcase_19 | AC | 1,094 ms
213,932 KB |
testcase_20 | AC | 429 ms
230,676 KB |
ソースコード
import java.util.*; class Main{ static int max(int x, int y){ return x > y ? x : y; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int M = 3000; int n = sc.nextInt(); int Rcnt[] = new int[M + 1]; int Gcnt[] = new int[M + 1]; int Bcnt[] = new int[M + 1]; int x; for (int i = 0; i < n; i++){ x = sc.nextInt(); Rcnt[x]++; } for (int i = 0; i < n; i++){ x = sc.nextInt(); Gcnt[x]++; } for (int i = 0; i < n; i++){ x = sc.nextInt(); Bcnt[x]++; } long C[][] = new long[M + 2][2 * M + 2]; for (int i = 1; i <= M; i++){ for (int j = 1; j <= M; j++){ C[max(i, j) + 1][i + j + 1] += (long)Gcnt[i] * Bcnt[j]; } } for (int i = 0; i < M + 1; i++){ for (int j = 0; j < 2 * M + 1; j++){ C[i + 1][j + 1] += C[i][j + 1] + C[i + 1][j] - C[i][j]; } } long ans = 0; for (int i = 1; i <= M; i++){ long tmp = C[i + 1][2 * M + 1] + C[1][i + 1] - C[i + 1][i + 1] - C[1][2 * M + 1]; ans += (long)Rcnt[i] * tmp; } System.out.println(ans); } }