結果

問題 No.245 貫け!
ユーザー nebukuro09nebukuro09
提出日時 2017-03-09 17:07:30
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 1,326 bytes
コンパイル時間 1,276 ms
コンパイル使用メモリ 105,836 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 01:57:48
合計ジャッジ時間 2,377 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 8 ms
4,380 KB
testcase_12 AC 18 ms
4,384 KB
testcase_13 AC 17 ms
4,384 KB
testcase_14 AC 17 ms
4,380 KB
testcase_15 AC 17 ms
4,384 KB
testcase_16 AC 18 ms
4,380 KB
testcase_17 AC 18 ms
4,380 KB
testcase_18 AC 17 ms
4,384 KB
testcase_19 AC 18 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    int N = readln.chomp.to!int;
    auto p = iota(N).map!(_ => readln.split.map!(to!int).array).array;
    if (N == 1) {
        writeln(1);
        return;
    }

    int ans;
    int[4] e1 = [0, 0, 2, 2];
    int[4] e2 = [0, 2, 0, 2];
    foreach (i; 0..N) {
        foreach (j; i+1..N) {
            foreach (e; 0..4) {
                int tmp_ans;
                int p1x = p[i][e1[e]];
                int p1y = p[i][e1[e]+1];
                int p2x = p[j][e2[e]];
                int p2y = p[j][e2[e]+1];
                if (p1x == p2x && p1y == p2y) continue;
                foreach (k; 0..N) {
                    int p3x = p[k][0];
                    int p3y = p[k][1];
                    int p4x = p[k][2];
                    int p4y = p[k][3];
                    long a = (p1x - p2x) * (p3y - p1y) + (p1y - p2y) * (p1x - p3x);
                    long b = (p1x - p2x) * (p4y - p1y) + (p1y - p2y) * (p1x - p4x);
                    if (a * b <= 0)
                        tmp_ans++;
                }

                ans = max(ans, tmp_ans);
            }
        }
    }
    
    writeln(ans);
}
0