結果
問題 | No.743 Segments on a Polygon |
ユーザー | x87asdf |
提出日時 | 2018-11-03 13:46:17 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,068 bytes |
コンパイル時間 | 3,051 ms |
コンパイル使用メモリ | 73,528 KB |
実行使用メモリ | 75,348 KB |
最終ジャッジ日時 | 2023-08-13 02:31:53 |
合計ジャッジ時間 | 10,357 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
ソースコード
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int count = 0; int[][] figure = new int[n][2]; figure[0][0] = sc.nextInt(); figure[0][1] = sc.nextInt(); for(int i=1;i<n;i++) { figure[i][0] = sc.nextInt(); figure[i][1] = sc.nextInt(); for(int j=1;j<=i;j++) { if(figure[i][0] < figure[i-j][0] && figure[i][1] > figure[i-j][0]) { if(figure[i][0] > figure[i-j][1] && figure[i][1] < figure[i-j][1]) { count++; } } else if(figure[i][0] < figure[i-j][1] && figure[i][1] > figure[i-j][1]) { if(figure[i][0] > figure[i-j][0] && figure[i][1] < figure[i-j][0]) { count++; } } } } System.out.println(count); } }