結果

問題 No.200 カードファイト!
ユーザー ぴろずぴろず
提出日時 2015-04-29 01:29:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 1,144 bytes
コンパイル時間 4,304 ms
コンパイル使用メモリ 75,388 KB
実行使用メモリ 57,552 KB
最終ジャッジ日時 2023-08-05 11:55:03
合計ジャッジ時間 7,637 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
55,684 KB
testcase_01 AC 136 ms
55,528 KB
testcase_02 AC 126 ms
55,852 KB
testcase_03 AC 126 ms
53,576 KB
testcase_04 AC 123 ms
55,584 KB
testcase_05 AC 130 ms
55,476 KB
testcase_06 AC 132 ms
55,476 KB
testcase_07 AC 137 ms
55,588 KB
testcase_08 AC 134 ms
55,928 KB
testcase_09 AC 132 ms
55,752 KB
testcase_10 AC 126 ms
55,912 KB
testcase_11 AC 127 ms
55,768 KB
testcase_12 AC 124 ms
55,824 KB
testcase_13 AC 125 ms
55,900 KB
testcase_14 AC 126 ms
56,020 KB
testcase_15 AC 124 ms
55,656 KB
testcase_16 AC 124 ms
57,552 KB
testcase_17 AC 129 ms
55,688 KB
testcase_18 AC 127 ms
55,680 KB
testcase_19 AC 128 ms
55,612 KB
testcase_20 AC 127 ms
55,460 KB
testcase_21 AC 128 ms
55,464 KB
testcase_22 AC 134 ms
55,660 KB
testcase_23 AC 129 ms
55,608 KB
testcase_24 AC 128 ms
56,060 KB
testcase_25 AC 126 ms
56,024 KB
testcase_26 AC 131 ms
55,792 KB
testcase_27 AC 131 ms
55,652 KB
testcase_28 AC 135 ms
55,732 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