s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time int64 0 100 | memory stringlengths 4 6 | code_size int64 15 14.7k | code stringlengths 15 14.7k | problem_id stringlengths 6 6 | problem_description stringlengths 358 9.83k | input stringlengths 2 4.87k | output stringclasses 807
values | __index_level_0__ int64 1.1k 1.22M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s909070834 | p00011 | u724548524 | 1525743126 | Python | Python3 | py | Accepted | 20 | 5600 | 165 | a = [i for i in range(int(input()) + 1)]
for _ in range(int(input())):
x, y = map(int, input().split(","))
a[x], a[y] = a[y], a[x]
[print(e) for e in a[1:]]
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,402 |
s518658475 | p00011 | u223900719 | 1526478211 | Python | Python | py | Accepted | 10 | 4648 | 171 | w=input()
n=input()
A=[ i+1 for i in range(w)]
for i in range(n):
a,b=map(int, raw_input().split(","))
ta=A[a-1]
tb=A[b-1]
A[a-1]=tb
A[b-1]=ta
for i in A:
print i
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,403 |
s832524089 | p00011 | u306037418 | 1526548982 | Python | Python3 | py | Accepted | 20 | 5604 | 211 | w = int(input())
n = int(input())
nums = [i for i in range(1, w+1)]
ab = []
for i in range(n):
a, b = map(int, input().split(','))
nums[a-1], nums[b-1] = nums[b-1], nums[a-1]
for i in nums:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,404 |
s720879751 | p00011 | u138224929 | 1526549083 | Python | Python3 | py | Accepted | 30 | 5592 | 283 | w = int(input())
n = int(input())
amida = []
for i in range(0,w+1):
amida.append(i)
for i in range(n):
ai,bi = map(int,input().split(","))
aa = amida[ai]
bb = amida[bi]
amida[ai] = bb
amida[bi] = aa
for i in range(1,w+1):
print(amida[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,405 |
s596709118 | p00011 | u136916346 | 1527356399 | Python | Python3 | py | Accepted | 30 | 5604 | 178 | w=list(range(int(input())))
sw=[list(map(int,input().split(","))) for i in range(int(input()))]
for i in sw:
w[i[0]-1],w[i[1]-1]=w[i[1]-1],w[i[0]-1]
[print(i+1) for i in w]
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,406 |
s296685260 | p00011 | u458530128 | 1528420876 | Python | Python3 | py | Accepted | 20 | 5596 | 246 | w = int(input())
n = int(input())
amida = [i for i in range(1, w + 1)]
for _ in range(n):
a, b = list(map(int, input().split(',')))
temp = amida[a - 1]
amida[a - 1] = amida[b - 1]
amida[b - 1] = temp
for i in amida:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,407 |
s184866663 | p00011 | u847467233 | 1528538420 | Python | Python3 | py | Accepted | 20 | 5604 | 256 | # AOJ 0009 Prime Number
# Python3 2018.6.9 bal4u
w = int(input())
s = [i for i in range(w+1)]
n = int(input())
for i in range(n):
a = list(map(int, input().split(',')))
s[a[0]], s[a[1]] = s[a[1]], s[a[0]]
for i in range(1, w+1):
print(s[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,408 |
s555763777 | p00011 | u531592024 | 1529325919 | Python | Python3 | py | Accepted | 20 | 5600 | 259 | arr = [i + 1 for i in range(int(input()))]
m = int(input())
for i in range(m):
inp = list(map(int, input().split(",")))
tmp = arr[inp[0] - 1]
arr[inp[0] - 1] = arr[inp[1] - 1]
arr[inp[1] - 1] = tmp
for i in range(len(arr)):
print(arr[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,409 |
s308277300 | p00011 | u575065019 | 1345568411 | Python | Python | py | Accepted | 20 | 4232 | 212 | w = input()
bar = range(w)
n = input()
p = 0
while p != n:
rev = raw_input().split(',')
bar[int(rev[0])-1],bar[int(rev[1])-1] = bar[int(rev[1])-1],bar[int(rev[0])-1]
p += 1
for i in bar:
print i+1 | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,410 |
s140509661 | p00011 | u724947062 | 1346958618 | Python | Python | py | Accepted | 20 | 4240 | 418 | import sys
w = int(sys.stdin.readline())
n = int(sys.stdin.readline())
lines = list()
for line in xrange(n):
line = sys.stdin.readline()
line = line.strip()
lines.append(map(int, line.split(",")))
def swap(yoko, nums):
a, b = yoko
a -= 1
b -= 1
tmp = nums[a]
nums[a] = nums[b]
nums[... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,411 |
s498555427 | p00011 | u719737030 | 1351000599 | Python | Python | py | Accepted | 10 | 5012 | 240 | list = [x+1 for x in xrange(int(input()))]
tmp = 0
for i in xrange(int(input())):
ch = [int(x) for x in raw_input().split(",")]
tmp = list[ch[0]-1]
list[ch[0]-1] = list[ch[1]-1]
list[ch[1]-1] = tmp
for x in list:
print x | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,412 |
s585259191 | p00011 | u647766105 | 1351001287 | Python | Python | py | Accepted | 20 | 5012 | 189 | w=input()
list=range(0,w+1)
n=input()
for i in xrange(n):
a,b=map(int,raw_input().split(','))
tmp=list[a]
list[a]=list[b]
list[b]=tmp
for i in xrange(w):
print list[i+1] | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,413 |
s413050580 | p00011 | u647766105 | 1351001449 | Python | Python | py | Accepted | 10 | 5012 | 180 | w=input()
list=range(0,w+1)
n=input()
for i in xrange(n):
a,b=map(int,raw_input().split(','))
tmp=list[a]
list[a]=list[b]
list[b]=tmp
for i in list[1:]:
print i | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,414 |
s617757894 | p00011 | u779627195 | 1352474633 | Python | Python | py | Accepted | 10 | 52000 | 338 | #coding: utf-8
while 1:
try:
v = input()
h = input()
n = range(1, v+1)
for i in xrange(h):
vl = map(int, raw_input().split(","))
n[vl[0]-1], n[vl[1]-1] = n[vl[1]-1], n[vl[0]-1]
for i in xrange(v):
print n[i]
except EOFEr... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,415 |
s306823731 | p00011 | u504990413 | 1353587112 | Python | Python | py | Accepted | 10 | 4220 | 189 | n = input()
amd = [i+1 for i in range(n)]
m = input()
for i in range(m):
a,b = map(int, raw_input().split(','))
amd[a-1],amd[b-1] = amd[b-1],amd[a-1]
for am in amd :
print am | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,416 |
s478017367 | p00011 | u647766105 | 1355066248 | Python | Python | py | Accepted | 10 | 5076 | 156 | list=range(0,input()+1)
for i in xrange(input()):
a,b=map(int,raw_input().split(','))
list[a],list[b]=list[b],list[a]
for i in list[1:]:
print i | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,417 |
s258728880 | p00011 | u735362704 | 1355236938 | Python | Python | py | Accepted | 10 | 4248 | 467 | #!/usr/bin/env python
# coding: utf-8
def func(L, pairs):
if pairs:
a, b = pairs.pop(0)
L[a], L[b] = L[b], L[a]
return func(L, pairs)
else:
return L
def main():
w = int(raw_input())
L = range(w + 1)
n = int(raw_input())
pairs = []
for i in xrange(n):
... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,418 |
s440971151 | p00011 | u419407022 | 1355381139 | Python | Python | py | Accepted | 20 | 5068 | 244 | w = int(raw_input())
n = int(raw_input())
a = []
for i in range(n):
a.append(map(int, raw_input().split(',')))
r = range(1, w + 1)
for i in a:
tmp = r[i[0] - 1]
r[i[0] - 1] = r[i[1] - 1]
r[i[1] - 1] = tmp
for i in r:
print i | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,419 |
s419601041 | p00011 | u665962315 | 1357427143 | Python | Python | py | Accepted | 10 | 4216 | 203 | amida = range(int(raw_input()) + 1)
for i in range(int(raw_input())):
a, b = map(int, raw_input().split(','))
amida[a], amida[b] = amida[b], amida[a]
for i in range(1, len(amida)): print amida[i] | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,420 |
s704215953 | p00011 | u560838141 | 1357516013 | Python | Python | py | Accepted | 10 | 4220 | 203 | amida = range(int(raw_input()) + 1)
for i in range(int(raw_input())):
a, b = map(int, raw_input().split(','))
amida[a], amida[b] = amida[b], amida[a]
for i in range(1, len(amida)): print amida[i] | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,421 |
s813994149 | p00011 | u560838141 | 1357556585 | Python | Python | py | Accepted | 10 | 4220 | 203 | amida = range(int(raw_input()) + 1)
for i in range(int(raw_input())):
a, b = map(int, raw_input().split(','))
amida[a], amida[b] = amida[b], amida[a]
for i in range(1, len(amida)): print amida[i] | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,422 |
s465595317 | p00011 | u782850731 | 1361968534 | Python | Python | py | Accepted | 10 | 4268 | 342 | from __future__ import (division, absolute_import, print_function,
unicode_literals)
from sys import stdin
L = [i + 1 for i in xrange(int(stdin.readline()))]
for _, line in zip(xrange(int(stdin.readline())), stdin):
a, b = (int(t) - 1 for t in line.split(','))
L[a], L[b] = L[b], L[a]
fo... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,423 |
s291349076 | p00011 | u282635979 | 1363413809 | Python | Python | py | Accepted | 20 | 4244 | 321 | words = []
w = input()
n = input()
change = []
for val in range(1,n+1):
x = map(int,raw_input().split(','))
change.append(x)
kekka = range(1,w+1)
for val in range(1,n+1):
a = kekka[change[val-1][0]-1]
b = kekka[change[val-1][1]-1]
kekka[change[val-1][0]-1] = b
kekka[change[val-1][1]-1] = a
for x in kekka:
print ... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,424 |
s267842674 | p00011 | u743065194 | 1363879819 | Python | Python | py | Accepted | 20 | 4244 | 284 | '''
Created on Mar 21, 2013
@author: wukc
'''
import sys
w=int(sys.stdin.readline())
n=int(sys.stdin.readline())
a=[i for i in range(w+1)]
for i in range(n):
l=sys.stdin.readline()
x,y=map(int,l.split(","))
a[x],a[y]=a[y],a[x]
print("\n".join(map(str,a[1:])))
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,425 |
s016642632 | p00011 | u585414111 | 1365788445 | Python | Python | py | Accepted | 10 | 4220 | 190 | import sys
l = range(input())
n = input()
for line in sys.stdin:
[a,b] = [int(x) for x in line.split(',')]
tmp = l[a-1]
l[a-1] = l[b-1]
l[b-1] = tmp
for i in l:
print i+1 | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,426 |
s274837616 | p00011 | u350508326 | 1368050305 | Python | Python | py | Accepted | 10 | 4236 | 268 |
def change(z,x,y):
tmp = z[x-1]
z[x-1] = z[y-1]
z[y-1] = tmp
return z
a = int(raw_input())
b = int(raw_input())
c = range(a)
while b > 0:
in1,in2 = map(int,raw_input().split(','))
c = change(c,in1,in2)
b -= 1
for p in c:
print p+1 | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,427 |
s893465178 | p00011 | u542421762 | 1368173339 | Python | Python | py | Accepted | 20 | 4352 | 843 | import sys
class Walker:
def __init__(self, n):
self.start = n
self.state = n
def jump(self, pair):
a, b = pair
if self.state == a:
self.state = b
elif self.state == b:
self.state = a
return self
def to_pair(str):
ab = str.split('... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,428 |
s197450060 | p00011 | u912237403 | 1377395534 | Python | Python | py | Accepted | 0 | 4220 | 163 | w = input()
x = range(1, w+1)
n=input()
for i in range(n):
a, b = map(int, raw_input().split(","))
x[a-1], x[b-1] = x[b-1], x[a-1]
for e in x:
print e | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,429 |
s027202546 | p00011 | u813384600 | 1379495813 | Python | Python | py | Accepted | 20 | 4228 | 183 | w = int(raw_input())
n = int(raw_input())
r = range(1,w+1)
for _ in range(n):
(a, b) = map(int, raw_input().split(','))
r[a-1], r[b-1] = r[b-1], r[a-1]
for i in r:
print i | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,430 |
s584323447 | p00011 | u523886269 | 1381039106 | Python | Python | py | Accepted | 20 | 4240 | 601 |
amida = []
def main():
num_vlines = int(raw_input());
num_wlines = int(raw_input());
init_amida(num_vlines)
count = 0;
while count < num_wlines :
ab = raw_input().strip().split(',')
# print "--- input keys ---"
# pprint.pprint(ab)
transposition(int(ab[0]), int(ab[1]))
# print "--- dump amida ---"
... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,431 |
s594796472 | p00011 | u492005863 | 1381407279 | Python | Python | py | Accepted | 10 | 4240 | 315 | # Drawing Lots
import sys
w = 0
n = 0
lots = None
for (i, line) in enumerate(sys.stdin):
if i == 0:
w = int(line)
lots = [lot for lot in xrange(1, w+1)]
elif i == 1:
n = int(line)
else:
a, b = map(int, line.split(","))
lots[b-1], lots[a-1] = lots[a-1], lots[b-1]
for i in xrange(w):
print lots[i] | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,432 |
s697767964 | p00011 | u351182591 | 1383584336 | Python | Python | py | Accepted | 10 | 4216 | 201 | w = [x+1 for x in range(input())]
for x in range(input()):
a, b = map(int, raw_input().split(","))
tempor = w[a-1]
w[a-1] = w[b-1]
w[b-1] = tempor
for x in range(len(w)):
print w[x] | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,433 |
s451426277 | p00011 | u245286435 | 1384422846 | Python | Python | py | Accepted | 20 | 4220 | 366 | import sys
def main():
tate = int(raw_input())
result = []
for i in range(1, tate+1):
result.append(i)
yoko = int(raw_input())
for line in sys.stdin.readlines():
x1, x2 = map(int, line.split(","))
x1 -= 1
x2 -= 1
temp = result[x2]
result[x2] = result[x1]
result[x1] = temp
for num in result:
pr... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,434 |
s482422387 | p00011 | u093607836 | 1384834625 | Python | Python | py | Accepted | 10 | 4208 | 180 | w = list(range(1,int(raw_input())+1))
for i in range(int(raw_input())):
a,b = map(int,raw_input().split(','))
t = w[a-1]
w[a-1] = w[b-1]
w[b-1] = t
print('\n'.join(map(str,w))) | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,435 |
s998768689 | p00011 | u093607836 | 1384834776 | Python | Python | py | Accepted | 10 | 4204 | 172 | w = list(range(1,int(raw_input())+1))
for i in range(int(raw_input())):
a,b = map(int,raw_input().split(','))
w[a-1], w[b-1] = w[b-1], w[a-1]
print('\n'.join(map(str,w))) | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,436 |
s073629052 | p00011 | u912237403 | 1391257858 | Python | Python | py | Accepted | 20 | 4208 | 136 | W=range(1,input()+1)
N=range(input())
for i in N:
a,b=map(int,raw_input().split(","))
W[a-1],W[b-1]=W[b-1],W[a-1]
for e in W:print e | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,437 |
s538690849 | p00011 | u912237403 | 1391257913 | Python | Python | py | Accepted | 10 | 4212 | 144 | W=range(1,input()+1)
N=range(input())
for i in N:
a, b = map(int,raw_input().split(","))
W[a-1], W[b-1] = W[b-1], W[a-1]
for e in W: print e | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,438 |
s153472346 | p00011 | u912237403 | 1391258012 | Python | Python | py | Accepted | 10 | 4212 | 145 | W=range(1, input()+1)
N=range(input())
for i in N:
a, b = map(int,raw_input().split(","))
W[a-1], W[b-1] = W[b-1], W[a-1]
for e in W: print e | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,439 |
s947872779 | p00011 | u912237403 | 1391258031 | Python | Python | py | Accepted | 10 | 4212 | 147 | W=range(1, input()+1)
N=range(input())
for i in N:
a, b = map(int,raw_input().split(","))
W[a-1], W[b-1] = W[b-1], W[a-1]
for e in W:
print e | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,440 |
s045789835 | p00011 | u912237403 | 1391258067 | Python | Python | py | Accepted | 10 | 4212 | 145 | W = range(1, input()+1)
for i in range(input()):
a, b = map(int,raw_input().split(","))
W[a-1], W[b-1] = W[b-1], W[a-1]
for e in W:
print e | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,441 |
s426271053 | p00011 | u912237403 | 1391258256 | Python | Python | py | Accepted | 10 | 4200 | 138 | W = range(input()+1)
for i in range(input()):
a, b = map(int,raw_input().split(","))
W[a], W[b] = W[b], W[a]
for e in W[1:]:
print e | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,442 |
s442211151 | p00011 | u912237403 | 1391258289 | Python | Python | py | Accepted | 20 | 4204 | 126 | W=range(input()+1)
for i in range(input()):
a,b=map(int,raw_input().split(","))
W[a],W[b]=W[b],W[a]
for e in W[1:]:print e | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,443 |
s497751054 | p00011 | u912237403 | 1391258308 | Python | Python | py | Accepted | 10 | 4204 | 130 | W=range(input()+1)
for i in range(input()):
a,b=map(int,raw_input().split(","))
W[a], W[b] = W[b], W[a]
for e in W[1:]:print e | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,444 |
s545382617 | p00011 | u230836528 | 1392273398 | Python | Python | py | Accepted | 10 | 4220 | 571 | # -*- coding: utf-8 -*-
import sys
lineNumber = 0
#for line in [ "5", "4", "2,4", "3,5", "1,2", "3,4" ]:
for line in sys.stdin.readlines():
lineNumber += 1
# get data
List = map(int, line.strip().split(","))
# initial parameter
if lineNumber == 1:
w = List[0]
array = [i for i in... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,445 |
s757836953 | p00011 | u124909914 | 1393230551 | Python | Python | py | Accepted | 10 | 4204 | 186 | list = range(1, input() + 1)
for i in range(input()):
a, b = map(int, raw_input().split(','))
a -= 1
b -= 1
list[a], list[b] = list[b], list[a]
for i in list:
print i | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,446 |
s110241403 | p00011 | u633068244 | 1393356732 | Python | Python | py | Accepted | 10 | 4216 | 212 | w = int(raw_input())
n = int(raw_input())
s = [i+1 for i in range(w)]
for i in range(n):
a, b = map(int, raw_input().split(","))
tmp = s[a-1]
s[a-1] = s[b-1]
s[b-1] = tmp
for i in s:
print i | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,447 |
s872594072 | p00011 | u858885710 | 1393919924 | Python | Python | py | Accepted | 10 | 4216 | 193 | num = [x for x in range(1,int(raw_input())+1)]
n = int(raw_input())
for i in range(n):
s,t = map(int, raw_input().split(','))
num[s-1],num[t-1] = num[t-1],num[s-1]
for j in num: print j | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,448 |
s107849255 | p00011 | u256688954 | 1394621867 | Python | Python | py | Accepted | 10 | 4216 | 223 | w=int(raw_input())
n=int(raw_input())
ret=range(1,w+1)
for i in range(0,n):
ab = map(int,raw_input().split(","))
tmp = ret[ab[0]-1]
ret[ab[0]-1] = ret[ab[1]-1]
ret[ab[1]-1] = tmp
for i in ret:
print i | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,449 |
s522293993 | p00011 | u193025715 | 1395395519 | Python | Python | py | Accepted | 10 | 4228 | 308 | w = int(raw_input())
bars = []
ans = [0 for i in range(w)]
for i in range(int(raw_input())):
bars.append(map(int, raw_input().split(',')))
for i, j in zip(range(1, w+1),range(0,w)):
for bar in bars:
if bar[0] == i:
i = bar[1]
elif bar[1] == i:
i = bar[0]
ans[i-1] = j+1
for s in ans:
print s | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,450 |
s792054830 | p00011 | u491763171 | 1396395219 | Python | Python | py | Accepted | 10 | 4204 | 173 | w = input()
L = range(1, w + 1)
for i in range(input()):
a, b = map(int, raw_input().split(','))
L[a - 1], L[b - 1] = L[b - 1], L[a - 1]
print '\n'.join(map(str, L)) | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,451 |
s779750546 | p00011 | u246033265 | 1396612755 | Python | Python | py | Accepted | 10 | 4204 | 165 | a = range(int(raw_input()) + 1)
for i in range(int(raw_input())):
p, q = map(int, raw_input().split(','))
a[p], a[q] = a[q], a[p]
for p in a[1:]:
print p | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,452 |
s984954173 | p00011 | u708217907 | 1398122335 | Python | Python | py | Accepted | 10 | 4212 | 195 | w = int(raw_input())
n = int(raw_input())
arr = range(1, w+1)
for i in range(n):
a, b = map(int, raw_input().split(','))
arr[a-1], arr[b-1] = arr[b-1], arr[a-1]
for a in arr:
print '%d'%a | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,453 |
s790071813 | p00011 | u747479790 | 1398135021 | Python | Python | py | Accepted | 10 | 4224 | 233 | w = int(raw_input())
n = int(raw_input())
a = []
for i in range(n):
a.append(map(int, raw_input().split(',')))
r = range(1,w + 1)
for i in a:
tmp = r[i[0] - 1]
r[i[0] - 1] = r[i[1] - 1]
r[i[1] - 1] = tmp
for i in r:
print i | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,454 |
s211125584 | p00011 | u436634575 | 1401131200 | Python | Python3 | py | Accepted | 30 | 6724 | 192 | w = int(input())
x = [i for i in range(w + 1)]
n = int(input())
for i in range(n):
a, b = map(int, input().split(','))
x[a], x[b] = x[b], x[a]
for i in range(1, w + 1):
print(x[i]) | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,455 |
s425455756 | p00011 | u618672141 | 1403748696 | Python | Python3 | py | Accepted | 30 | 6724 | 208 | v = int(input())
h = int(input())
l = [i for i in range(1, v + 1)]
for i in range(h):
n, m = input().split(',')
n = int(n) - 1
m = int(m) - 1
l[n], l[m] = l[m], l[n]
for i in l:
print(i) | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,456 |
s660886706 | p00011 | u747915832 | 1597113936 | Python | Python3 | py | Accepted | 30 | 5596 | 211 | w = int(input())
wlist = list(range(1,w+1))
n = int(input())
for i in range(n):
a, b = map(int, input().split(','))
wlist[a-1], wlist[b-1] = wlist[b-1], wlist[a-1]
for i in range(w):
print(wlist[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,457 |
s349728855 | p00011 | u986283797 | 1596013199 | Python | Python3 | py | Accepted | 20 | 5596 | 291 | n=int(input())
k=int(input())
li=[]
for i in range(1, n+1):
li.append(i)
#print(li)
for i in range(k):
x=list(map(int,input().split(",")))
li[x[0]-1]^=li[x[1]-1]
li[x[1]-1]^=li[x[0]-1]
li[x[0]-1]^=li[x[1]-1]
#print(*li)
for i in range(n):
print(li[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,458 |
s584284867 | p00011 | u240091169 | 1594866308 | Python | Python3 | py | Accepted | 20 | 5596 | 199 | w = int(input())
n = int(input())
lst = [i for i in range(1, w+1)]
for i in range(n) :
a, b = map(int, input().split(','))
lst[a-1], lst[b-1] = lst[b-1], lst[a-1]
for i in lst :
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,459 |
s706578102 | p00011 | u842461513 | 1593344956 | Python | Python3 | py | Accepted | 20 | 5600 | 357 | #空リストと1~入力値までの数字を入れたリストを作成する
line = []
for i in range(1,int(input()) + 1):line.append(i)
#何処と何処を交換するかを入力し交換する
for _ in range(int(input())):
a,b = map(int,input().split(","))
line[a - 1],line[b - 1] = line[b - 1],line[a - 1]
#出力
for s in line:print(s)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,460 |
s122515904 | p00011 | u187074069 | 1592483619 | Python | Python3 | py | Accepted | 20 | 5596 | 247 | w = int(input())
n = int(input())
wlst = [i for i in range(1, w+1)]
for i in range(n):
inputlst = list(map(int, input().split(',')))
a, b = inputlst[0]-1, inputlst[1]-1
wlst[a], wlst[b] = wlst[b], wlst[a]
for i in wlst:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,461 |
s386575615 | p00011 | u260980560 | 1588729510 | Python | Python3 | py | Accepted | 20 | 5596 | 169 | W = int(input())
N = int(input())
*R, = range(1, W+1)
for i in range(N):
a, b = map(int, input().split(","))
R[a-1], R[b-1] = R[b-1], R[a-1]
print(*R, sep='\n')
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,462 |
s599912216 | p00011 | u996936922 | 1588182597 | Python | Python3 | py | Accepted | 20 | 5604 | 198 | w = int(input())
s = [i for i in range(1,w+1)]
n = int(input())
for i in range(n):
a = list(map(int, input().split(',')))
s[a[0]-1],s[a[1]-1] = s[a[1]-1],s[a[0]-1]
for i in s:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,463 |
s277069813 | p00011 | u490578380 | 1584695411 | Python | Python3 | py | Accepted | 20 | 5596 | 277 | numList = []
for i in range(int(input())):
numList.append(i + 1)
for i in range(int(input())):
a, b = list(map(int, input().split(',')))
a, b = a - 1, b - 1
tmp = numList[a]
numList[a] = numList[b]
numList[b] = tmp
for num in numList:
print(num)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,464 |
s824011676 | p00011 | u630911389 | 1584197774 | Python | Python3 | py | Accepted | 20 | 5604 | 445 | table = [(0,0)] * 31
dp = [0] * 31
w = int(input())
h = int(input())
for i in range(1,h + 1):
a,b = (int(_) for _ in input().split(","))
table[i] = (a,b)
# あみだくじ
for i in range(1,w + 1):
dest = i
for j in range(1,h + 1):
if table[j][0] == dest:
dest = table[j][1]
elif table... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,465 |
s822474397 | p00011 | u813197825 | 1580750032 | Python | Python3 | py | Accepted | 20 | 5596 | 348 | W = int(input())
N = int(input())
C = [[-1 for j in range(W)] for i in range(N)]
for i in range(N):
a, b = map(lambda x:int(x) - 1, input().split(','))
C[i][a] = b
C[i][b] = a
A = [-1] * W
for n in range(W):
j = n
for i in range(N):
if C[i][j] >= 0:
j = C[i][j]
A[j] = n + ... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,466 |
s385002818 | p00011 | u016759743 | 1577588539 | Python | Python3 | py | Accepted | 20 | 5600 | 422 | W = int(input());#list(map(int, input().split()))
N = int(input());#list(map(int, input().split()))
field=[[-1 for i in range(W)] for j in range(N)]
for i in range(N):
a,b=list(map(int, input().split(',')))
field[i][a-1]=b-1;
field[i][b-1]=a-1;
result=[0 for i in range(W)];
for i in range(W):
now=i;
for j in ra... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,467 |
s379109856 | p00011 | u942532706 | 1575467652 | Python | Python3 | py | Accepted | 20 | 5600 | 225 | w = int(input())
n = int(input())
lv = [i for i in range(1, w+1)]
for _ in range(n):
a, b = list(map(int, input().split(",")))
tmp = lv[a - 1]
lv[a - 1] = lv[b - 1]
lv[b - 1] = tmp
for v in lv:
print(v)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,468 |
s543305156 | p00011 | u933957884 | 1573368193 | Python | Python3 | py | Accepted | 20 | 5596 | 173 | n = int(input())
m = int(input())
p = list(range(n+1))
for i in range(m):
a, b = map(int, input().split(","))
p[a], p[b] = p[b], p[a]
for v in p[1:]:
print(v)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,469 |
s732019303 | p00011 | u228380278 | 1573262252 | Python | Python3 | py | Accepted | 20 | 5596 | 203 | n = int(input())
h = int(input())
arr = list(range(1, n + 1))
for _ in range(h):
a, b = map(int, input().split(','))
arr[a - 1], arr[b - 1] = arr[b - 1], arr[a - 1]
for ai in arr:
print(ai)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,470 |
s034277383 | p00011 | u037441960 | 1570769780 | Python | Python3 | py | Accepted | 30 | 5596 | 459 | w = int(input())
n = int(input())
A = list()
B = list()
S = [i for i in range(1, w + 1)]
G = [0 for i in range(w)]
for i in range(n) :
a , b = map(int, input().split(","))
A.append(a)
B.append(b)
for i in range(1, w + 1) :
g = i
for j in range(n) :
if(A[j] == g) :
g = B[j... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,471 |
s114166743 | p00011 | u803862921 | 1570622304 | Python | Python3 | py | Accepted | 20 | 5596 | 183 | w = int(input())
n = int(input())
L = list(range(1,w+1))
for i in range(n):
a, b = [int(x)-1 for x in input().split(",")]
L[a], L[b] = L[b], L[a]
for i in L:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,472 |
s910081048 | p00011 | u595265835 | 1570452618 | Python | Python3 | py | Accepted | 20 | 5592 | 211 | w = int(input())
n = int(input())
a = range(w)
a = list(a)
for i in range(n):
p, q = map(int, input().split(","))
t = a[p - 1]
a[p - 1] = a[q - 1]
a[q - 1] = t
for each in a:
print(each + 1)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,473 |
s347052867 | p00011 | u824708460 | 1566212899 | Python | Python3 | py | Accepted | 20 | 5600 | 190 | w = int(input())
n = int(input())
c = list(range(0, w+1))
for i in range(n):
a, b = map(int, input().split(','))
c[a], c[b] = c[b], c[a]
for i in range(1, w + 1):
print(c[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,474 |
s752448763 | p00011 | u212392281 | 1564850847 | Python | Python3 | py | Accepted | 20 | 5600 | 187 | w = int(input())
n = int(input())
l = list(range(1,w+1))
for i in range(n):
a, b = map(int, input().split(","))
l[a-1], l[b-1] = l[b-1], l[a-1]
for i in range(w):
print(l[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,475 |
s760877214 | p00011 | u427219397 | 1564726623 | Python | Python3 | py | Accepted | 20 | 5600 | 176 | s = [i + 1 for i in range(int(input()))]
n = int(input())
for _ in range(n):
a , b = map(int, input().split(","))
s[a-1], s[b-1] = s[b-1], s[a-1]
for i in s:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,476 |
s356148201 | p00011 | u529337794 | 1564705447 | Python | Python3 | py | Accepted | 20 | 5596 | 160 | a=[int(i+1) for i in range(int(input()))]
for i in range(int(input())):
b,c=map(int,input().split(','))
a[b-1],a[c-1]=a[c-1],a[b-1]
for i in a:print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,477 |
s046046998 | p00011 | u090921599 | 1563716379 | Python | Python3 | py | Accepted | 20 | 5596 | 203 | w = int(input())
s = [i for i in range(w+1)]
n = int(input())
for i in range(n):
a = list(map(int,input().split(",")))
s[a[0]], s[a[1]] = s[a[1]], s[a[0]]
for i in range(1, w+1):
print(s[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,478 |
s903566554 | p00011 | u314166831 | 1561902160 | Python | Python3 | py | Accepted | 30 | 5744 | 1,977 | # coding=utf-8
###
### for atcorder program
###
import sys
import math
import array
# math class
class mymath:
### pi
pi = 3.14159265358979323846264338
### Prime Number
def pnum_eratosthenes(self, n):
ptable = [0 for i in range(n+1)]
plist = []
for i in range(2, n+1):
... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,479 |
s908411787 | p00011 | u548252256 | 1560159983 | Python | Python3 | py | Accepted | 20 | 5604 | 228 | if __name__ == '__main__':
line = int(input())
A = [i+1 for i in range(line)]
n = int(input())
for _ in range(n):
j,k = map(int,input().split(","))
A[j-1],A[k-1] = A[k-1],A[j-1]
for i in range(line):
print(A[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,480 |
s589513386 | p00011 | u923573620 | 1560152589 | Python | Python3 | py | Accepted | 20 | 5596 | 525 | a = []
b = []
numbers_s = []
numbers_g = []
w = int(input())
n = int(input())
for i in range(0, n):
temp_a, temp_b = input().split(',')
a.append(int(temp_a))
b.append(int(temp_b))
for i in range(0, w):
numbers_s.append(i+1)
numbers_g.append(0)
for i in range(0, w):
temp_idx = i+1
for j... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,481 |
s209243991 | p00011 | u506537276 | 1560144157 | Python | Python3 | py | Accepted | 20 | 5600 | 209 | w = int(input())
c = [i for i in range(1, w + 1)]
n = int(input())
for i in range(n):
a, b = map(int, input().split(","))
r = c[a - 1]
c[a - 1] = c[b - 1]
c[b - 1] = r
for i in range(w):
print(c[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,482 |
s299573050 | p00011 | u647694976 | 1554861393 | Python | Python3 | py | Accepted | 20 | 5600 | 404 | def amida():
line_number=int(input())
line=[]
for j in range(1,line_number+1):
line.append(j)
yoko=int(input())
for i in range(yoko):
a,b=map(int,input().split(","))
line[a-1],line[b-1]=line[b-1],line[a-1]
return line
while True:
try:
ans=amida()
for i... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,483 |
s810534703 | p00011 | u625806423 | 1553778259 | Python | Python3 | py | Accepted | 20 | 5600 | 187 | w = [i for i in range(int(input()))]
n = int(input())
for i in range(n):
a, b = map(int, input().split(","))
w[a-1], w[b-1] = w[b-1], w[a-1]
for i in range(len(w)):
print(w[i]+1)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,484 |
s824724263 | p00011 | u350155409 | 1552315818 | Python | Python3 | py | Accepted | 20 | 5608 | 198 | w = int(input())
n = int(input())
l = [i for i in range(1, w+1)]
for i in range(n):
(a,b) = map(lambda x:int(x)-1, input().strip().split(","))
(l[a],l[b]) = (l[b],l[a])
print(*l,sep="\n")
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,485 |
s484327695 | p00011 | u733798831 | 1550505355 | Python | Python3 | py | Accepted | 20 | 5596 | 198 | w=int(input())
n=int(input())
S=[i for i in range(1,w+1)]
for i in range(n):
a,b = [int(i) for i in input().split(",")]
tmp=S[a-1]
S[a-1]=S[b-1]
S[b-1]=tmp
for i in S:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,486 |
s253699594 | p00011 | u689047545 | 1547131186 | Python | Python3 | py | Accepted | 20 | 5596 | 432 | if __name__ == '__main__':
w = int(input())
n = int(input())
lst = []
anslst = [0 for i in range(w)]
for i in range(n):
a, b = map(int, input().split(','))
lst.append((a,b))
for i in range(1,w+1):
x = i
for (f,s) in lst:
if f == x:
x =... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,487 |
s464948888 | p00011 | u537067968 | 1547104886 | Python | Python3 | py | Accepted | 20 | 5600 | 223 | #import math
w = int(input())
n = int(input())
field = [i for i in range(w+1)]
for i in range(n):
a,b = map(int,input().split(","))
field[a],field[b] = field[b],field[a]
for i in range(1,w+1):
print(field[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,488 |
s390136028 | p00011 | u158979022 | 1544456066 | Python | Python3 | py | Accepted | 20 | 5592 | 182 | w = int(input())
n = int(input())
l = list(range(1, w+1))
for i in range(n):
a, b = map(int, input().split(','))
a -= 1
b -= 1
l[a], l[b] = l[b], l[a]
for i in l:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,489 |
s762845080 | p00011 | u742505495 | 1543823822 | Python | Python3 | py | Accepted | 20 | 5608 | 263 | w=int(input())
num=[i+1 for i in range(w)]
n=int(input())
for i in range(n):
data=list(map(int,input().split(",")))
a=num[data[0]-1]
num[data[0]-1]=num[data[1]-1]
num[data[1]-1]=a
for i in range(w):
if i==w-1:
print(num[i],end="\n")
else:
print(num[i])
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,490 |
s367601756 | p00011 | u205574338 | 1542601633 | Python | Python3 | py | Accepted | 20 | 5600 | 176 | w=int(input())
n=int(input())
lst=[i+1 for i in range(w)]
for i in range(n):
x,y=map(int,input().split(","))
lst[x-1],lst[y-1]=lst[y-1],lst[x-1]
for i in lst:print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,491 |
s649582205 | p00011 | u563075864 | 1542255444 | Python | Python3 | py | Accepted | 20 | 5604 | 293 | w = int(input())
n = int(input())
def swap(nlist,i,j):
temp = nlist[i-1]
nlist[i-1] = nlist[j-1]
nlist[j-1] = temp
return nlist
nlist = [i+1 for i in range(w)]
for i in range(n):
i,j = [int(a) for a in input().split(',')]
swap(nlist,i,j)
for i in nlist:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,492 |
s531764422 | p00011 | u067299340 | 1542098264 | Python | Python3 | py | Accepted | 20 | 5596 | 218 | w = int(input())
n = int(input())
amida = [i for i in range(1, w + 1)]
for _ in range(n):
a, b = [int(i) - 1 for i in input().split(",")]
amida[a], amida[b] = amida[b], amida[a]
for x in amida:
print(x)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,493 |
s316603969 | p00011 | u717526540 | 1541639253 | Python | Python3 | py | Accepted | 30 | 5596 | 406 | w = int(input())
n = int(input())
alist = []
blist = []
for _ in range(n):
a, b = map(int, input().split(","))
alist.append(a)
blist.append(b)
ans = [0] * w
for i in range(1, w+1):
position = i
for a, b in zip(alist, blist):
if a == position:
position = b
elif b == pos... | p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,494 |
s263153115 | p00011 | u219940997 | 1537446805 | Python | Python3 | py | Accepted | 20 | 5612 | 365 | w = int(input()) # 縦線
n = int(input()) # 横線
combine = [list(map(int, input().split(","))) for _ in range(n)] # 横棒の終始
answer = list(range(1, w+1)) # 回答
# 終始入れ替え
for com in combine:
x, y = com
answer[x-1], answer[y-1] = answer[y-1], answer[x-1]
# 出力(改行あり)
print('\n'.join(map(str, answer)))
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,495 |
s335400943 | p00011 | u319725914 | 1534213825 | Python | Python3 | py | Accepted | 20 | 5596 | 175 | w = int(input())
wa = list(range(w+1))
n = int(input())
for _ in range(n):
a,b = map(int, input().split(","))
wa[a],wa[b] = wa[b],wa[a]
for s in wa[1:]:
print(s)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,496 |
s856639129 | p00011 | u248155947 | 1533627888 | Python | Python3 | py | Accepted | 20 | 5604 | 195 | w = int(input())
n = int(input())
kuji = [i+1 for i in range(w)]
for _ in range(n):
a, b = map(int, input().split(','))
kuji[a-1], kuji[b-1] = kuji[b-1], kuji[a-1]
print(*kuji, sep="\n")
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,497 |
s892526571 | p00011 | u252700163 | 1532751921 | Python | Python3 | py | Accepted | 20 | 5596 | 190 | w = int(input())
bs = [ x+1 for x in range(w)]
n = int(input())
for i in range(n):
a, b = map(lambda x:int(x)-1, input().split(','))
bs[a], bs[b] = bs[b], bs[a]
[print(b) for b in bs]
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,498 |
s052491786 | p00011 | u539753516 | 1532323637 | Python | Python3 | py | Accepted | 20 | 5592 | 175 | ans=list(range(1,int(input())+1))
for i in range(int(input())):
a,b=map(lambda x: int(x)-1,input().split(","))
ans[a],ans[b]=ans[b],ans[a]
for i in ans:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,499 |
s216977384 | p00011 | u853158149 | 1521970312 | Python | Python3 | py | Accepted | 20 | 5596 | 218 | w = int(input())
n = int(input())
amida = [i+1 for i in range(w)]
for i in range(n):
a,b = map(int,input().split(","))
v = amida[a-1]
amida[a-1] = amida[b-1]
amida[b-1] = v
for i in amida:
print(i)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,500 |
s843696083 | p00011 | u079141094 | 1467344115 | Python | Python3 | py | Accepted | 30 | 7580 | 186 | # Drawing Lots
W = [i+1 for i in range(int(input()))]
n = int(input())
for _ in range(n):
a,b = map(int, input().split(','))
W[a-1], W[b-1] = W[b-1], W[a-1]
for w in W: print(w)
| p00011 |
<H1>Drawing Lots</H1>
<p>
Let's play Amidakuji.
</p>
<p>
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
</p>
<center>
<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_amida1">
</center>
<br>
<p>... | 5
4
2,4
3,5
1,2
3,4
| 4
1
2
5
3
| 5,501 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.