結果

問題 No.690 E869120 and Constructing Array 4
ユーザー AreTrashAreTrash
提出日時 2018-05-19 00:00:59
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 985 bytes
コンパイル時間 3,085 ms
コンパイル使用メモリ 107,864 KB
実行使用メモリ 23,244 KB
最終ジャッジ日時 2023-09-10 23:25:20
合計ジャッジ時間 8,389 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 59 ms
23,124 KB
testcase_14 WA -
testcase_15 AC 61 ms
23,140 KB
testcase_16 WA -
testcase_17 AC 59 ms
23,104 KB
testcase_18 WA -
testcase_19 AC 58 ms
22,932 KB
testcase_20 AC 61 ms
23,052 KB
testcase_21 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

namespace No690
{
    public class Program
    {
        struct Edge
        {
            public int From;
            public int To;

            public Edge(int from, int to)
            {
                From = from;
                To = to;
            }
        }

        public static void Main(string[] args)
        {
            var K = int.Parse(Console.ReadLine());
            var v = (int)Math.Ceiling(Math.Log(K, 2)) + 2;

            var ans = new List<Edge>();
            for (var i = 1; i <= v; i++)
            for (var j = i + 1; j <= v; j++)
            {
                ans.Add(new Edge(i, j));
            }

            for (int i = (1 << (v - 2)) - K, j = 1; i > 0; i >>= 1, j++)
            {
                if ((i & 1) == 1) ans.Remove(new Edge(j, v));
            }

            Console.WriteLine($"{v} {ans.Count}");
            ans.ForEach(e => Console.WriteLine($"{e.From} {e.To}"));
        }
    }
}
0