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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s243793687 | p00011 | u777299405 | 1447144061 | Python | Python3 | py | Accepted | 30 | 7668 | 320 | w = int(input())
n = int(input())
lines = []
for i in range(n):
a, b = map(int, input().split(","))
lines.append([a, b])
lines = list(reversed(lines))
for j in range(1, w + 1):
for line in lines:
if line[0] == j:
j = line[1]
elif line[1] == j:
j = line[0]
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,302 |
s379189261 | p00011 | u777299405 | 1447229296 | Python | Python3 | py | Accepted | 20 | 7600 | 188 | w = int(input()) + 1
l = [i for i in range(w)]
n = int(input())
for i in range(n):
a, b = map(int, input().split(","))
l[a], l[b] = l[b], l[a]
for i in range(1, 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,303 |
s192476986 | p00011 | u775586391 | 1448030422 | Python | Python3 | py | Accepted | 20 | 7676 | 176 | w = int(input())
n = int(input())
l = [i for i in range(1,w+1)]
while n > 0:
a,b = map(int,input().split(','))
l[a-1],l[b-1] = l[b-1],l[a-1]
n -= 1
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,304 |
s273917313 | p00011 | u461370825 | 1449736491 | Python | Python | py | Accepted | 10 | 6336 | 283 | while True:
try:
n = int(raw_input())
ans = [i for i in range(n+1)]
m = int(raw_input())
for i in range(m):
a, b = map(int, raw_input().strip().split(','))
t = ans[a]
ans[a] = ans[b]
ans[b] = t
ans = ans[1:]
for x in ans:
print x
except EOFError:
break | 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,305 |
s600846072 | p00011 | u560214129 | 1450429492 | Python | Python3 | py | Accepted | 30 | 7588 | 213 | w=int(input())
n=int(input())
a=[]
for i in range(w):
a.append(i+1)
for i in range(n):
m, n= map(int,input().split(','))
temp=a[m-1]
a[m-1]=a[n-1]
a[n-1]=temp
for i in range(w):
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,306 |
s044914878 | p00011 | u825618558 | 1451511616 | Python | Python3 | py | Accepted | 20 | 7548 | 331 | import sys
lines = sys.stdin.readlines()
w = lines[0]
n = lines[1]
exchanges = lines[2:len(lines)]
ret = list(range(1,int(w)+1))
for line in exchanges:
line = line.split(",")
inp = []
for i in line:
inp.append(int(i))
ret[inp[0]-1],ret[inp[1]-1] = ret[inp[1]-1],ret[inp[0]-1]
for i in ret:
... | 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,307 |
s449982820 | p00011 | u797673668 | 1452312626 | Python | Python3 | py | Accepted | 20 | 7576 | 188 | w, n = int(input()), int(input())
l = list(range(w + 1))
for _ in range(n):
a, b = map(int, input().split(','))
l[a], l[b] = l[b], l[a]
print('\n'.join([str(i) for i in l[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,308 |
s110686993 | p00011 | u512342660 | 1455170491 | Python | Python | py | Accepted | 10 | 6248 | 310 | #! -*- coding:utf-8 -*-
def replace(num1,num2,nums):
tmp = nums[num1-1]
nums[num1-1]=nums[num2-1]
nums[num2-1]=tmp
w = input()
nums = [x+1 for x in xrange(w)]
n = input()
for x in xrange(n):
num1,num2 = map(int,raw_input().split(","))
replace(num1,num2,nums)
for num in nums:
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,309 |
s372827054 | p00011 | u867824281 | 1457273865 | Python | Python | py | Accepted | 10 | 6244 | 376 | while True:
try:
n = int(raw_input())
ans = [i for i in range(n+1)]
m = int(raw_input())
for i in range(m):
a, b = map(int, raw_input().strip().split(','))
t = ans[a]
ans[a] = ans[b]
ans[b] = t
ans = ans[1:]
for x in ans... | 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,310 |
s157896667 | p00011 | u766477342 | 1457866067 | Python | Python3 | py | Accepted | 30 | 7640 | 301 | w = int(input())
n = int(input())
l = [list(map(int, input().split(','))) for x in range(n)]
res = [0] * (w + 1)
for i in range(1, w + 1):
c = i
for a in l:
if a[0] == c:
c = a[1]
elif a[1] == c:
c = a[0]
res[c] = i
for r in res[1:]:
print(r) | 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,311 |
s243647565 | p00011 | u766477342 | 1457866565 | Python | Python3 | py | Accepted | 20 | 7672 | 263 | w = int(input())
n = int(input())
l = list(reversed([list(map(int, input().split(','))) for x in range(n)]))
for i in range(1, w + 1):
c = i
for a in l:
if a[0] == c:
c = a[1]
elif a[1] == c:
c = a[0]
print(c) | 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,312 |
s254797223 | p00011 | u075836834 | 1458242380 | Python | Python3 | py | Accepted | 20 | 7664 | 173 | w=int(input())
n=int(input())
A=[int(i+1) for i in range(w)]
for i in range(n):
x,y=map(int,input().split(','))
A[x-1],A[y-1]=A[y-1],A[x-1]
for i in range(w):
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,313 |
s306872850 | p00011 | u650459696 | 1458381512 | Python | Python3 | py | Accepted | 20 | 7556 | 197 | W = int(input())
ary = list(range(1, W + 1))
N = int(input())
for i in range(N):
x,y = map(int,input().split(','))
ary[x - 1], ary[y - 1] = ary[y - 1], ary[x - 1]
for i in ary:
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,314 |
s446095647 | p00011 | u148101999 | 1458811314 | Python | Python | py | Accepted | 20 | 6360 | 397 | #encoding=utf-8
me,ans = [],[]
x = input()
y = input()
for i in xrange(y):
me.append(map(int,raw_input().split(",")))
for i in xrange(x):
i += 1
for j in xrange(y):
if i == me[j][0]:
i = me[j][1]
elif i == me[j][1]:
i = me[j][0]
ans.append(i)
for i in xrange(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,315 |
s733660262 | p00011 | u442472098 | 1459220155 | Python | Python3 | py | Accepted | 20 | 7668 | 310 | #!/usr/bin/env python3
def main():
w = int(input())
n = int(input())
nums = list(range(1, w + 1))
for _ 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)
if __name__ == '__main__':
main() | 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,316 |
s934391908 | p00011 | u915343634 | 1459581847 | Python | Python | py | Accepted | 10 | 6240 | 310 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
w = int(input())
n = int(input())
lst = range(1, w+1)
for num in sys.stdin:
nums = num.split(",")
a1 = int(nums[0]) - 1
b1 = int(nums[1]) - 1
a2 = lst[a1]
b2 = lst[b1]
lst[a1] = b2
lst[b1] = a2
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,317 |
s452041402 | p00011 | u130979865 | 1459902892 | Python | Python | py | Accepted | 10 | 6444 | 254 | # -*- coding: utf-8 -*-
w = int(raw_input())
num = []
for i in range(w+1):
num.append(i)
n = int(raw_input())
for i in range(n):
a, b = map(int, raw_input().split(','))
num[a], num[b] = num[b], num[a]
for i in range(1, w+1):
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,318 |
s931176110 | p00011 | u572790226 | 1460124552 | Python | Python3 | py | Accepted | 20 | 7516 | 230 | w = int(input())
Ver = list(range(1, w+1))
n = int(input())
for i in range(n):
j, k = map(int, input().split(','))
temp = Ver[j-1]
Ver[j-1] = Ver[k-1]
Ver[k-1] = temp
for i in range(len(Ver)):
print(Ver[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,319 |
s531849800 | p00011 | u529386725 | 1461620205 | Python | Python3 | py | Accepted | 20 | 7620 | 197 | w = int(input())
n = int(input())
li = list(range(1, w + 1))
for i in range(n):
a, b = map(int, input().split(','))
a -= 1; b -= 1
li[a], li[b] = li[b], li[a]
for x in li:
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,320 |
s839307347 | p00011 | u894114233 | 1461766876 | Python | Python | py | Accepted | 10 | 6308 | 198 | w=input()
amida=[i+1 for i in xrange(w)]
n=input()
for i in xrange(n):
a,b=map(int,raw_input().split(","))
amida[a-1],amida[b-1]=amida[b-1],amida[a-1]
for i in xrange(w):
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,321 |
s794430577 | p00011 | u018967850 | 1464271117 | Python | Python | py | Accepted | 10 | 6272 | 317 | # coding: utf-8
# Here your code !
def change(List,a,b):
temp = List[a-1]
List[a-1] = List[b-1]
List[b-1] = temp
w = input()
n = input()
Lot = [i for i in xrange(1,w+1)]
for j in xrange(n):
l = map(int, raw_input().split(","))
change(Lot,l[0],l[1])
for k in xrange(len(Lot)):
print Lot[k] | 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,322 |
s947283344 | p00011 | u957021485 | 1465577763 | Python | Python3 | py | Accepted | 20 | 7584 | 377 | import sys
w = int(input())
n = int(input())
state = list(range(1, w+1))
a = [None] * (n)
b = [None] * (n)
for i,line in enumerate(sys.stdin.readlines()):
a[i], b[i] = map(int, line.split(","))
def swap(x, y):
global state
temp = state[x-1]
state[x-1] = state[y-1]
state[y-1] = temp
for i in ran... | 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,323 |
s820395320 | p00011 | u203261375 | 1466520075 | Python | Python3 | py | Accepted | 20 | 7732 | 235 | w = int(input())
arr = [i+1 for i in range(w)]
for i in range(int(input())):
s = input().split(",")
a,b = int(s[0]), int(s[1])
temp = arr[a-1]
arr[a-1] = arr[b-1]
arr[b-1] = temp
for i in range(w):
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,324 |
s604027081 | p00011 | u119947000 | 1467685985 | Python | Python | py | Accepted | 10 | 6320 | 183 | w = input()
n = input()
kuji = [i for i in range(w)]
for i in range(n):
a, b = map(int, raw_input().split(","))
kuji[a-1], kuji[b-1] = kuji[b-1], kuji[a-1]
for i in kuji:
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,325 |
s107873594 | p00011 | u300946041 | 1468032671 | Python | Python3 | py | Accepted | 30 | 7668 | 279 | # -*- coding: utf-8 -*-
def solve():
w = int(input())
n = int(input())
l = [i for i in range(1, w+1)]
for _ in range(n):
a, b = map(int, input().split(','))
a -= 1
b -= 1
l[a], l[b] = l[b], l[a]
print(*l, sep='\n')
solve() | 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,326 |
s351105509 | p00011 | u896025703 | 1469328888 | Python | Python | py | Accepted | 10 | 6268 | 165 |
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,327 |
s873506475 | p00011 | u146816547 | 1469349014 | Python | Python | py | Accepted | 10 | 6248 | 215 | w = int(raw_input())
n = int(raw_input())
ans = [i for i in range(1, w+1)]
for i in range(n):
a, b = map(int, raw_input().split(','))
ans[a-1], ans[b-1] = ans[b-1], ans[a-1]
for i in range(w):
print ans[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,328 |
s696638606 | p00011 | u146816547 | 1469349108 | Python | Python | py | Accepted | 10 | 6276 | 205 | w = int(raw_input())
n = int(raw_input())
ans = [i for i in range(1, w+1)]
for i in range(n):
a, b = map(int, raw_input().split(','))
ans[a-1], ans[b-1] = ans[b-1], ans[a-1]
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,329 |
s563048553 | p00011 | u648595404 | 1469708980 | Python | Python3 | py | Accepted | 20 | 7644 | 494 | w = int(input())
n = int(input())
ans = [0 for i in range(w)]
list = []
for i in range(n):
ll = input().split(",")
a, b = ll[0], ll[1]
a = int(a)
b = int(b)
list.append([a,b])
# print(list)
for i in range(1,w+1):
position = i-1
for ll in list:
a, b = ll[0], ll[1]
if positi... | 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,330 |
s569958888 | p00011 | u582608581 | 1470388950 | Python | Python3 | py | Accepted | 20 | 7400 | 238 | w = eval(input())
n = eval(input())
numlist = [item for item in range(1, w + 1)]
for t in range(n):
i, j = [eval(item) - 1 for item in input().split(',')]
numlist[i], numlist[j] = numlist[j], numlist[i]
for item in numlist:
print(item) | 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,331 |
s801982435 | p00011 | u358919705 | 1471822240 | Python | Python3 | py | Accepted | 20 | 7516 | 146 | w=list(range(int(input())+1))
for _ in[0]*int(input()):
a,b=map(int,input().split(','))
w[a],w[b]=w[b],w[a]
for i in range(1,len(w)):print(w[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,332 |
s337685542 | p00011 | u589886885 | 1471943245 | Python | Python3 | py | Accepted | 30 | 7648 | 234 | w = int(input())
n = int(input())
vertical = [x for x in range(1, w + 1)]
for i in range(n):
a, b = [int(x) - 1 for x in input().split(',')]
vertical[a], vertical[b] = vertical[b], vertical[a]
for i in vertical:
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,333 |
s543249229 | p00011 | u379499530 | 1472717820 | Python | Python | py | Accepted | 10 | 6348 | 317 | w = input()
n = input()
line = [[0 for i in xrange(n)] for j in xrange(w + 1)]
for i in xrange(n):
a, b = map(int, raw_input().split(','))
line[a][i] = b
line[b][i] = a
for i in xrange(1, w + 1):
num = i
for j in xrange(n - 1, -1, -1):
if line[num][j] > 0: num = line[num][j]
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,334 |
s966618110 | p00011 | u607831289 | 1473130843 | Python | Python | py | Accepted | 10 | 6248 | 263 | def swap(a, b, row):
row[a-1], row[b-1] = row[b-1], row[a-1]
w = int(raw_input())
n = int(raw_input())
result = range(1, w+1)
for i in range(n):
a, b = map(lambda x: int(x), raw_input().split(','))
swap(a, b, result)
for x in result:
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,335 |
s722067831 | p00011 | u393305246 | 1474276531 | Python | Python | py | Accepted | 10 | 6376 | 483 | line=input()
order=[]
for i in range(line):
order.append(i+1)
time=input()
for n in range(time):
inp=raw_input()
num_pre=list(inp)
num=[]
if num_pre.index(",")==2:
num.append(int(num_pre[0]+num_pre[1]))
else:
num.append(int(num_pre[0]))
if len(num_pre)-num_pre.index(",")==3:
num.append(int(num_pre[-2]+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,336 |
s024775993 | p00011 | u776559258 | 1477562359 | Python | Python3 | py | Accepted | 20 | 7676 | 197 | # coding: utf-8
w=int(input())
L=[i for i in range(1,w+1)]
n=int(input())
for i in range(n):
a,b=[int(j)-1 for j in input().split(",")]
s=L[a]
L[a]=L[b]
L[b]=s
[print(i) for i in 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,337 |
s609288820 | p00011 | u659302741 | 1477741216 | Python | Python3 | py | Accepted | 20 | 7608 | 230 | w = int(input())
n = int(input())
nums = list(range(1, w + 1))
for i in range(n):
a, b = map(int, input().split(","))
c = nums[a - 1]
nums[a - 1] = nums[b - 1]
nums[b - 1] = c
for i in range(w):
print(nums[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,338 |
s511017620 | p00011 | u886845205 | 1478208010 | Python | Python3 | py | Accepted | 20 | 7604 | 415 | w = int(input().replace("\n", ""))
n = []
for i in range(int(input().replace("\n", ""))):
n.append([int(v) for v in input().replace("\n", "").split(",")])
m = [0] * (w + 1)
for i in range(1, w + 1):
step = i
for j in range(0, len(n)):
if n[j][0] == step:
step = n[j][1]
elif n[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,339 |
s772745171 | p00011 | u149199817 | 1478273855 | Python | Python3 | py | Accepted | 30 | 7636 | 593 | # -*- coding: utf-8 -*-
import sys
def amida(w, side_bar):
result = []
side_bar.reverse()
for x in range(1, w+1):
status = x
for bar in side_bar:
if status == bar[0]:
status = bar[1]
elif status == bar[1]:
status = bar[0]
resu... | 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,340 |
s125398381 | p00011 | u660912567 | 1479268859 | Python | Python3 | py | Accepted | 20 | 7592 | 196 | li = [i for i in range(int(input())+1)]
for i in range(int(input())):
line = list(map(int, input().split(',')))
li[line[0]],li[line[1]] = li[line[1]],li[line[0]]
for i in li[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,341 |
s792696100 | p00011 | u922871577 | 1479280817 | Python | Python | py | Accepted | 10 | 6256 | 165 | w = input()
n = input()
A = range(1, w+1)
for _ in xrange(n):
a, b = map(int, raw_input().split(','))
A[a-1], A[b-1] = A[b-1], A[a-1]
for a in A:
print 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,342 |
s179830429 | p00011 | u123687446 | 1480672915 | Python | Python3 | py | Accepted | 30 | 7632 | 264 | w = int(input())
n = int(input())
nums = [i for i in range(1,w+1)]
for i in range(n):
try:
a, b = list(map(lambda x:int(x)-1, input().split(",")))
except EOFError:
break
nums[a], nums[b] = nums[b], nums[a]
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,343 |
s663472564 | p00011 | u301729341 | 1480930610 | Python | Python3 | py | Accepted | 20 | 7640 | 378 | w = int(input())
n = int(input())
Ami = []
Num = []
for i in range(n):
Ami.append(list(map(int,input().split(","))))
for i in range(1,w+1):
pos = i
for j in range(n):
if pos == Ami[j][0]:
pos = Ami[j][1]
elif pos == Ami[j][1]:
pos = Ami[j][0]
Num.append([pos,i])
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,344 |
s735507488 | p00011 | u661290476 | 1481252076 | Python | Python3 | py | Accepted | 20 | 7480 | 172 | w=int(input())
n=int(input())
v=list(range(1,w+1))
for i in range(n):
a,b=map(int,input().split(","))
v[a-1],v[b-1]=v[b-1],v[a-1]
for i in range(w):
print(v[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,345 |
s375797586 | p00011 | u811733736 | 1481270467 | Python | Python3 | py | Accepted | 20 | 7556 | 726 | def get_another_num(data, me):
if data[0] == me:
return data[1]
else:
return data[0]
if __name__ == '__main__':
# ??????????????\???
#v_lines = 5
#h_lines = 4
#data = [(2, 4), (3, 5), (1, 2), (3, 4)]
v_lines = int(input())
h_lines = int(input())
data = []
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,346 |
s789694844 | p00011 | u919202930 | 1481433801 | Python | Python3 | py | Accepted | 20 | 7588 | 245 | w = int(input())
amida = list(range(1,w+1))
n = int(input())
for i in range(0,n):
exchange = list(map(int,input().split(",")))
amida[exchange[1]-1], amida[exchange[0]-1] = amida[exchange[0]-1], amida[exchange[1]-1]
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,347 |
s789704203 | p00011 | u546285759 | 1481543869 | Python | Python3 | py | Accepted | 30 | 7600 | 180 | w = [v+1 for v 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]
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,348 |
s513334113 | p00011 | u957840591 | 1482466478 | Python | Python3 | py | Accepted | 20 | 7504 | 271 | w=eval(input())
n=eval(input())
edge=[]
for i in range(n):
edge.append(tuple(map(int,input().split(','))))
for i in range(1,w+1):
temp=i
for j in range(n):
if temp in edge[n-j-1]:
temp=edge[n-j-1][edge[n-j-1].index(temp)-1]
print(temp) | 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,349 |
s226792292 | p00011 | u220324665 | 1483762705 | Python | Python3 | py | Accepted | 20 | 7604 | 142 | i=input;w=int(i());n=int(i());d=list(range(w))
for j in range(n):a,b=map(int,i().split(','));d[a-1],d[b-1]=d[b-1],d[a-1]
for i in d: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,350 |
s992475364 | p00011 | u078042885 | 1483860166 | Python | Python3 | py | Accepted | 20 | 7656 | 159 | 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,351 |
s099036593 | p00011 | u711765449 | 1483901547 | Python | Python3 | py | Accepted | 20 | 7676 | 597 | # -*- coding: utf-8 -*-
import sys
def amida(w, side_bar):
result = []
side_bar.reverse()
for x in range(1, w+1):
status = x
for bar in side_bar:
if status == bar[0]:
status = bar[1]
elif status == bar[1]:
status = bar[0]
re... | 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,352 |
s650762525 | p00011 | u252414452 | 1485784398 | Python | Python | py | Accepted | 10 | 6436 | 245 | w = int(raw_input().rstrip())
l=[]
for i in range(w+1):
l.append(i)
n = int(raw_input().rstrip())
for i in range(n):
a, b = raw_input().rstrip().split(",")
l[int(a)], l[int(b)] = l[int(b)], l[int(a)]
for i in range(w):
print l[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,353 |
s506039958 | p00011 | u901080241 | 1488956050 | Python | Python3 | py | Accepted | 20 | 7668 | 220 | w = int(input())
n = int(input())
ans = [i for i in range(w)]
for i in range(n):
a,b = list(map(int, input().split(",")))
temp = ans[a-1]
ans[a-1] = ans[b-1]
ans[b-1] = temp
for i in ans:
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,354 |
s322661417 | p00011 | u810591206 | 1489116086 | Python | Python3 | py | Accepted | 30 | 7556 | 204 | 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 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,355 |
s119830844 | p00011 | u459418423 | 1489624498 | Python | Python3 | py | Accepted | 30 | 7664 | 304 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
w = int(input())
n = int(input())
v_lines = [i for i in range(1,w+1)]
for i in range(n):
a,b = list(map(int, input().split(',')))
t = v_lines[a-1]
v_lines[a-1] = v_lines[b-1]
v_lines[b-1] = t
for i in range(len(v_lines)):
print(v_lines[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,356 |
s503900891 | p00011 | u459418423 | 1489624534 | Python | Python3 | py | Accepted | 20 | 7728 | 304 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
w = int(input())
n = int(input())
v_lines = [i for i in range(1,w+1)]
for i in range(n):
a,b = list(map(int, input().split(',')))
t = v_lines[a-1]
v_lines[a-1] = v_lines[b-1]
v_lines[b-1] = t
for i in range(len(v_lines)):
print(v_lines[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,357 |
s720946282 | p00011 | u728901930 | 1490782694 | Python | Python3 | py | Accepted | 20 | 7768 | 263 | import sys
import math as mas
w=int(input())
n=int(input())
a=[i for i in range(1,w+1)]
for i in range(n):
b,c=map(int,input().split(','))
a[b-1],a[c-1]=a[c-1],a[b-1]
for i in a:print(i)
#for i in sys.stdin:
# a,b=map(int,i.split())
# print(gcd(a,b),lcm(a,b)) | 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,358 |
s294388964 | p00011 | u462831976 | 1492656231 | Python | Python3 | py | Accepted | 20 | 7712 | 314 | # -*- coding: utf-8 -*-
import sys
import os
import math
tate = int(input())
yoko = int(input())
values = [i for i in range(tate)]
#print(values)
for _ in range(yoko):
a, b = map(int, input().split(','))
a -= 1
b -= 1
values[a], values[b] = values[b], values[a]
for i in values:
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,359 |
s214923094 | p00011 | u868716420 | 1493849875 | Python | Python3 | py | Accepted | 30 | 7552 | 254 | list = {}
for a in range(1, int(input()) + 1) : list[a] = a
for a in range(int(input())) :
x, y = [int(temp) for temp in input().split(',')]
temp = list[x]
list[x] = list[y]
list[y] = temp
for a in range(1, len(list) + 1) : print(list[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,360 |
s001699690 | p00011 | u519227872 | 1494012416 | Python | Python3 | py | Accepted | 20 | 7564 | 176 | w = int(input())
n = int(input())
a = list(range(w))
for i in range(n):
k1,k2 = map(int,input().split(","))
a[k1-1],a[k2-1] = a[k2-1],a[k1-1]
for i in a:
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,361 |
s865516057 | p00011 | u618637847 | 1494897028 | Python | Python3 | py | Accepted | 30 | 7508 | 285 | import sys
num = input()
list = {}
for i in range(1, int(num) + 1):
list[i] = i
for i in range(int(input())) :
x, y = map(int, input().split(','))
temp = list[x]
list[x] = list[y]
list[y] = temp
for i in range(1, len(list) + 1):
print(list[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,362 |
s498976759 | p00011 | u151242583 | 1494901746 | Python | Python3 | py | Accepted | 30 | 7516 | 336 | import sys
lines = str(sys.stdin.read()).strip().split("\n")
W = int(lines.pop(0))
N = int(lines.pop(0))
results = list(range(1,W + 1))
for i in range(N):
data = list(map(lambda i: int(i) - 1, lines[i].split(",")))
results[data[0]], results[data[1]] = results[data[1]], results[data[0]]
for result in results... | 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,363 |
s350752310 | p00011 | u362104929 | 1495966566 | Python | Python3 | py | Accepted | 30 | 7636 | 370 | def main():
w = int(input())
n = int(input())
ans =[i for i in range(1, w+1)]
def change(li, a, b):
tmp = li[a-1]
li[a-1] = li[b-1]
li[b-1] = tmp
return li
for _ in range(n):
a, b = map(int, input().split(","))
ans = change(ans, a, b)
print(*ans,... | 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,364 |
s244965184 | p00011 | u922489088 | 1496134695 | Python | Python3 | py | Accepted | 20 | 7648 | 324 | import sys
n = int(sys.stdin.readline().rstrip())
m = int(sys.stdin.readline().rstrip())
l = []
for i in range(m):
l.append(list(map(int, sys.stdin.readline().rstrip().split(','))))
for i in range(n):
cur = i+1
for d in l[::-1]:
if cur in d:
cur = d[0] if cur == d[1] else d[1]
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,365 |
s007462410 | p00011 | u905313459 | 1496316856 | Python | Python3 | py | Accepted | 20 | 7484 | 208 | w, n = int(input()), int(input())
p = list(range(1, w + 1))
l = [list(map(int, input().split(","))) for i in range(n)]
for j in l: p[j[0] - 1], p[j[1] - 1] = p[j[1] - 1], p[j[0] - 1]
k = [print(v) for v in 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,366 |
s524576676 | p00011 | u600821328 | 1499948912 | Python | Python3 | py | Accepted | 20 | 7660 | 326 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
w = int(input())
n = int(input())
xs = [i for i in range(w+1)]
for _ in range(n):
a, b = map(int, input().split(","))
xs[a], xs[b] = xs[b], xs[a]
for i in range(1, w+1):
print(xs[i])
if __name__ == "__main__": ... | 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,367 |
s660766099 | p00011 | u546285759 | 1500826988 | Python | Python3 | py | Accepted | 30 | 7604 | 178 | w = int(input())
n = int(input())
am = [i for i in range(w+1)]
for _ in range(n):
a, b = map(int, input().split(','))
am[a], am[b] = am[b], am[a]
print(*am[1:], 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,368 |
s654951900 | p00011 | u354053070 | 1501915673 | Python | Python3 | py | Accepted | 20 | 7500 | 184 | w = int(input())
nums = list(range(w + 1))
for _ in range(int(input())):
a, b = map(int, input().split(","))
nums[a], nums[b] = nums[b], nums[a]
for x in nums[1:]:
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,369 |
s490784002 | p00011 | u821624310 | 1502591210 | Python | Python3 | py | Accepted | 20 | 7688 | 352 | w = int(input())
n = int(input())
a = [[int(i) for i in input().split(",")] for j in range(n)]
b = [0 for i in range(w)]
for i in range(1, w+1):
next_num = i
for j in a:
if next_num == j[0]:
next_num = j[1]
elif next_num == j[1]:
next_num = j[0]
b[next_num - 1] = i
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,370 |
s217503761 | p00011 | u584777171 | 1503067410 | Python | Python3 | py | Accepted | 20 | 7612 | 382 | user = input()
w = int(user)
user = input()
n = int(user)
a = []
b = []
now = 0
for i in range(n):
user = input()
users = user.split(",")
a.append(int(users[0]))
b.append(int(users[1]))
for j in range(1, w+1):
now = j
for k in reversed(range(n)):
if now == a[k]:
now = b[k]
... | 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,371 |
s937530996 | p00011 | u957021183 | 1504763678 | Python | Python3 | py | Accepted | 20 | 7760 | 392 | # Aizu Problem 0011: Drawing Lots
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
w = int(input())
slots = list(range(1, w + 1))
n = int(input())
for k in range(n):
a, b = [int(_) for _ in input().split(',')]
slot... | 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,372 |
s953927413 | p00011 | u299798926 | 1505367133 | Python | Python3 | py | Accepted | 20 | 7732 | 369 | w=int(input())
n=int(input())
a=[]
b=[]
Ans=[int(0) for i in range(w)]
for i in range(n):
x,y=[int(j) for j in input().split(",")]
a.append(x)
b.append(y)
for i in range(1,w+1):
ans=i
for j in range(len(a)):
if ans==a[j]:
ans=b[j]
elif ans==b[j]:
ans=a[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,373 |
s201268156 | p00011 | u197615397 | 1506183550 | Python | Python3 | py | Accepted | 30 | 7728 | 241 | W = int(input())
N = int(input())
edges = [tuple(map(lambda c:int(c)-1, input().split(","))) for _ in [0]*N]
result = list(range(1, W+1))
for a, b in edges:
result[a], result[b] = result[b], result[a]
print("\n".join(map(str, result))) | 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,374 |
s608882828 | p00011 | u926657458 | 1509305839 | Python | Python3 | py | Accepted | 30 | 7800 | 386 | import sys
w = int(input())
n = int(input())
l = list()
for _ in range(n):
l.append(list(map(int,input().split(","))))
res = [0 for _ in range(w)]
for i in range(1,w+1):
tgt = i
for num in l:
if tgt in num:
if num.index(tgt) == 1:
tgt = num[0]
else:
... | 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,375 |
s074781986 | p00011 | u187646742 | 1510805687 | Python | Python3 | py | Accepted | 30 | 7688 | 224 | stick = [i for i in range(1, int(input()) + 1)]
net = int(input())
for _ in range(net):
a, b = list(map(int, input().split(",")))
stick[a - 1], stick[b - 1] = stick[b - 1], stick[a - 1]
for v in stick:
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,376 |
s951031881 | p00011 | u917432951 | 1511330624 | Python | Python3 | py | Accepted | 30 | 7640 | 243 |
if __name__ == '__main__':
w = (int)(input())
n = (int)(input())
a = [i+1 for i in range(0,w)]
for i in range(n):
x,y = map(int,input().split(","))
a[x-1],a[y-1] = a[y-1],a[x-1]
for x in a:
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,377 |
s502585122 | p00011 | u424041287 | 1512105915 | Python | Python3 | py | Accepted | 30 | 5600 | 285 | w = int(input().rstrip())
n = int(input().rstrip())
amida = [i for i in range(w)]
for i in range(n):
a = input().rstrip().split(",")
number = [int(i) - 1 for i in a]
amida[number[0]], amida[number[1]] = amida[number[1]], amida[number[0]]
for i in amida:
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,378 |
s653203354 | p00011 | u548155360 | 1512395860 | Python | Python3 | py | Accepted | 20 | 5600 | 598 | # coding=utf-8
def list_swap(given_list: list, swap_number1: int, swap_number2: int)-> list:
return_list = given_list[:]
memo = given_list[swap_number1 - 1]
return_list[swap_number2 - 1] = memo
memo = given_list[swap_number2 - 1]
return_list[swap_number1 - 1] = memo
return return_list
if __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,379 |
s586449187 | p00011 | u846136461 | 1513756649 | Python | Python | py | Accepted | 10 | 4672 | 566 | # coding: utf-8
w = int(raw_input())
n = int(raw_input())
yoko = []
for i in range(n):
data = map(int, raw_input().split(","))
yoko.append(data)
ans = []
for i in range(1,w+1):
ans.append(0)
for num in range(1,w+1):
# deb.printdebug1(num, debug)
direction = num
for c in yoko:
if c[0] == direction:
# deb.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,380 |
s722912010 | p00011 | u471400255 | 1514302859 | Python | Python3 | py | Accepted | 20 | 5600 | 208 | w = int(input())
n = int(input())
goal = [i for i in range(1,w+1)]
for i in range(n):
a,b = [int(j) for j in input().split(',')]
goal[a-1],goal[b-1] = goal[b-1],goal[a-1]
for po in goal:
print(po) | 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,381 |
s049326605 | p00011 | u024715419 | 1514431024 | Python | Python3 | py | Accepted | 20 | 5600 | 221 | w = int(input())
lots = [i for i in range(w)]
n = int(input())
for i in range(n):
a, b = map(int, input().split(","))
lots[a - 1], lots[b - 1] = lots[b - 1], lots[a - 1]
for i in range(w):
print(lots[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,382 |
s980189990 | p00011 | u600263347 | 1514540939 | Python | Python3 | py | Accepted | 20 | 5592 | 308 | def main():
n = int(input())
point = int(input())
A = []
for i in range(n):
A.append(i+1)
for i in range(point):
a,b = map(int,input().split(","))
A[a-1],A[b-1] = A[b-1],A[a-1]
for value in A:
print(value)
if __name__ == '__main__':
main() | 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,383 |
s426420518 | p00011 | u028347703 | 1514558996 | Python | Python3 | py | Accepted | 20 | 5596 | 223 | data = []
w = int(input())
for i in range(w):
data.append(i+1)
n = int(input())
for line in range(n):
a, b = [int(i) for i in input().split(',')]
data[a-1], data[b-1] = data[b-1], data[a-1]
for d in data:
print(d) | 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,384 |
s329355588 | p00011 | u585035894 | 1514626724 | Python | Python3 | py | Accepted | 20 | 5600 | 185 | a = list(map(lambda x: x+1, range(int(input()))))
for _ in range(int(input())):
m,n = map(lambda x: int(x)-1, input().split(','))
a[m], a[n] = a[n],a[m]
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,385 |
s506672657 | p00011 | u764789069 | 1514815990 | Python | Python | py | Accepted | 10 | 4656 | 335 | w = int(raw_input())
n = int(raw_input())
list = []
for i in range(1, w+1):
list.append(i)
#print list
#print list[0]
for j in range(1, n+1):
num1, num2 = map(int, raw_input().split(","))
temp = list[num1-1]
list[num1-1]=list[num2-1]
list[num2-1]=temp
#print temp
for k in range(0, 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,386 |
s295373102 | p00011 | u273843182 | 1514982999 | Python | Python3 | py | Accepted | 20 | 5596 | 174 | 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 x in l:
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,387 |
s257798072 | p00011 | u546285759 | 1516339139 | Python | Python3 | py | Accepted | 20 | 5600 | 196 | 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,388 |
s083203946 | p00011 | u043254318 | 1516384073 | Python | Python3 | py | Accepted | 20 | 5596 | 276 | w = int(input())
n = int(input())
amida = []
amida.append(-1)
for i in range(w):
amida.append(i)
for l in range(n):
a,b = [int(i) for i in input().split(",")]
tmp = amida[a]
amida[a] = amida[b]
amida[b] = tmp
for i in range(w):
print(amida[i+1]+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,389 |
s141850550 | p00011 | u150984829 | 1516783855 | Python | Python3 | py | Accepted | 20 | 5608 | 150 | a=[i+1 for i in range(int(input()))]
for _ in[0]*int(input()):
s,t=map(lambda x:int(x)-1,input().split(','))
a[s],a[t]=a[t],a[s]
print(*a,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,390 |
s137010476 | p00011 | u150984829 | 1516784381 | Python | Python3 | py | Accepted | 20 | 5596 | 136 | a=list(range(int(input())+1))
for _ in[0]*int(input()):
s,t=map(int,input().split(','));a[s],a[t]=a[t],a[s]
for s in a:
if s: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,391 |
s289216499 | p00011 | u150984829 | 1517404956 | Python | Python3 | py | Accepted | 20 | 5596 | 133 | a=list(range(int(input())+1))
for _ in[0]*int(input()):s,t=map(int,input().split(','));a[s],a[t]=a[t],a[s]
for s in a:s and 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,392 |
s297051288 | p00011 | u069727578 | 1520047846 | Python | Python3 | py | Accepted | 20 | 5600 | 254 | tate =int(input())
yoko=int(input())
arr = [i+1 for i in range(tate)]
for j in range(yoko):
rep1,rep2=input().split(",")
rep1=int(rep1)-1
rep2=int(rep2)-1
arr[rep1],arr[rep2] = arr[rep2],arr[rep1]
for k in range(tate):
print(arr[k])
| 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,393 |
s419145572 | p00011 | u553148578 | 1520166845 | Python | Python3 | py | Accepted | 20 | 5592 | 160 | li = list(range(1, int(input())+1))
for i in range(int(input())):
a,b=map(int, input().split(','))
li[a-1], li[b-1] = li[b-1], li[a-1]
for i in li:
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,394 |
s185116184 | p00011 | u401720175 | 1522051261 | Python | Python3 | py | Accepted | 30 | 5604 | 257 | # coding: utf-8
w = int(input())
ans = [i + 1 for i in range(w)]
loop = int(input())
# swap
for _ in range(loop):
left, right = map(int, input().split(","))
ans[left-1], ans[right-1] = ans[right-1], ans[left-1]
# result
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,395 |
s915778118 | p00011 | u166871988 | 1523706045 | Python | Python3 | py | Accepted | 20 | 5596 | 183 | w=int(input())
l=[i+1 for i in range(w)]
n=int(input())
for _ in range(n):
a,b=[int(i)-1 for i in input().split(",")]
t=l[a]
l[a]=l[b]
l[b]=t
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,396 |
s732508682 | p00011 | u352394527 | 1523860801 | Python | Python3 | py | Accepted | 20 | 5608 | 244 | w = int(input())
n = int(input())
lst = [i + 1 for i in range(w)]
def swap(t):
a,b = t
temp = lst[a-1]
lst[a-1] = lst[b-1]
lst[b-1] = temp
for i in range(n):
swap(tuple(map(int,input().split(","))))
for i in range(w):
print(lst[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,397 |
s341716171 | p00011 | u536280367 | 1524402401 | Python | Python3 | py | Accepted | 20 | 5612 | 353 | if __name__ == '__main__':
w = int(input())
result = [i + 1 for i in range(w)]
n = int(input())
permutations = []
for _ in range(n):
permutations.append(map(lambda x: int(x) - 1, input().split(',')))
for i, j in permutations:
result[j], result[i] = result[i], result[j]
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,398 |
s637805638 | p00011 | u150984829 | 1525319626 | Python | Python3 | py | Accepted | 20 | 5600 | 133 | a=list(range(int(input())+1))
for _ in[0]*int(input()):s,t=map(int,input().split(','));a[s],a[t]=a[t],a[s]
[print(s)for s in a if 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,399 |
s069487033 | p00011 | u150984829 | 1525319665 | Python | Python3 | py | Accepted | 20 | 5596 | 133 | a=list(range(int(input())+1))
for _ in[0]*int(input()):s,t=map(int,input().split(','));a[s],a[t]=a[t],a[s]
for s in a:s and 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,400 |
s868386538 | p00011 | u503263570 | 1525616115 | Python | Python3 | py | Accepted | 20 | 5700 | 297 | w=int(input())
n=int(input())
d=[list(map(int,input().split(',')))for i in range(n)]
結果=[0]*w
for j in range(w):
現在位置 = j + 1
for k1,k2 in d:
if 現在位置==k1:
現在位置 = k2
elif 現在位置==k2:
現在位置=k1
結果[現在位置-1]=j+1
print(*結果,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,401 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.