結果

問題 No.482 あなたの名は
ユーザー 14番14番
提出日時 2017-02-12 00:22:33
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,601 bytes
コンパイル時間 3,714 ms
コンパイル使用メモリ 109,288 KB
実行使用メモリ 41,260 KB
最終ジャッジ日時 2023-08-28 14:49:38
合計ジャッジ時間 7,217 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
23,928 KB
testcase_01 AC 61 ms
21,896 KB
testcase_02 AC 60 ms
19,916 KB
testcase_03 AC 61 ms
21,972 KB
testcase_04 AC 62 ms
23,996 KB
testcase_05 AC 60 ms
21,900 KB
testcase_06 AC 60 ms
21,944 KB
testcase_07 AC 69 ms
22,152 KB
testcase_08 WA -
testcase_09 AC 66 ms
22,048 KB
testcase_10 AC 68 ms
22,072 KB
testcase_11 AC 68 ms
20,052 KB
testcase_12 WA -
testcase_13 AC 69 ms
20,116 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 131 ms
41,152 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 131 ms
41,244 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 132 ms
39,104 KB
testcase_24 AC 130 ms
41,172 KB
testcase_25 AC 130 ms
39,096 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 131 ms
39,240 KB
testcase_29 AC 129 ms
41,172 KB
testcase_30 AC 61 ms
22,024 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.RegularExpressions;
using System.Text;
 
public class Program
{
    public void Proc() {
        Reader.IsDebug = false;
        bool ans = this.GetAns();
        Console.WriteLine(ans?"YES":"NO");
    }

    private bool GetAns() {
        long[] inpt = Reader.ReadLine().Split(' ').Select(a=>long.Parse(a)).ToArray();
        int itemCount = (int)inpt[0];
        long nokori = inpt[1];

        int[] items = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray();
        for(int i=1; i<=itemCount; i++) {
            if(items[i-1] != i) {
                if(nokori <= 0) {
                    return false;
                }
                int num = items[i-1];
                int num2 = items[num-1];
                items[i-1] = num2;
                items[num-1] = num;
                nokori--;
            }
        }
        return nokori % 2 == 0;
    }




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


4 2
1 2 3 4

";
        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