結果

問題 No.165 四角で囲え!
ユーザー ki_ki33ki_ki33
提出日時 2015-03-13 00:19:57
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,686 bytes
コンパイル時間 2,311 ms
コンパイル使用メモリ 78,692 KB
実行使用メモリ 61,956 KB
最終ジャッジ日時 2023-09-11 08:10:08
合計ジャッジ時間 13,667 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 203 ms
58,200 KB
testcase_02 AC 203 ms
58,800 KB
testcase_03 AC 204 ms
56,844 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 301 ms
61,136 KB
testcase_07 WA -
testcase_08 AC 206 ms
58,216 KB
testcase_09 AC 203 ms
58,592 KB
testcase_10 AC 125 ms
55,432 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 381 ms
61,620 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentSkipListSet;

public class Main {
	public static final int C =  1000000007;
	static final int CY = 1000000000;
	//static boolean MAP[][];
	static int N;
	static int B;
	static int[][] POS;
	static String S;
	static int K;
	static int X[][];
	//static String S[];
	static int HA[];

	static long DP[];
	static int ST[][];
	static ConcurrentSkipListSet<Integer> TS;
	static ArrayList<Integer> AL;
	public static void main(String[] args) {
		StringBuilder sb = new StringBuilder();
		BufferedInputStream bs = new BufferedInputStream(System.in);
		Scanner sc = new Scanner(bs);

		N = sc.nextInt();
		B = sc.nextInt();

		POS = new int[N][3];
		for (int i=0; i < N; i++) {
			POS[i][0] = sc.nextInt()*2;
			POS[i][1] = sc.nextInt()*2;
			POS[i][2] = sc.nextInt();
		}
		
		long ans = 1;
		
		for (int i=0; i < N; i++) {
			LOOP:for (int n=i+1; n < N; n++) {
				int x = Math.min(POS[i][0], POS[n][0]) - 1;
				int y = Math.min(POS[i][1], POS[n][1]) - 1;
				Rectangle rect = new Rectangle(x, y,Math.abs(POS[i][0] - POS[n][0]) +2, Math.abs(POS[i][1] - POS[n][1])+2) ;
				int num = 0;
				int b = 0;
				for (int t=0; t < N;t++) {
					if (rect.contains(new Point(POS[t][0], POS[t][1]))) {
						num++;
						b += POS[t][2];
						if (b > B) {
							//System.out.println(num);
							continue LOOP;
						}
					}
				}
				ans = Math.max(ans, num);
			}
		}
		




		System.out.println(ans);
	}
}
0