Submission #215031


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[] start = Enu.Range(0, N).ToArray();
        
        foreach (int R in reader.IntLine())
            Swap(ref start[R - 1], ref start[R]);

        int[] after = Enu.Range(0, N).Select(i => Array.IndexOf(start, i)).ToArray();
        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(ref int a, ref int b) { int 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 40
Code Size 2845 Byte
Status TLE
Exec Time 4061 ms
Memory 25432 KB

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 0 / 10 20 / 20 20 / 20 0 / 50
Status
AC × 5
TLE × 4
AC × 18
AC × 18
AC × 8
TLE × 21
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 TLE 4033 ms 23968 KB
01_random01.txt AC 192 ms 9084 KB
01_random02.txt AC 188 ms 8944 KB
01_random03.txt AC 163 ms 9072 KB
01_random04.txt AC 200 ms 9856 KB
01_random05.txt TLE 4030 ms 11216 KB
01_random06.txt TLE 4031 ms 18800 KB
01_random07.txt TLE 4032 ms 23992 KB
02_i.txt AC 193 ms 9212 KB
02_p.txt AC 173 ms 9212 KB
02_random01.txt AC 190 ms 8952 KB
02_random02.txt AC 206 ms 8956 KB
02_random03.txt AC 255 ms 9332 KB
02_random04.txt AC 188 ms 9212 KB
02_random05.txt AC 185 ms 10408 KB
02_random06.txt AC 235 ms 14712 KB
02_random07.txt AC 244 ms 20092 KB
02_random08.txt AC 241 ms 19956 KB
02_rp01.txt AC 182 ms 9212 KB
02_rp02.txt AC 194 ms 9080 KB
02_rp03.txt AC 168 ms 9204 KB
02_rp04.txt AC 169 ms 9204 KB
02_rp05.txt AC 168 ms 9200 KB
03_i.txt AC 163 ms 8928 KB
03_random01.txt AC 204 ms 9972 KB
03_random02.txt AC 219 ms 18552 KB
03_random03.txt AC 277 ms 17020 KB
03_random04.txt AC 233 ms 16892 KB
03_random05.txt AC 174 ms 10488 KB
03_random06.txt AC 259 ms 10244 KB
03_random07.txt AC 241 ms 11252 KB
03_random08.txt AC 169 ms 9080 KB
03_random09.txt AC 187 ms 11772 KB
03_random10.txt AC 239 ms 14076 KB
03_random11.txt AC 313 ms 18132 KB
03_random12.txt AC 213 ms 18408 KB
03_random13.txt AC 233 ms 16476 KB
03_random14.txt AC 194 ms 14712 KB
03_random15.txt AC 176 ms 11240 KB
04_i.txt TLE 4031 ms 23920 KB
04_p1.txt TLE 4036 ms 16720 KB
04_p2.txt TLE 4030 ms 14292 KB
04_random01.txt TLE 4031 ms 16752 KB
04_random02.txt TLE 4053 ms 12652 KB
04_random03.txt AC 549 ms 17532 KB
04_random04.txt AC 467 ms 23288 KB
04_random05.txt AC 815 ms 22356 KB
04_random06.txt TLE 4046 ms 14288 KB
04_random07.txt TLE 4033 ms 23400 KB
04_random08.txt AC 3170 ms 22992 KB
04_random09.txt AC 1155 ms 25432 KB
04_random10.txt TLE 4032 ms 13392 KB
04_random11.txt TLE 4031 ms 24036 KB
04_random12.txt TLE 4032 ms 23916 KB
04_random13.txt TLE 4032 ms 23892 KB
04_rp01.txt TLE 4042 ms 16724 KB
04_rp02.txt TLE 4031 ms 16736 KB
04_rp03.txt TLE 4061 ms 16800 KB
04_rp04.txt TLE 4033 ms 16724 KB
04_rp05.txt TLE 4031 ms 16724 KB
04_rp06.txt TLE 4030 ms 16740 KB
04_rp07.txt TLE 4031 ms 16752 KB
04_rp08.txt TLE 4051 ms 16600 KB
04_rp09.txt TLE 4032 ms 16724 KB
04_rp10.txt TLE 4031 ms 16748 KB
sample_1.txt AC 166 ms 8956 KB
sample_2.txt AC 163 ms 8948 KB
sample_3.txt AC 204 ms 8944 KB