Submission #63304692
Source Code Expand
Copy
import numpy as npfrom collections import defaultdictn,q = map(int,input().split())opes = []for i in range(q):opes.append(list(map(int,input().split())))# current_index = [i for i in range(1,n+1)]# print(n,q,opes)nest = defaultdict(int)#初期化for i in range(1,n+1):nest[i]=i# print(nest)for op in opes:if op[0]==1:a = op[1]b = op[2]nest[a]=b# print(a,b,nest[a])# current_index[a-1]=b
import numpy as np from collections import defaultdict n,q = map(int,input().split()) opes = [] for i in range(q): opes.append(list(map(int,input().split()))) # current_index = [i for i in range(1,n+1)] # print(n,q,opes) nest = defaultdict(int) #初期化 for i in range(1,n+1): nest[i]=i # print(nest) for op in opes: if op[0]==1: a = op[1] b = op[2] nest[a]=b # print(a,b,nest[a]) # current_index[a-1]=b elif op[0]==2: a = op[1] b = op[2] for key in nest: # print(a,b) # print("key=",key) # print(nest[key]) if nest[key]==a: nest[key]=b elif nest[key]==b: nest[key]=a # print(a,b,nest) else: a = op[1] # print("OP===3") print(nest[a]) # print(nest)
Submission Info
Submission Time | |
---|---|
Task | D - Pigeon Swap |
User | sho___ |
Language | Python (CPython 3.11.4) |
Score | 0 |
Code Size | 902 Byte |
Status | TLE |
Exec Time | 2217 ms |
Memory | 174156 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 350 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 87 ms | 31712 KB |
00_sample_01.txt | AC | 87 ms | 31848 KB |
00_sample_02.txt | AC | 89 ms | 31824 KB |
01_random_03.txt | TLE | 2217 ms | 170916 KB |
01_random_04.txt | TLE | 2217 ms | 170944 KB |
01_random_05.txt | TLE | 2217 ms | 170868 KB |
01_random_06.txt | TLE | 2217 ms | 170788 KB |
01_random_07.txt | TLE | 2212 ms | 75560 KB |
01_random_08.txt | TLE | 2214 ms | 105540 KB |
01_random_09.txt | TLE | 2217 ms | 174056 KB |
01_random_10.txt | TLE | 2217 ms | 172400 KB |
01_random_11.txt | TLE | 2217 ms | 170260 KB |
01_random_12.txt | TLE | 2217 ms | 174156 KB |
01_random_13.txt | TLE | 2217 ms | 166988 KB |
01_random_14.txt | TLE | 2217 ms | 170932 KB |
01_random_15.txt | TLE | 2217 ms | 173724 KB |
01_random_16.txt | TLE | 2217 ms | 165164 KB |
01_random_17.txt | TLE | 2217 ms | 167428 KB |
01_random_18.txt | TLE | 2217 ms | 174028 KB |
01_random_19.txt | TLE | 2217 ms | 171072 KB |
01_random_20.txt | TLE | 2217 ms | 173084 KB |
01_random_21.txt | TLE | 2217 ms | 173984 KB |
01_random_22.txt | TLE | 2217 ms | 167160 KB |
01_random_23.txt | TLE | 2217 ms | 166408 KB |
01_random_24.txt | AC | 913 ms | 168864 KB |
01_random_25.txt | TLE | 2217 ms | 164812 KB |
01_random_26.txt | TLE | 2217 ms | 165900 KB |
01_random_27.txt | AC | 927 ms | 164480 KB |
01_random_28.txt | TLE | 2217 ms | 170164 KB |
01_random_29.txt | TLE | 2217 ms | 164792 KB |
01_random_30.txt | AC | 679 ms | 72328 KB |