結果

問題 No.245 貫け!
ユーザー nCk_cvnCk_cv
提出日時 2015-07-17 22:49:34
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,147 bytes
コンパイル時間 3,785 ms
コンパイル使用メモリ 75,172 KB
実行使用メモリ 60,068 KB
最終ジャッジ日時 2023-09-22 17:58:37
合計ジャッジ時間 7,667 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,776 KB
testcase_01 AC 120 ms
55,680 KB
testcase_02 AC 120 ms
56,772 KB
testcase_03 AC 119 ms
55,892 KB
testcase_04 AC 119 ms
55,892 KB
testcase_05 AC 120 ms
55,840 KB
testcase_06 WA -
testcase_07 AC 120 ms
55,868 KB
testcase_08 AC 134 ms
55,764 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 242 ms
59,640 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];
		int[] d = new int[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
			d[i] = sc.nextInt();
		}
		int max = 0;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				
				int ax = a[i];
				int bx = b[i];
				
				int cx = c[j];
				int dx = d[j];
				
				Line2D xL = new Line2D.Double(ax,bx,cx,dx);	
				
				int ay = a[j];
				int by = b[j];
				
				int cy = c[i];
				int dy = d[i];
				
				Line2D yL = new Line2D.Double(ay,by,cy,dy);
				
				int xSum = 0;
				int ySum = 0;

				for(int k = 0; k < n; k++) {
					Line2D target = new Line2D.Double(a[k],b[k],c[k],d[k]);
					if(target.intersectsLine(xL)) xSum++;
					if(target.intersectsLine(yL)) ySum++;
				}
				
				max = Math.max(xSum, max);
				max = Math.max(ySum, max);
				
			}
		}
		
		System.out.println(max);
		
		
		
		
	} 	
	
	
}
0