結果

問題 No.429 CupShuffle
ユーザー hanorverhanorver
提出日時 2016-10-03 00:06:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 458 ms / 2,000 ms
コード長 335 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 25,096 KB
最終ジャッジ日時 2024-05-01 11:00:56
合計ジャッジ時間 3,146 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,880 KB
testcase_03 AC 30 ms
10,880 KB
testcase_04 AC 33 ms
10,752 KB
testcase_05 AC 31 ms
10,880 KB
testcase_06 AC 33 ms
10,880 KB
testcase_07 AC 33 ms
10,880 KB
testcase_08 AC 30 ms
10,880 KB
testcase_09 AC 33 ms
10,752 KB
testcase_10 AC 69 ms
12,288 KB
testcase_11 AC 454 ms
25,092 KB
testcase_12 AC 412 ms
25,096 KB
testcase_13 AC 458 ms
25,092 KB
testcase_14 AC 451 ms
25,096 KB
testcase_15 AC 30 ms
10,880 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:3: SyntaxWarning: invalid decimal literal
  v=[j+1for j in range(n)]

ソースコード

diff #

i=input
n,k,x=map(int,i().split())
v=[j+1for j in range(n)]
t=[]
for _ in [0]*k:
 a,b=i().split()
 if a=="?":t=v[:]
 else:a=int(a);b=int(b);v[a-1],v[b-1]=v[b-1],v[a-1]
c=list(map(int,input().split()))
w1=w2=-1
for j in range(n):
 if c[j]!=v[j]:
  if w1==-1:w1=t.index(c[j])+1
  else:w2=t.index(c[j])+1
if w1>w2:w1,w2=w2,w1
print(w1,w2)
0