結果

問題 No.466 ジオラマ
ユーザー 14番14番
提出日時 2016-12-16 01:35:39
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 3,403 bytes
コンパイル時間 1,710 ms
コンパイル使用メモリ 116,044 KB
実行使用メモリ 33,604 KB
最終ジャッジ日時 2024-05-07 15:45:44
合計ジャッジ時間 9,805 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 29 ms
25,392 KB
testcase_02 AC 25 ms
27,208 KB
testcase_03 AC 30 ms
25,276 KB
testcase_04 WA -
testcase_05 AC 28 ms
25,512 KB
testcase_06 AC 36 ms
30,580 KB
testcase_07 AC 30 ms
27,560 KB
testcase_08 AC 38 ms
33,604 KB
testcase_09 AC 36 ms
27,764 KB
testcase_10 AC 34 ms
30,740 KB
testcase_11 AC 31 ms
27,624 KB
testcase_12 AC 36 ms
33,104 KB
testcase_13 AC 31 ms
29,468 KB
testcase_14 AC 30 ms
29,484 KB
testcase_15 AC 34 ms
27,588 KB
testcase_16 AC 27 ms
25,392 KB
testcase_17 AC 30 ms
29,608 KB
testcase_18 AC 31 ms
27,432 KB
testcase_19 AC 32 ms
27,584 KB
testcase_20 AC 33 ms
27,572 KB
testcase_21 AC 33 ms
27,560 KB
testcase_22 AC 36 ms
30,804 KB
testcase_23 AC 31 ms
27,384 KB
testcase_24 AC 36 ms
31,288 KB
testcase_25 AC 37 ms
29,436 KB
testcase_26 AC 31 ms
29,440 KB
testcase_27 AC 36 ms
31,464 KB
testcase_28 AC 34 ms
30,588 KB
testcase_29 AC 36 ms
31,456 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 35 ms
27,536 KB
testcase_33 AC 33 ms
25,368 KB
testcase_34 AC 37 ms
32,868 KB
testcase_35 AC 34 ms
29,628 KB
testcase_36 AC 29 ms
25,384 KB
testcase_37 AC 30 ms
23,240 KB
testcase_38 AC 29 ms
29,448 KB
testcase_39 AC 29 ms
27,440 KB
testcase_40 AC 30 ms
29,528 KB
testcase_41 AC 30 ms
27,492 KB
testcase_42 AC 32 ms
27,416 KB
testcase_43 AC 33 ms
29,496 KB
testcase_44 AC 32 ms
29,640 KB
testcase_45 AC 31 ms
29,384 KB
testcase_46 AC 29 ms
27,308 KB
testcase_47 AC 30 ms
25,404 KB
testcase_48 AC 33 ms
30,396 KB
testcase_49 AC 34 ms
30,288 KB
testcase_50 AC 30 ms
27,740 KB
testcase_51 AC 33 ms
29,592 KB
testcase_52 AC 31 ms
27,684 KB
testcase_53 AC 30 ms
25,600 KB
testcase_54 AC 30 ms
27,620 KB
testcase_55 AC 31 ms
27,504 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 AC 36 ms
30,704 KB
testcase_68 WA -
testcase_69 AC 32 ms
27,596 KB
testcase_70 WA -
testcase_71 AC 33 ms
27,320 KB
testcase_72 WA -
testcase_73 AC 31 ms
27,452 KB
testcase_74 WA -
testcase_75 AC 33 ms
25,560 KB
testcase_76 AC 34 ms
30,592 KB
testcase_77 AC 31 ms
27,540 KB
testcase_78 AC 34 ms
30,728 KB
testcase_79 AC 33 ms
28,664 KB
testcase_80 AC 32 ms
29,700 KB
testcase_81 WA -
testcase_82 WA -
testcase_83 AC 29 ms
27,576 KB
testcase_84 WA -
testcase_85 WA -
testcase_86 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.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{
    public void Proc() {
        Reader.IsDebug = false;
        int[] inpt = Reader.ReadLine().Split(' ').Select(c=>int.Parse(c)).ToArray();

        int a = inpt[0];
        int b = inpt[1];
        int aAndB = inpt[2];
        int roadCount = inpt[3];

        if(a+b-aAndB-1>roadCount) {
            Console.WriteLine(-1);
        }

        TreeNode t0 = new TreeNode(0);
        TreeNode t1 = new TreeNode(1);

        if(aAndB == a) {
            t1.Add(t0);
            int idx = 2;
            if(a>1) {
                t0.AddRange(idx, idx+a-2);
            }
            idx = idx+a-1;
            if(b-aAndB>1) {
                t1.AddRange(idx, idx+(b-aAndB)-2);
            }
        } else if(aAndB == b) {
            t0.Add(t1);
            int idx = 2;
            if(b>1) {
                t1.AddRange(idx, idx+b-2);
            }
            idx = idx+b-1;
            if(a-aAndB>1) {
                t0.AddRange(idx, idx+(a-aAndB)-2);
            }
        } else {
            TreeNode t2 = new TreeNode(2);
            int idx = 3;
            t2.AddRange(idx, idx+aAndB-2);
            idx=idx+aAndB-1;
            if(a-aAndB>1) {
                t0.AddRange(idx, idx+(a-aAndB)-2);
                idx = idx+(a-aAndB)-1;
            }
            if(b-aAndB>1) {
                t1.AddRange(idx, idx+(b-aAndB)-2);
            }
            t0.Add(t2);
            t1.Add(t2);
        }

        StringBuilder ans = new StringBuilder();
        ans.Append(t0.Print());
        ans.Append(t1.Print());
        int mura = a+b-aAndB;
        Console.WriteLine(mura + " " + (mura-1));
        Console.Write(ans.ToString());
    }

    public class TreeNode {
        public int Id;

        public List<TreeNode> Items = new List<TreeNode>();

        public TreeNode(int id) {
            this.Id = id;
        }
        public void Add(TreeNode cld) {
            this.Items.Add(cld);
        }

        private bool IsPrinted = false;
        public string Print() {
            if(this.IsPrinted) {
                return string.Empty;
            }
            StringBuilder ret = new StringBuilder();
            this.Items.ForEach(a=>{
                    ret.AppendLine(this.Id + " " + a.Id);
                    ret.Append(a.Print());
                });
            this.IsPrinted = true;
            return ret.ToString();
        }
        

        public List<TreeNode> AddRange(int f, int t) {
            List<TreeNode> tmp = new List<TreeNode>();
            for(int i=f; i<=t; i++) {
                tmp.Add(new TreeNode(i));
            }
            this.Items.AddRange(tmp);
            return tmp;
        }
    }

    public class Reader {
        public static bool IsDebug = true;
        private static System.IO.StringReader SReader;
        private static string InitText = @"


6 4 2 12





";
        public static string ReadLine() {
            if(IsDebug) {
                if(SReader == null) {
                    SReader = new System.IO.StringReader(InitText.Trim());
                }
                return SReader.ReadLine();
            } else {
                return Console.ReadLine();
            }
        }
    }
    public static void Main(string[] args)
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0