結果
問題 |
No.690 E869120 and Constructing Array 4
|
ユーザー |
![]() |
提出日時 | 2018-05-19 00:15:06 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 998 bytes |
コンパイル時間 | 861 ms |
コンパイル使用メモリ | 106,496 KB |
実行使用メモリ | 18,432 KB |
最終ジャッジ日時 | 2024-06-28 14:11:51 |
合計ジャッジ時間 | 2,493 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 1 |
コンパイルメッセージ
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()); 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($"{Math.Max(1, v)} {ans.Count}"); ans.ForEach(e => Console.WriteLine($"{e.From} {e.To}")); } } }