Submission #215037


Source Code Expand

Copy
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;

class Program
{
    void Solve()
    {
        int N = reader.Int(), M = reader.Int(), Pow = reader.Int();
        int[] after = Enu.Range(0, N).ToArray();
        
        foreach (int R in reader.IntLine().Reverse())
            Swap(ref after[R - 1], ref after[R]);

        int[] res = Enu.Range(0, N).ToArray();
        while (Pow > 0)
        {
            if (Pow % 2 == 1) res = Next(res, after);
            after = Next(after, after);
            Pow /= 2;
        }

        Console.WriteLine(string.Join("\n", res.Select(x => x + 1)));
    }

    void Swap<T>(ref T a, ref T b) { T t = a; a = b; b = t; }

    int[] Next(int[] a, int[] b)
    {
        int[] res = new int[a.Length];
        for (int i = 0; i < res.Length; i++)
            res[i] = b[a[i]];
        return res;
    }



    static void Main() { new Program().Solve(); }
    Reader reader = new Reader(Console.In);
    class Reader
    {
        private readonly TextReader reader;
        private readonly char[] separator = new char[] { ' ' };
        private readonly StringSplitOptions removeOp = StringSplitOptions.RemoveEmptyEntries;
        private string[] A = new string[0];
        private int i;

        public Reader(TextReader r) { reader = r; }
        public bool HasNext() { return Enqueue(); }
        public string String() { return Dequeue(); }
        public int Int() { return int.Parse(Dequeue()); }
        public long Long() { return long.Parse(Dequeue()); }
        public double Double() { return double.Parse(Dequeue()); }
        public int[] IntLine() { var s = Line(); return s == "" ? new int[0] : Array.ConvertAll(Split(s), int.Parse); }
        public int[] IntArray(int N) { return Enumerable.Range(0, N).Select(i => Int()).ToArray(); }
        public int[][] IntGrid(int H) { return Enumerable.Range(0, H).Select(i => IntLine()).ToArray(); }
        public string[] StringArray(int N) { return Enumerable.Range(0, N).Select(i => Line()).ToArray(); }
        public string Line() { return reader.ReadLine().Trim(); }
        private string[] Split(string s) { return s.Split(separator, removeOp); }
        private bool Enqueue()
        {
            if (i < A.Length) return true;
            string line = reader.ReadLine();
            if (line == null) return false;
            if (line == "") return Enqueue();
            A = Split(line);
            i = 0;
            return true;
        }
        private string Dequeue() { Enqueue(); return A[i++]; }
    }
}

Submission Info

