結果

問題 No.586 ダブルブッキング
ユーザー uafr_csuafr_cs
提出日時 2017-11-03 22:22:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 619 bytes
コンパイル時間 3,671 ms
コンパイル使用メモリ 72,176 KB
実行使用メモリ 55,812 KB
最終ジャッジ日時 2023-08-14 16:51:13
合計ジャッジ時間 3,850 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,812 KB
testcase_01 AC 124 ms
55,284 KB
testcase_02 AC 124 ms
55,684 KB
testcase_03 AC 134 ms
55,620 KB
testcase_04 AC 123 ms
55,700 KB
testcase_05 AC 136 ms
55,792 KB
testcase_06 AC 122 ms
55,620 KB
testcase_07 AC 123 ms
55,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static long MOD = 1000000007;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final long P1 = sc.nextLong();
		final long P2 = sc.nextLong();
		
		long answer = 0;
		
		final int N = sc.nextInt();
		HashSet<Integer> already = new HashSet<Integer>();
		for(int i = 0; i < N; i++){
			final int R = sc.nextInt();
			
			if(already.contains(R)){
				answer += P1 + P2;
			}else{
				already.add(R);
			}
		}
		
		System.out.println(answer);
	}
}
0