結果

問題 No.482 あなたの名は
ユーザー mbanmban
提出日時 2017-02-11 17:32:30
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,455 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 107,484 KB
実行使用メモリ 44,464 KB
最終ジャッジ日時 2023-08-28 14:44:03
合計ジャッジ時間 6,784 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 60 ms
21,680 KB
testcase_02 AC 61 ms
23,740 KB
testcase_03 AC 60 ms
21,552 KB
testcase_04 AC 60 ms
21,708 KB
testcase_05 AC 61 ms
21,668 KB
testcase_06 AC 62 ms
21,564 KB
testcase_07 WA -
testcase_08 AC 69 ms
21,788 KB
testcase_09 AC 68 ms
21,644 KB
testcase_10 AC 69 ms
23,720 KB
testcase_11 AC 70 ms
21,784 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 69 ms
21,780 KB
testcase_15 WA -
testcase_16 AC 137 ms
42,464 KB
testcase_17 AC 135 ms
40,316 KB
testcase_18 AC 137 ms
42,360 KB
testcase_19 WA -
testcase_20 AC 141 ms
40,380 KB
testcase_21 WA -
testcase_22 AC 138 ms
42,388 KB
testcase_23 WA -
testcase_24 AC 136 ms
42,376 KB
testcase_25 WA -
testcase_26 AC 135 ms
38,308 KB
testcase_27 WA -
testcase_28 AC 135 ms
40,388 KB
testcase_29 WA -
testcase_30 AC 60 ms
21,548 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.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        new Magatro().Solve();
    }
}

public class Scanner
{
    private StreamReader Sr;
    private string[] S;
    private int Index;
    private const char Separator = ' ';
    public Scanner()
    {
        Index = 0;
        S = new string[0];
        Sr = new StreamReader(Console.OpenStandardInput());
    }
    private string[] Line()
    {
        return Sr.ReadLine().Split(Separator);
    }
    public string Next()
    {
        string result;
        if (Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public decimal NextDecimal()
    {
        return decimal.Parse(Next());
    }
    public string[] StringArray(int index = 0)
    {
        Next();
        Index = S.Length;
        return S.Skip(index).ToArray();
    }
    public int[] IntArray(int index = 0)
    {
        return StringArray(index).Select(int.Parse).ToArray();
    }
    public long[] LongArray(int index = 0)
    {
        return StringArray(index).Select(long.Parse).ToArray();
    }
    public bool EndOfStream
    {
        get { return Sr.EndOfStream; }
    }
}

public class Magatro
{
    private Scanner Sc;

    private int N;
    private long K;
    private int[] D;
    
    private void Scan()
    {
        Sc = new Scanner();
        N = Sc.NextInt();
        K = Sc.NextLong();
        D = Sc.IntArray();
    }

    public void Solve()
    {
        Scan();
        int counter = 0;
        for (int i = 0; i < N; i++)
        {
            if (D[i] != i + 1)
            {
                counter++;
            }
        }
        if (K < counter - 1)
        {
            Console.WriteLine("NO");
            return;
        }
        if (counter == 0)
        {
            Console.WriteLine(K % 2 == 0 ? "YES" : "NO");
        }
        else
        {
            Console.WriteLine((K - counter) % 2 == 1 ? "YES" : "NO");
        }
    }
}



0