結果
| 問題 | 
                            No.245 貫け!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-03-09 17:07:30 | 
| 言語 | D  (dmd 2.109.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 18 ms / 5,000 ms | 
| コード長 | 1,326 bytes | 
| コンパイル時間 | 787 ms | 
| コンパイル使用メモリ | 117,888 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-12 07:16:16 | 
| 合計ジャッジ時間 | 1,757 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 16 | 
ソースコード
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);
}