結果

問題 No.2355 Unhappy Back Dance
ユーザー 👑 kakel-sankakel-san
提出日時 2023-08-09 08:53:35
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,758 bytes
コンパイル時間 3,779 ms
コンパイル使用メモリ 112,716 KB
実行使用メモリ 52,848 KB
最終ジャッジ日時 2024-04-26 23:27:46
合計ジャッジ時間 41,776 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
27,240 KB
testcase_01 AC 32 ms
25,452 KB
testcase_02 WA -
testcase_03 AC 32 ms
25,200 KB
testcase_04 AC 31 ms
25,004 KB
testcase_05 AC 31 ms
25,268 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 32 ms
23,216 KB
testcase_16 AC 2,776 ms
48,716 KB
testcase_17 AC 2,787 ms
46,616 KB
testcase_18 AC 2,753 ms
48,644 KB
testcase_19 AC 2,762 ms
48,468 KB
testcase_20 AC 2,713 ms
48,724 KB
testcase_21 AC 1,145 ms
45,304 KB
testcase_22 AC 224 ms
29,080 KB
testcase_23 AC 237 ms
31,492 KB
testcase_24 AC 2,483 ms
48,348 KB
testcase_25 AC 1,350 ms
50,700 KB
testcase_26 AC 1,341 ms
48,592 KB
testcase_27 AC 1,142 ms
47,108 KB
testcase_28 AC 53 ms
25,472 KB
testcase_29 AC 86 ms
29,164 KB
testcase_30 AC 2,239 ms
47,864 KB
testcase_31 AC 1,649 ms
48,100 KB
testcase_32 AC 178 ms
31,116 KB
testcase_33 AC 924 ms
46,696 KB
testcase_34 AC 40 ms
25,196 KB
testcase_35 AC 57 ms
25,464 KB
testcase_36 AC 1,144 ms
49,280 KB
testcase_37 AC 622 ms
48,812 KB
testcase_38 AC 758 ms
46,532 KB
testcase_39 AC 602 ms
47,040 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 static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    static long[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var map = NArr(n);
        var ans = 0;
        for (var i = 0; i + 1 < n; ++i)
        {
            var list = new List<Rad>();
            for (var j = 0; j < n; ++j)
            {
                if (i == j) continue;
                list.Add(new Rad(map[j][0] - map[i][0], map[j][1] - map[i][1]));
            }
            list.Sort((l, r) =>
            {
                var d = l.Ch.CompareTo(r.Ch);
                if (d != 0) return d;
                return l.Pa.CompareTo(r.Pa);
            });
            for (var j = 0; j + 1 < list.Count; ++j)
            {
                if (list[j].Ch == list[j + 1].Ch && list[j].Pa == list[j + 1].Pa)
                {
                    ++ans;
                    break;
                }
            }
        }
        WriteLine(ans);
    }
    class Rad
    {
        public long Ch;
        public long Pa;
        public Rad(long x, long y)
        {
            var gcd = GCD(x, y);
            Ch = y / gcd;
            Pa = x / gcd;
        }
    }
    static long GCD(long a, long b)
    {
        if (a < 0) a = -a;
        if (b < 0) b = -b;
        if (a < b) return GCD(b, a);
        if (b == 0) return a;
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }
}
0