結果

問題 No.200 カードファイト!
ユーザー ぴろずぴろず
提出日時 2015-04-29 01:29:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 1,144 bytes
コンパイル時間 5,139 ms
コンパイル使用メモリ 78,440 KB
実行使用メモリ 54,336 KB
最終ジャッジ日時 2024-04-23 09:04:38
合計ジャッジ時間 8,564 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
54,056 KB
testcase_01 AC 126 ms
54,336 KB
testcase_02 AC 110 ms
53,344 KB
testcase_03 AC 111 ms
53,212 KB
testcase_04 AC 107 ms
52,712 KB
testcase_05 AC 116 ms
53,372 KB
testcase_06 AC 128 ms
54,116 KB
testcase_07 AC 131 ms
54,128 KB
testcase_08 AC 129 ms
54,184 KB
testcase_09 AC 123 ms
53,980 KB
testcase_10 AC 110 ms
52,880 KB
testcase_11 AC 109 ms
52,992 KB
testcase_12 AC 113 ms
53,440 KB
testcase_13 AC 122 ms
54,200 KB
testcase_14 AC 120 ms
54,148 KB
testcase_15 AC 121 ms
53,756 KB
testcase_16 AC 124 ms
54,284 KB
testcase_17 AC 117 ms
53,516 KB
testcase_18 AC 115 ms
52,936 KB
testcase_19 AC 128 ms
54,220 KB
testcase_20 AC 131 ms
54,336 KB
testcase_21 AC 113 ms
52,752 KB
testcase_22 AC 111 ms
53,120 KB
testcase_23 AC 119 ms
54,128 KB
testcase_24 AC 120 ms
53,924 KB
testcase_25 AC 123 ms
54,160 KB
testcase_26 AC 112 ms
52,932 KB
testcase_27 AC 118 ms
54,000 KB
testcase_28 AC 124 ms
53,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* 分からず */

package no200;

import java.util.ArrayList;
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[] 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;
		LOOP: 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]);
				}
			}
			for(int j=handB.size()-1;j>=0;j--) {
				for(int k=0;k<handA.size();k++) {
					if (handA.get(k) > handB.get(j)) {
						handA.remove(k);
						handB.remove(j);
						ans++;
						continue LOOP;
					}
				}
			}
			handA.remove(0);
			handB.remove(handB.size()-1);
//			System.out.println(handA + "," + handB);
		}
		System.out.println(ans);
	}
}
0