結果

問題 No.200 カードファイト!
ユーザー ぴろずぴろず
提出日時 2015-04-29 00:47:57
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,139 bytes
コンパイル時間 2,758 ms
コンパイル使用メモリ 77,144 KB
実行使用メモリ 56,424 KB
最終ジャッジ日時 2023-09-19 03:08:16
合計ジャッジ時間 8,104 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
55,308 KB
testcase_01 AC 135 ms
55,404 KB
testcase_02 AC 127 ms
55,276 KB
testcase_03 AC 127 ms
55,332 KB
testcase_04 AC 128 ms
55,120 KB
testcase_05 AC 134 ms
55,140 KB
testcase_06 AC 134 ms
55,528 KB
testcase_07 AC 137 ms
55,428 KB
testcase_08 AC 134 ms
55,304 KB
testcase_09 WA -
testcase_10 AC 134 ms
55,188 KB
testcase_11 AC 133 ms
55,464 KB
testcase_12 AC 129 ms
55,596 KB
testcase_13 AC 128 ms
55,212 KB
testcase_14 AC 128 ms
53,672 KB
testcase_15 AC 133 ms
55,256 KB
testcase_16 AC 130 ms
55,140 KB
testcase_17 AC 133 ms
55,560 KB
testcase_18 AC 132 ms
55,400 KB
testcase_19 AC 132 ms
55,520 KB
testcase_20 AC 129 ms
55,152 KB
testcase_21 AC 132 ms
55,236 KB
testcase_22 AC 135 ms
55,584 KB
testcase_23 AC 135 ms
55,512 KB
testcase_24 WA -
testcase_25 AC 132 ms
55,844 KB
testcase_26 AC 135 ms
55,408 KB
testcase_27 WA -
testcase_28 AC 137 ms
55,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* 分からず */

package no200;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
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[] b = new int[a];
		for(int i=0;i<a;i++) {
			b[i] = sc.nextInt();
		}
		int c = sc.nextInt();
		int[] d = new int[c];
		for(int i=0;i<c;i++) {
			d[i] = sc.nextInt();
		}
		Arrays.sort(b);
		Arrays.sort(d);
		ArrayList<Integer> handA = new ArrayList<>();
		ArrayList<Integer> handB = new ArrayList<>();
		int ans = 0;
		for(int i=0;i<n;i++) {
			if (handA.isEmpty()) {
				for(int j=0;j<a;j++) {
					handA.add(b[j]);
				}
			}
			if (handB.isEmpty()) {
				for(int j=0;j<c;j++) {
					handB.add(d[j]);
				}
			}
			int low = handB.get(0);
			int ceilI = Collections.binarySearch(handA, low+1);
			if (ceilI < 0) {
				ceilI = ~ceilI;
			}
			if (ceilI >= handA.size()) {
				handA.remove(0);
				handB.remove(handB.size()-1);
			}else{
				handA.remove(ceilI);
				handB.remove(0);
				ans++;
			}
		}
		System.out.println(ans);
	}
}
0