結果

問題 No.11 カードマッチ
ユーザー core123core123
提出日時 2019-04-18 14:53:26
言語 Java19
(openjdk 21)
結果
AC  
実行時間 156 ms / 5,000 ms
コード長 996 bytes
コンパイル時間 3,402 ms
コンパイル使用メモリ 79,132 KB
実行使用メモリ 57,768 KB
最終ジャッジ日時 2023-10-22 08:13:50
合計ジャッジ時間 7,908 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
57,348 KB
testcase_01 AC 132 ms
57,284 KB
testcase_02 AC 131 ms
57,296 KB
testcase_03 AC 135 ms
57,504 KB
testcase_04 AC 145 ms
57,736 KB
testcase_05 AC 138 ms
57,352 KB
testcase_06 AC 147 ms
57,768 KB
testcase_07 AC 148 ms
57,284 KB
testcase_08 AC 147 ms
57,276 KB
testcase_09 AC 152 ms
57,576 KB
testcase_10 AC 143 ms
57,336 KB
testcase_11 AC 156 ms
57,536 KB
testcase_12 AC 145 ms
57,300 KB
testcase_13 AC 145 ms
57,316 KB
testcase_14 AC 150 ms
57,624 KB
testcase_15 AC 152 ms
57,548 KB
testcase_16 AC 150 ms
57,272 KB
testcase_17 AC 152 ms
57,296 KB
testcase_18 AC 148 ms
57,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.stream.*;
import static java.lang.Math.*;
public class Main{
	public static void main(String... args){
		Scanner sc=new Scanner(System.in);
		int w=sc.nextInt();
		int h=sc.nextInt();
		int n=sc.nextInt();
		Set<Integer> sSet=new HashSet<>();
		Set<Integer> kSet=new HashSet<>();
		for(int i=0;i<n;i++){
			sSet.add(sc.nextInt());
			kSet.add(sc.nextInt());
		}
		long ans=0;
		ans+=sSet.size()*h;
		ans+=kSet.size()*w;
		ans-=sSet.size()*kSet.size();
		ans-=n;
		put(ans);
		
	}
	public static void print(Object object){
        System.out.print(object);
    }
    public static void put(Object object) {
        System.out.println(object);
    }
    public static void put(){
        System.out.println();
    }
 
    public static void print(String format,Object... args){
        System.out.print(String.format(format,args));
    }
    public static void put(String format,Object... args) {
        System.out.println(String.format(format,args));
    }
}
0