結果

問題 No.200 カードファイト!
ユーザー kenkooookenkoooo
提出日時 2015-04-29 00:53:41
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,026 bytes
コンパイル時間 3,476 ms
コンパイル使用メモリ 76,820 KB
実行使用メモリ 55,816 KB
最終ジャッジ日時 2023-09-19 03:30:51
合計ジャッジ時間 7,797 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
55,816 KB
testcase_01 AC 137 ms
55,496 KB
testcase_02 AC 130 ms
55,712 KB
testcase_03 AC 129 ms
55,772 KB
testcase_04 AC 130 ms
55,644 KB
testcase_05 WA -
testcase_06 AC 133 ms
55,672 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 129 ms
55,712 KB
testcase_11 AC 135 ms
55,456 KB
testcase_12 AC 130 ms
55,336 KB
testcase_13 AC 130 ms
55,220 KB
testcase_14 AC 130 ms
55,680 KB
testcase_15 AC 133 ms
55,508 KB
testcase_16 AC 127 ms
55,512 KB
testcase_17 AC 132 ms
55,648 KB
testcase_18 AC 130 ms
55,620 KB
testcase_19 AC 132 ms
55,212 KB
testcase_20 AC 129 ms
55,552 KB
testcase_21 AC 131 ms
55,468 KB
testcase_22 AC 132 ms
55,568 KB
testcase_23 AC 133 ms
55,508 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 134 ms
55,808 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int[] cardA = new int[A];
		for (int i = 0; i < cardA.length; i++) {
			cardA[i] = sc.nextInt();
		}
		int C = sc.nextInt();
		int[] cardC = new int[C];
		for (int i = 0; i < cardC.length; i++) {
			cardC[i] = sc.nextInt();
		}
		sc.close();

		Arrays.sort(cardA);
		Arrays.sort(cardC);

		boolean[] usedA = new boolean[A];

		int ans = 0;
		for (int n = 0; n < N; n++) {
			int curC = n % C;
			if (n % A == 0) {
				Arrays.fill(usedA, false);
			}

			boolean used = false;
			for (int i = 0; i < usedA.length; i++) {
				if (!usedA[i] && cardA[i] > cardC[curC]) {
					used = true;
					usedA[i] = true;
					break;
				}
			}
			if (used) {
				ans++;
				continue;
			}

			for (int i = 0; i < usedA.length; i++) {
				if (!usedA[i]) {
					usedA[i] = true;
					break;
				}
			}
		}
		System.out.println(ans);
	}

}
0