Submission Time
Task D - 阿弥陀
User eitaho
Language C# (Mono 2.10.8.1)
Score 100
Code Size 2765 Byte
Status AC
Exec Time 393 ms
Memory 32168 KB

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 10 / 10 20 / 20 20 / 20 50 / 50
Status
AC × 9
AC × 18
AC × 18
AC × 29
Set Name Test Cases
Subtask1 sample_1.txt, 01_i.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt
Subtask2 sample_1.txt, sample_2.txt, sample_3.txt, 02_i.txt, 02_p.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_rp01.txt, 02_rp02.txt, 02_rp03.txt, 02_rp04.txt, 02_rp05.txt
Subtask3 sample_1.txt, sample_2.txt, 03_i.txt, 03_random01.txt, 03_random02.txt, 03_random03.txt, 03_random04.txt, 03_random05.txt, 03_random06.txt, 03_random07.txt, 03_random08.txt, 03_random09.txt, 03_random10.txt, 03_random11.txt, 03_random12.txt, 03_random13.txt, 03_random14.txt, 03_random15.txt
Subtask4 sample_1.txt, sample_2.txt, sample_3.txt, 04_i.txt, 04_p1.txt, 04_p2.txt, 04_random01.txt, 04_random02.txt, 04_random03.txt, 04_random04.txt, 04_random05.txt, 04_random06.txt, 04_random07.txt, 04_random08.txt, 04_random09.txt, 04_random10.txt, 04_random11.txt, 04_random12.txt, 04_random13.txt, 04_rp01.txt, 04_rp02.txt, 04_rp03.txt, 04_rp04.txt, 04_rp05.txt, 04_rp06.txt, 04_rp07.txt, 04_rp08.txt, 04_rp09.txt, 04_rp10.txt
Case Name Status Exec Time Memory
01_i.txt AC 368 ms 31672 KB
01_random01.txt AC 393 ms 8988 KB
01_random02.txt AC 159 ms 9020 KB
01_random03.txt AC 161 ms 8992 KB
01_random04.txt AC 173 ms 9852 KB
01_random05.txt AC 230 ms 18068 KB
01_random06.txt AC 285 ms 21308 KB
01_random07.txt AC 319 ms 31744 KB
02_i.txt AC 163 ms 9104 KB
02_p.txt AC 160 ms 9140 KB
02_random01.txt AC 156 ms 8944 KB
02_random02.txt AC 160 ms 8984 KB
02_random03.txt AC 165 ms 9432 KB
02_random04.txt AC 158 ms 9096 KB
02_random05.txt AC 174 ms 10440 KB
02_random06.txt AC 201 ms 14884 KB
02_random07.txt AC 241 ms 20828 KB
02_random08.txt AC 245 ms 20792 KB
02_rp01.txt AC 164 ms 9128 KB
02_rp02.txt AC 164 ms 9144 KB
02_rp03.txt AC 164 ms 9148 KB
02_rp04.txt AC 163 ms 9140 KB
02_rp05.txt AC 170 ms 9272 KB
03_i.txt AC 162 ms 9076 KB
03_random01.txt AC 168 ms 9908 KB
03_random02.txt AC 223 ms 19184 KB
03_random03.txt AC 208 ms 17592 KB
03_random04.txt AC 209 ms 17584 KB
03_random05.txt AC 173 ms 10532 KB
03_random06.txt AC 169 ms 10416 KB
03_random07.txt AC 179 ms 11364 KB
03_random08.txt AC 165 ms 9108 KB
03_random09.txt AC 180 ms 11932 KB
03_random10.txt AC 192 ms 14536 KB
03_random11.txt AC 218 ms 18740 KB
03_random12.txt AC 221 ms 19016 KB
03_random13.txt AC 208 ms 17020 KB
03_random14.txt AC 200 ms 15044 KB
03_random15.txt AC 174 ms 11400 KB
04_i.txt AC 331 ms 30444 KB
04_p1.txt AC 288 ms 20436 KB
04_p2.txt AC 257 ms 16408 KB
04_random01.txt AC 261 ms 21028 KB
04_random02.txt AC 227 ms 13588 KB
04_random03.txt AC 222 ms 17468 KB
04_random04.txt AC 259 ms 23000 KB
04_random05.txt AC 253 ms 22196 KB
04_random06.txt AC 246 ms 14708 KB
04_random07.txt AC 292 ms 26160 KB
04_random08.txt AC 281 ms 23096 KB
04_random09.txt AC 328 ms 25436 KB
04_random10.txt AC 246 ms 14508 KB
04_random11.txt AC 343 ms 32168 KB
04_random12.txt AC 336 ms 31996 KB
04_random13.txt AC 336 ms 27844 KB
04_rp01.txt AC 289 ms 20352 KB
04_rp02.txt AC 289 ms 20868 KB
04_rp03.txt AC 281 ms 20904 KB
04_rp04.txt AC 288 ms 20744 KB
04_rp05.txt AC 291 ms 20904 KB
04_rp06.txt AC 289 ms 19208 KB
04_rp07.txt AC 286 ms 20908 KB
04_rp08.txt AC 289 ms 20388 KB
04_rp09.txt AC 290 ms 19696 KB
04_rp10.txt AC 292 ms 20332 KB
sample_1.txt AC 164 ms 9004 KB
sample_2.txt AC 166 ms 8888 KB
sample_3.txt AC 157 ms 9000 KB