結果
| 問題 |
No.690 E869120 and Constructing Array 4
|
| ユーザー |
AreTrash
|
| 提出日時 | 2018-05-19 00:17:06 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 1,000 ms |
| コード長 | 1,147 bytes |
| コンパイル時間 | 903 ms |
| コンパイル使用メモリ | 112,996 KB |
| 実行使用メモリ | 18,432 KB |
| 最終ジャッジ日時 | 2024-06-28 14:11:59 |
| 合計ジャッジ時間 | 2,482 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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());
if (K == 0)
{
Console.WriteLine("3 1");
Console.WriteLine("1 2");
return;
}
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 = 2; 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}"));
}
}
}
AreTrash