結果
問題 | No.1470 Mex Sum |
ユーザー | ripity |
提出日時 | 2021-12-13 20:44:46 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 555 bytes |
コンパイル時間 | 4,034 ms |
コンパイル使用メモリ | 71,716 KB |
実行使用メモリ | 66,996 KB |
最終ジャッジ日時 | 2023-09-30 02:04:27 |
合計ジャッジ時間 | 37,552 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 123 ms
55,912 KB |
testcase_01 | AC | 122 ms
55,904 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 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | AC | 620 ms
50,520 KB |
testcase_38 | AC | 635 ms
50,472 KB |
testcase_39 | AC | 624 ms
50,084 KB |
testcase_40 | AC | 629 ms
50,328 KB |
testcase_41 | AC | 630 ms
50,556 KB |
testcase_42 | AC | 628 ms
50,876 KB |
testcase_43 | AC | 604 ms
49,556 KB |
testcase_44 | AC | 611 ms
50,560 KB |
testcase_45 | AC | 607 ms
49,520 KB |
testcase_46 | AC | 594 ms
50,080 KB |
testcase_47 | AC | 601 ms
50,020 KB |
testcase_48 | AC | 606 ms
50,152 KB |
testcase_49 | AC | 632 ms
50,372 KB |
testcase_50 | AC | 622 ms
50,592 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long ans = 0; long[] cnt = new long[3]; for( int i = 0; i < N; i++ ) { int a = sc.nextInt()-1; cnt[Math.min(2,a)]++; } ans += cnt[0]*(cnt[0]+cnt[2]-1); ans += cnt[0]*cnt[1]*3; ans += (cnt[1]+cnt[2])*(cnt[1]+cnt[2]-1)/2; System.out.println(ans); } }