結果
| 問題 |
No.165 四角で囲え!
|
| コンテスト | |
| ユーザー |
ki_ki33
|
| 提出日時 | 2015-03-13 00:49:00 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,795 bytes |
| コンパイル時間 | 2,125 ms |
| コンパイル使用メモリ | 86,292 KB |
| 実行使用メモリ | 54,016 KB |
| 最終ジャッジ日時 | 2024-06-28 22:45:47 |
| 合計ジャッジ時間 | 14,582 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | TLE * 1 -- * 18 |
ソースコード
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();
HashSet<Integer> X = new HashSet<Integer>();
HashSet<Integer> Y = new HashSet<Integer>();
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();
X.add(POS[i][0]);
Y.add(POS[i][1]);
}
long ans = 1;
for (int x1 :X) {
for (int x2: X) {
for(int y1: Y) {
LOOP:for (int y2:Y) {
int x = Math.min(x1, x2) - 1;
int y = Math.min(y1, y2) - 1;
Rectangle rect = new Rectangle(x, y,Math.abs(x1 - x2) + 2, Math.abs(y1 - y2)+ 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) {
continue LOOP;
}
}
}
ans = Math.max(ans, num);
}
}
}
}
System.out.println(ans);
}
}
ki_ki33