結果
問題 | No.1623 三角形の制作 |
ユーザー | gorugo30 |
提出日時 | 2021-05-05 22:13:59 |
言語 | Java21 (openjdk 21) |
結果 |
MLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,435 bytes |
コンパイル時間 | 4,294 ms |
コンパイル使用メモリ | 74,228 KB |
実行使用メモリ | 535,000 KB |
最終ジャッジ日時 | 2023-09-25 20:37:36 |
合計ジャッジ時間 | 30,764 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 594 ms
451,456 KB |
testcase_01 | AC | 592 ms
451,388 KB |
testcase_02 | AC | 1,434 ms
454,432 KB |
testcase_03 | MLE | - |
testcase_04 | AC | 1,436 ms
456,248 KB |
testcase_05 | AC | 1,532 ms
457,236 KB |
testcase_06 | AC | 1,374 ms
464,068 KB |
testcase_07 | MLE | - |
testcase_08 | AC | 1,372 ms
456,436 KB |
testcase_09 | AC | 1,411 ms
456,136 KB |
testcase_10 | AC | 1,525 ms
454,296 KB |
testcase_11 | MLE | - |
testcase_12 | MLE | - |
testcase_13 | AC | 1,043 ms
463,804 KB |
testcase_14 | AC | 1,025 ms
456,940 KB |
testcase_15 | MLE | - |
testcase_16 | AC | 1,304 ms
472,588 KB |
testcase_17 | AC | 1,189 ms
456,556 KB |
testcase_18 | AC | 1,249 ms
457,152 KB |
testcase_19 | AC | 1,046 ms
454,880 KB |
testcase_20 | AC | 593 ms
451,444 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 = 5000; int n = Integer.parseInt(sc.next()); 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 = Integer.parseInt(sc.next()); Rcnt[x]++; } for (int i = 0; i < n; i++){ x = Integer.parseInt(sc.next()); Gcnt[x]++; } for (int i = 0; i < n; i++){ x = Integer.parseInt(sc.next()); Bcnt[x]++; } long C[][] = new long[M + 2][2 * M + 2]; for (int i = 1; i <= M; i++){ if (Gcnt[i] == 0) continue; 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); } }