結果

問題 No.245 貫け!
ユーザー りあんりあん
提出日時 2015-07-18 00:43:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 102 ms / 5,000 ms
コード長 3,140 bytes
コンパイル時間 2,420 ms
コンパイル使用メモリ 102,668 KB
実行使用メモリ 25,584 KB
最終ジャッジ日時 2023-09-22 18:42:56
合計ジャッジ時間 4,675 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
21,580 KB
testcase_01 AC 60 ms
23,664 KB
testcase_02 AC 60 ms
21,444 KB
testcase_03 AC 60 ms
23,612 KB
testcase_04 AC 59 ms
21,700 KB
testcase_05 AC 59 ms
25,584 KB
testcase_06 AC 58 ms
21,708 KB
testcase_07 AC 60 ms
23,672 KB
testcase_08 AC 59 ms
21,556 KB
testcase_09 AC 63 ms
23,660 KB
testcase_10 AC 62 ms
21,680 KB
testcase_11 AC 74 ms
21,528 KB
testcase_12 AC 100 ms
21,760 KB
testcase_13 AC 102 ms
21,580 KB
testcase_14 AC 99 ms
21,580 KB
testcase_15 AC 98 ms
21,564 KB
testcase_16 AC 99 ms
23,560 KB
testcase_17 AC 99 ms
21,636 KB
testcase_18 AC 101 ms
23,608 KB
testcase_19 AC 101 ms
23,664 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Numerics;

namespace Solver
{
    class Program
    {
        const int M = 1000000007;
        const double eps = 10e-9;
        static void Main()
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            var sc = new Scan();
            int n = sc.Int;
            var a = new int[n * 2][];
            for (int i = 0; i < n * 2; i++)
                a[i] = new int[2];
            for (int i = 0; i < n * 2; i += 2)
                sc.Multi(out a[i][0], out a[i][1], out a[i + 1][0], out a[i + 1][1]);


            int max = 0;
            for (int i = 0; i < n * 2; i++)
            {
                for (int j = i + 1; j < n * 2; j++)
                {
                    if (a[i][0] == a[j][0] && a[i][1] == a[j][1])
                        continue;

                    int sum = 0;
                    for (int k = 0; k < n * 2; k += 2)
                        if (upper(a[k], a[i], a[j]) * upper(a[k + 1], a[i], a[j]) <= 0)
                            ++sum;

                    max = Math.Max(max, sum);
                }
            }
            sw.WriteLine(max);
            sw.Flush();
        }
        static int upper(int[] xy, int[] a, int[] b)
        {
            return (a[0] - b[0]) * (xy[1] - a[1]) - (a[1] - b[1]) * (xy[0] - a[0]);
        }
    }
    class Scan
    {
        public int Int { get { return int.Parse(Console.ReadLine().Trim()); } }
        public long Long { get { return long.Parse(Console.ReadLine().Trim()); } }
        public string Str { get { return Console.ReadLine().Trim(); } }
        public int[] IntArr { get { return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray(); } }
        public long[] LongArr { get { return Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); } }
        public double[] DoubleArr { get { return Console.ReadLine().Split().Select(double.Parse).ToArray(); } }
        public string[] StrArr { get { return Console.ReadLine().Trim().Split(); } }
        public List<int> IntList { get { return Console.ReadLine().Trim().Split().Select(int.Parse).ToList(); } }
        public List<long> LongList { get { return Console.ReadLine().Trim().Split().Select(long.Parse).ToList(); } }
        public void Multi(out int a, out int b) { var arr = IntArr; a = arr[0]; b = arr[1]; }
        public void Multi(out int a, out int b, out int c) { var arr = IntArr; a = arr[0]; b = arr[1]; c = arr[2]; }
        public void Multi(out int a, out int b, out int c, out int d) { var arr = IntArr; a = arr[0]; b = arr[1]; c = arr[2]; d = arr[3]; }
        public void Multi(out int a, out string b) { var arr = StrArr; a = int.Parse(arr[0]); b = arr[1]; }
        public void Multi(out int a, out char b) { var arr = StrArr; a = int.Parse(arr[0]); b = arr[1][0]; }
        public void Multi(out long a, out long b) { var arr = LongArr; a = arr[0]; b = arr[1]; }
        public void Multi(out string a, out string b) { var arr = StrArr; a = arr[0]; b = arr[1]; }
    }
}
0