結果

問題 No.200 カードファイト!
ユーザー ぴろずぴろず
提出日時 2015-04-29 00:46:39
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,204 bytes
コンパイル時間 2,846 ms
コンパイル使用メモリ 81,372 KB
実行使用メモリ 56,344 KB
最終ジャッジ日時 2023-09-19 03:02:49
合計ジャッジ時間 8,122 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 132 ms
55,648 KB
testcase_04 AC 131 ms
56,200 KB
testcase_05 AC 134 ms
55,428 KB
testcase_06 AC 137 ms
55,860 KB
testcase_07 AC 141 ms
55,688 KB
testcase_08 AC 135 ms
55,896 KB
testcase_09 WA -
testcase_10 AC 131 ms
55,868 KB
testcase_11 AC 136 ms
55,404 KB
testcase_12 AC 131 ms
55,696 KB
testcase_13 AC 133 ms
56,008 KB
testcase_14 AC 130 ms
55,408 KB
testcase_15 AC 133 ms
55,692 KB
testcase_16 AC 131 ms
55,660 KB
testcase_17 AC 134 ms
55,880 KB
testcase_18 AC 136 ms
55,684 KB
testcase_19 AC 132 ms
55,596 KB
testcase_20 AC 130 ms
55,588 KB
testcase_21 AC 135 ms
55,684 KB
testcase_22 AC 136 ms
56,344 KB
testcase_23 AC 138 ms
56,060 KB
testcase_24 WA -
testcase_25 AC 128 ms
55,704 KB
testcase_26 AC 132 ms
55,664 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

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);
			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);
	}
	static class Int {
		int i,n;
		public Int(int i,int n) {

		}
	}
}
0