結果
問題 | No.1623 三角形の制作 |
ユーザー | tenten |
提出日時 | 2021-07-26 20:42:50 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 446 ms / 2,000 ms |
コード長 | 1,548 bytes |
コンパイル時間 | 4,939 ms |
コンパイル使用メモリ | 74,000 KB |
実行使用メモリ | 64,332 KB |
最終ジャッジ日時 | 2023-09-29 17:48:40 |
合計ジャッジ時間 | 11,559 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 63 ms
51,444 KB |
testcase_01 | AC | 63 ms
51,160 KB |
testcase_02 | AC | 361 ms
57,632 KB |
testcase_03 | AC | 344 ms
60,092 KB |
testcase_04 | AC | 314 ms
57,920 KB |
testcase_05 | AC | 445 ms
62,084 KB |
testcase_06 | AC | 187 ms
55,168 KB |
testcase_07 | AC | 367 ms
60,428 KB |
testcase_08 | AC | 209 ms
54,068 KB |
testcase_09 | AC | 340 ms
60,068 KB |
testcase_10 | AC | 364 ms
60,088 KB |
testcase_11 | AC | 361 ms
58,008 KB |
testcase_12 | AC | 254 ms
56,236 KB |
testcase_13 | AC | 302 ms
57,868 KB |
testcase_14 | AC | 293 ms
56,976 KB |
testcase_15 | AC | 374 ms
59,972 KB |
testcase_16 | AC | 361 ms
59,560 KB |
testcase_17 | AC | 361 ms
58,280 KB |
testcase_18 | AC | 446 ms
64,332 KB |
testcase_19 | AC | 302 ms
57,528 KB |
testcase_20 | AC | 62 ms
51,640 KB |
ソースコード
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int[] rCount = new int[3001]; for (int i = 0; i < n; i++) { rCount[sc.nextInt()]++; } int[] bCount = new int[3001]; for (int i = 0; i < n; i++) { bCount[sc.nextInt()]++; } int[] gCount = new int[3001]; for (int i = 0; i < n; i++) { gCount[sc.nextInt()]++; } int[] gSum = new int[3001]; for (int i = 1; i < 3001; i++) { gSum[i] = gCount[i] + gSum[i - 1]; } long ans = 0; for (int r = 1; r < 3001; r++) { for (int b = 1; b <= r; b++) { int min = r - b; ans += (long)(gSum[r] - gSum[min]) * rCount[r] * bCount[b]; } } System.out.println(ans); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }