Submission #7613103


Source Code Expand

from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque



def main():
    tate_num, yoko_num, d = map(int, input(). split())
    data = list(map(int, input().split()))

    goal_data = [0 for i in range(tate_num + 1)]
    for i in range(1, tate_num + 1):
        now_tate = i
        for j in range(yoko_num):
            if data[j] == now_tate:
                now_tate += 1
            elif data[j] == now_tate - 1:
                now_tate -= 1
        goal_data[i] = now_tate

    for i in range(1, tate_num + 1):
        count = 0
        start = i
        now_tate = i
        while 1:
            now_tate = goal_data[now_tate]
            count += 1
            if now_tate == start:
                break
        amari = d % count
        for j in range(amari):
            now_tate = goal_data[now_tate]
        print(now_tate)







if __name__ == '__main__':
    main()

Submission Info

Submission Time
Task D - 阿弥陀
User traymihael
Language PyPy3 (2.4.0)
Score 40
Code Size 1122 Byte
Status TLE
Exec Time 4208 ms
Memory 79220 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 × 5
TLE × 24
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 4207 ms 77172 KB
01_random01.txt AC 170 ms 38256 KB
01_random02.txt AC 174 ms 38256 KB
01_random03.txt AC 171 ms 38508 KB
01_random04.txt AC 286 ms 45272 KB
01_random05.txt TLE 4205 ms 48696 KB
01_random06.txt TLE 4207 ms 62572 KB
01_random07.txt TLE 4208 ms 77172 KB
02_i.txt AC 201 ms 40300 KB
02_p.txt AC 213 ms 42220 KB
02_random01.txt AC 170 ms 38256 KB
02_random02.txt AC 169 ms 38256 KB
02_random03.txt AC 214 ms 41708 KB
02_random04.txt AC 198 ms 39276 KB
02_random05.txt AC 252 ms 42348 KB
02_random06.txt AC 442 ms 51820 KB
02_random07.txt AC 658 ms 64260 KB
02_random08.txt AC 661 ms 64388 KB
02_rp01.txt AC 214 ms 40812 KB
02_rp02.txt AC 203 ms 40940 KB
02_rp03.txt AC 206 ms 40940 KB
02_rp04.txt AC 205 ms 41324 KB
02_rp05.txt AC 202 ms 40940 KB
03_i.txt AC 176 ms 38636 KB
03_random01.txt AC 180 ms 40044 KB
03_random02.txt AC 228 ms 61292 KB
03_random03.txt AC 212 ms 56812 KB
03_random04.txt AC 220 ms 56812 KB
03_random05.txt AC 191 ms 41580 KB
03_random06.txt AC 186 ms 41324 KB
03_random07.txt AC 190 ms 43244 KB
03_random08.txt AC 180 ms 39660 KB
03_random09.txt AC 199 ms 45592 KB
03_random10.txt AC 211 ms 50796 KB
03_random11.txt AC 232 ms 59372 KB
03_random12.txt AC 234 ms 61164 KB
03_random13.txt AC 223 ms 56300 KB
03_random14.txt AC 214 ms 52460 KB
03_random15.txt AC 191 ms 43628 KB
04_i.txt TLE 4208 ms 77172 KB
04_p1.txt TLE 4207 ms 56964 KB
04_p2.txt TLE 4206 ms 50668 KB
04_random01.txt TLE 4206 ms 54268 KB
04_random02.txt TLE 4205 ms 49268 KB
04_random03.txt AC 2407 ms 53988 KB
04_random04.txt AC 3403 ms 70636 KB
04_random05.txt TLE 4206 ms 62308 KB
04_random06.txt TLE 4206 ms 51948 KB
04_random07.txt TLE 4206 ms 73964 KB
04_random08.txt TLE 4207 ms 69100 KB
04_random09.txt TLE 4207 ms 73452 KB
04_random10.txt TLE 4205 ms 50416 KB
04_random11.txt TLE 4208 ms 77172 KB
04_random12.txt TLE 4207 ms 79220 KB
04_random13.txt TLE 4208 ms 77172 KB
04_rp01.txt TLE 4207 ms 56952 KB
04_rp02.txt TLE 4206 ms 59068 KB
04_rp03.txt TLE 4207 ms 56952 KB
04_rp04.txt TLE 4206 ms 59072 KB
04_rp05.txt TLE 4207 ms 56952 KB
04_rp06.txt TLE 4207 ms 56952 KB
04_rp07.txt TLE 4206 ms 59068 KB
04_rp08.txt TLE 4207 ms 56956 KB
04_rp09.txt TLE 4206 ms 59084 KB
04_rp10.txt TLE 4207 ms 56952 KB
sample_1.txt AC 180 ms 38508 KB
sample_2.txt AC 184 ms 38508 KB
sample_3.txt AC 178 ms 38508 KB