Submission #214151


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[] Lines = reader.IntLine();
        int[] after = new int[N];

        for (int i = 0; i < N; i++)
        {
            int curr = i;
            foreach (int right in Lines)
            {
                if (curr == right) curr--;
                else if (curr == right - 1) curr++;
            }
            after[i] = curr;
        }
        int[] res = (int[])after.Clone();
        Pow--;
        while (Pow > 0)
        {
            if (Pow % 2 == 1) res = Next(res, after);
            after = Next(after, after);
            Pow /= 2;
        }
        res = res.Select(x => x + 1).ToArray();

        Console.WriteLine(string.Join("\n", res));
        Console.ReadLine();
    }

    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 2966 Byte
Status TLE
Exec Time 4033 ms
Memory 22892 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 × 4
TLE × 25
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 4031 ms 22880 KB
01_random01.txt AC 152 ms 8600 KB
01_random02.txt AC 151 ms 8672 KB
01_random03.txt AC 151 ms 8704 KB
01_random04.txt AC 233 ms 9232 KB
01_random05.txt TLE 4030 ms 10464 KB
01_random06.txt TLE 4031 ms 18268 KB
01_random07.txt TLE 4032 ms 22848 KB
02_i.txt AC 159 ms 8912 KB
02_p.txt AC 154 ms 8832 KB
02_random01.txt AC 150 ms 8660 KB
02_random02.txt AC 151 ms 8592 KB
02_random03.txt AC 162 ms 8964 KB
02_random04.txt AC 152 ms 8852 KB
02_random05.txt AC 212 ms 9996 KB
02_random06.txt AC 432 ms 14216 KB
02_random07.txt AC 722 ms 19668 KB
02_random08.txt AC 716 ms 19664 KB
02_rp01.txt AC 155 ms 8844 KB
02_rp02.txt AC 155 ms 8836 KB
02_rp03.txt AC 155 ms 8844 KB
02_rp04.txt AC 154 ms 8836 KB
02_rp05.txt AC 157 ms 8844 KB
03_i.txt AC 151 ms 8724 KB
03_random01.txt AC 157 ms 9556 KB
03_random02.txt AC 202 ms 18136 KB
03_random03.txt AC 191 ms 16648 KB
03_random04.txt AC 196 ms 16576 KB
03_random05.txt AC 160 ms 10124 KB
03_random06.txt AC 158 ms 9996 KB
03_random07.txt AC 164 ms 10880 KB
03_random08.txt AC 152 ms 8788 KB
03_random09.txt AC 168 ms 11472 KB
03_random10.txt AC 180 ms 13772 KB
03_random11.txt AC 203 ms 17740 KB
03_random12.txt AC 205 ms 17984 KB
03_random13.txt AC 191 ms 16136 KB
03_random14.txt AC 183 ms 14348 KB
03_random15.txt AC 165 ms 10892 KB
04_i.txt TLE 4031 ms 22876 KB
04_p1.txt TLE 4030 ms 15580 KB
04_p2.txt TLE 4030 ms 13404 KB
04_random01.txt TLE 4031 ms 15700 KB
04_random02.txt TLE 4031 ms 11616 KB
04_random03.txt AC 2947 ms 16396 KB
04_random04.txt TLE 4032 ms 19836 KB
04_random05.txt TLE 4031 ms 18008 KB
04_random06.txt TLE 4033 ms 13784 KB
04_random07.txt TLE 4031 ms 22364 KB
04_random08.txt TLE 4031 ms 18764 KB
04_random09.txt TLE 4032 ms 22508 KB
04_random10.txt TLE 4030 ms 12256 KB
04_random11.txt TLE 4032 ms 22880 KB
04_random12.txt TLE 4032 ms 22880 KB
04_random13.txt TLE 4032 ms 22892 KB
04_rp01.txt TLE 4030 ms 15584 KB
04_rp02.txt TLE 4030 ms 15580 KB
04_rp03.txt TLE 4030 ms 15572 KB
04_rp04.txt TLE 4031 ms 15600 KB
04_rp05.txt TLE 4031 ms 15572 KB
04_rp06.txt TLE 4031 ms 15584 KB
04_rp07.txt TLE 4031 ms 15584 KB
04_rp08.txt TLE 4030 ms 15612 KB
04_rp09.txt TLE 4030 ms 15584 KB
04_rp10.txt TLE 4031 ms 15584 KB
sample_1.txt AC 150 ms 8664 KB
sample_2.txt AC 151 ms 8688 KB
sample_3.txt AC 151 ms 8588 KB