結果

問題 No.488 四角関係
ユーザー yukicoderyukicoder
提出日時 2017-02-25 01:58:53
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 69 ms / 5,000 ms
コード長 1,487 bytes
コンパイル時間 3,884 ms
コンパイル使用メモリ 102,112 KB
実行使用メモリ 22,720 KB
最終ジャッジ日時 2023-09-01 22:01:13
合計ジャッジ時間 6,595 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
22,712 KB
testcase_01 AC 58 ms
20,836 KB
testcase_02 AC 61 ms
18,596 KB
testcase_03 AC 58 ms
22,712 KB
testcase_04 AC 59 ms
22,720 KB
testcase_05 AC 61 ms
18,604 KB
testcase_06 AC 60 ms
18,700 KB
testcase_07 AC 66 ms
20,720 KB
testcase_08 AC 69 ms
20,812 KB
testcase_09 AC 57 ms
20,636 KB
testcase_10 AC 57 ms
20,732 KB
testcase_11 AC 55 ms
20,684 KB
testcase_12 AC 57 ms
20,640 KB
testcase_13 AC 57 ms
20,848 KB
testcase_14 AC 57 ms
20,704 KB
testcase_15 AC 56 ms
20,660 KB
testcase_16 AC 57 ms
20,716 KB
testcase_17 AC 56 ms
20,624 KB
testcase_18 AC 57 ms
22,716 KB
testcase_19 AC 56 ms
20,816 KB
testcase_20 AC 58 ms
22,700 KB
testcase_21 AC 57 ms
22,660 KB
testcase_22 AC 55 ms
22,680 KB
testcase_23 AC 55 ms
20,624 KB
testcase_24 AC 54 ms
20,588 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.Numerics;
public class Program
{
    static bool checkSquare(bool[,] edge, int i, int j, int k, int l)
    {
        return edge[i, j] && edge[j, k] && edge[k, l] && edge[l, i] && !edge[i, k] && !edge[j, l];
    }
    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        int N = int.Parse(s[0]);
        int M = int.Parse(s[1]);

        bool[,] edge = new bool[N, N];
        for (int i = 0; i < M; i++)
        {
            string[] p = Console.ReadLine().Split();
            int a = int.Parse(p[0]);
            int b = int.Parse(p[1]);
            edge[a, b] = true;
            edge[b, a] = true;
        }
        int count = 0;
        for (int i = 0; i < N; i++)
        {
            for (int j = i + 1; j < N; j++)
            {
                for (int k = j + 1; k < N; k++)
                {
                    for (int l = k + 1; l < N; l++)
                    {
                        if (checkSquare(edge, i, j, k, l))
                        {
                            count++;
                        }
                        if (checkSquare(edge, i, k, l, j))
                        {
                            count++;
                        }
                        if (checkSquare(edge, i, l, j, k))
                        {
                            count++;
                        }
                    }
                }
            }
        }
        Console.WriteLine(count);

    }
}
0