結果
問題 | No.245 貫け! |
ユーザー | nCk_cv |
提出日時 | 2015-07-17 22:56:30 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,749 bytes |
コンパイル時間 | 2,436 ms |
コンパイル使用メモリ | 78,688 KB |
実行使用メモリ | 52,372 KB |
最終ジャッジ日時 | 2024-07-08 09:23:01 |
合計ジャッジ時間 | 9,113 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 117 ms
41,484 KB |
testcase_01 | AC | 106 ms
41,612 KB |
testcase_02 | AC | 118 ms
41,720 KB |
testcase_03 | AC | 109 ms
41,372 KB |
testcase_04 | AC | 121 ms
41,424 KB |
testcase_05 | AC | 130 ms
41,876 KB |
testcase_06 | WA | - |
testcase_07 | AC | 122 ms
41,448 KB |
testcase_08 | AC | 139 ms
42,524 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 513 ms
52,180 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
ソースコード
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); Line2D xLB = new Line2D.Double(cx,dx,ax,bx); 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); Line2D yLB = new Line2D.Double(cy,dy,ay,by); int xSumA = 0; int ySumA = 0; int xSumB = 0; int ySumB = 0; int xSumAB = 0; int ySumAB = 0; int xSumBB = 0; int ySumBB = 0; int xSumA2 = 0; int ySumA2 = 0; int xSumB2 = 0; int ySumB2 = 0; int xSumAB2 = 0; int ySumAB2 = 0; int xSumBB2 = 0; int ySumBB2 = 0; for(int k = 0; k < n; k++) { Line2D target = new Line2D.Double(a[k],b[k],c[k],d[k]); Line2D target2 = new Line2D.Double(c[k],d[k],a[k],b[k]); if(target.intersectsLine(xL)) xSumA++; if(target.intersectsLine(yL)) ySumA++; if(xL.intersectsLine(target)) xSumB++; if(yL.intersectsLine(target)) ySumB++; if(target.intersectsLine(xLB)) xSumAB++; if(target.intersectsLine(yLB)) ySumAB++; if(xLB.intersectsLine(target)) xSumBB++; if(yLB.intersectsLine(target)) ySumBB++; if(target2.intersectsLine(xL)) xSumA2++; if(target2.intersectsLine(yL)) ySumA2++; if(xL.intersectsLine(target2)) xSumB2++; if(yL.intersectsLine(target2)) ySumB2++; if(target2.intersectsLine(xLB)) xSumAB2++; if(target2.intersectsLine(yLB)) ySumAB2++; if(xLB.intersectsLine(target2)) xSumBB2++; if(yLB.intersectsLine(target2)) ySumBB2++; } max = Math.max(xSumA, max); max = Math.max(ySumA, max); max = Math.max(xSumB, max); max = Math.max(ySumB, max); max = Math.max(xSumAB, max); max = Math.max(ySumAB, max); max = Math.max(xSumBB, max); max = Math.max(ySumBB, max); max = Math.max(xSumA2, max); max = Math.max(ySumA2, max); max = Math.max(xSumB2, max); max = Math.max(ySumB2, max); max = Math.max(xSumAB2, max); max = Math.max(ySumAB2, max); max = Math.max(xSumBB2, max); max = Math.max(ySumBB2, max); } } System.out.println(max); } }