結果
問題 |
No.690 E869120 and Constructing Array 4
|
ユーザー |
![]() |
提出日時 | 2018-05-19 00:00:59 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 985 bytes |
コンパイル時間 | 1,515 ms |
コンパイル使用メモリ | 112,856 KB |
実行使用メモリ | 28,092 KB |
最終ジャッジ日時 | 2024-06-28 14:10:16 |
合計ジャッジ時間 | 5,183 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 3 WA * 16 |
コンパイルメッセージ
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 = 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}")); } } }