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
s591674343
p00711
u073204138
1574069257
Python
Python3
py
Accepted
100
5728
602
def count_area(h,w): count = 0 if (h>0) and (s[h-1][w]== "."): s[h-1][w] = "#" count += count_area(h-1,w) if (h<H-1) and (s[h+1][w]== "."): s[h+1][w] = "#" count += count_area(h+1,w) if (w>0) and (s[h][w-1]== "."): s[h][w-1] = "#" count += count_area(h,w-1) if (w<W-1) and (s[h][w+1]== "."): s[h][w+1]...
p00711
<H1><font color="#000">Problem B:</font> Red and Black</H1> <P> There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles...
6 9 ....#. .....# ...... ...... ...... ...... ...... #@...# .#..#. 11 9 .#......... .#.#######. .#.#.....#. .#.#.###.#. .#.#..@#.#. .#.#####.#. .#.......#. .#########. ........... 11 6 ..#..#..#.. ..#..#..#.. ..#..#..### ..#..#..#@. ..#..#..#.. ..#..#..#.. 7 7 ..#.#.. ..#.#.. ###.### ...@... ###.### ..#.#.. ..#.#.. 0 0...
45 59 6 13
23,995
s137936764
p00711
u510423199
1570239044
Python
Python3
py
Accepted
100
5760
842
while True: W, H = map(int, input().split()) if W == 0 and H == 0: break maze = [] for _ in range(H): maze.append(list(input())) visited = [[False] * W for _ in range(H)] dxy = [(1, 0), (0, 1), (-1, 0), (0, -1)] ans = 0 def rec(x, y): global ans visited[...
p00711
<H1><font color="#000">Problem B:</font> Red and Black</H1> <P> There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles...
6 9 ....#. .....# ...... ...... ...... ...... ...... #@...# .#..#. 11 9 .#......... .#.#######. .#.#.....#. .#.#.###.#. .#.#..@#.#. .#.#####.#. .#.......#. .#########. ........... 11 6 ..#..#..#.. ..#..#..#.. ..#..#..### ..#..#..#@. ..#..#..#.. ..#..#..#.. 7 7 ..#.#.. ..#.#.. ###.### ...@... ###.### ..#.#.. ..#.#.. 0 0...
45 59 6 13
23,996
s979810592
p00711
u556131648
1562397005
Python
Python3
py
Accepted
90
6076
923
from collections import deque def solve(W, H, field): dire = [(1,0), (0,1), (-1,0), (0,-1)] for i in range(H): for j in range(W): if (field[i][j]=="@"): s = (i,j) check = [[0]*W for i in range(H)] q = deque() q.append(s) check[s[0]][s[1]] = 1 ret = 1 ...
p00711
<H1><font color="#000">Problem B:</font> Red and Black</H1> <P> There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles...
6 9 ....#. .....# ...... ...... ...... ...... ...... #@...# .#..#. 11 9 .#......... .#.#######. .#.#.....#. .#.#.###.#. .#.#..@#.#. .#.#####.#. .#.......#. .#########. ........... 11 6 ..#..#..#.. ..#..#..#.. ..#..#..### ..#..#..#@. ..#..#..#.. ..#..#..#.. 7 7 ..#.#.. ..#.#.. ###.### ...@... ###.### ..#.#.. ..#.#.. 0 0...
45 59 6 13
23,997
s302987363
p00711
u595029599
1560696800
Python
Python3
py
Accepted
70
5720
563
c = 0 def calc(t, X, Y): global c c += 1 t[Y][X] = '#' for x, y in [(1, 0), (-1, 0), (0, 1), (0, -1)]: if t[Y + y][X + x] == '.': calc(t, X + x, Y + y) while True: c = 0 w, h = map(int, input().split()) if w == h == 0: break t = [['#'] * (w +...
p00711
<H1><font color="#000">Problem B:</font> Red and Black</H1> <P> There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles...
6 9 ....#. .....# ...... ...... ...... ...... ...... #@...# .#..#. 11 9 .#......... .#.#######. .#.#.....#. .#.#.###.#. .#.#..@#.#. .#.#####.#. .#.......#. .#########. ........... 11 6 ..#..#..#.. ..#..#..#.. ..#..#..### ..#..#..#@. ..#..#..#.. ..#..#..#.. 7 7 ..#.#.. ..#.#.. ###.### ...@... ###.### ..#.#.. ..#.#.. 0 0...
45 59 6 13
23,998
s635138739
p00711
u046108504
1558109915
Python
Python3
py
Accepted
80
5732
1,129
import sys sys.setrecursionlimit(10000) def dfs(x, y): global cout if 0 <= x < H - 1 and tile[x + 1][y] == ".": cout += 1 tile[x + 1][y] = "#" dfs(x + 1, y) if 0 < x < H and tile[x - 1][y] == ".": cout += 1 tile[x - 1][y] = "#" dfs(x - 1, y) if 0 <= y <...
p00711
<H1><font color="#000">Problem B:</font> Red and Black</H1> <P> There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles...
6 9 ....#. .....# ...... ...... ...... ...... ...... #@...# .#..#. 11 9 .#......... .#.#######. .#.#.....#. .#.#.###.#. .#.#..@#.#. .#.#####.#. .#.......#. .#########. ........... 11 6 ..#..#..#.. ..#..#..#.. ..#..#..### ..#..#..#@. ..#..#..#.. ..#..#..#.. 7 7 ..#.#.. ..#.#.. ###.### ...@... ###.### ..#.#.. ..#.#.. 0 0...
45 59 6 13
23,999
s361092553
p00711
u281836941
1513074206
Python
Python3
py
Accepted
90
5792
720
# coding: utf-8 def check(p): global ans global field ans+=1 if(field[p[1]][p[0]]=='.'): field[p[1]][p[0]]='#' if(0<=p[0]+1<w and field[p[1]][p[0]+1]=='.'): check((p[0]+1,p[1])) if(0<=p[0]-1<w and field[p[1]][p[0]-1]=='.'): check((p[0]-1,p[1])) if(0<=p[1]+1<h and fiel...
p00711
<H1><font color="#000">Problem B:</font> Red and Black</H1> <P> There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles...
6 9 ....#. .....# ...... ...... ...... ...... ...... #@...# .#..#. 11 9 .#......... .#.#######. .#.#.....#. .#.#.###.#. .#.#..@#.#. .#.#####.#. .#.......#. .#########. ........... 11 6 ..#..#..#.. ..#..#..#.. ..#..#..### ..#..#..#@. ..#..#..#.. ..#..#..#.. 7 7 ..#.#.. ..#.#.. ###.### ...@... ###.### ..#.#.. ..#.#.. 0 0...
45 59 6 13
24,000
s169922515
p00716
u731941832
1530802068
Python
Python3
py
Accepted
80
5632
514
m = int(input()) for _ in range(m): s = int(input()) y = int(input()) n = int(input()) a = 0 for _d in range(n): t, p, b = map(float, input().split()) tem = 0 ts = s if t: for _y in range(y): ts += int(ts * p) ts -= b ...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,002
s234898311
p00716
u847467233
1531576215
Python
Python3
py
Accepted
80
5628
444
# AOJ 1135: Ohgas' Fortune # Python3 2018.7.14 bal4u for cno in range(int(input())): a0, y, n = int(input()), int(input()), int(input()) ans = 0 for i in range(n): buf = list(input().split()) k, r, f = int(buf[0]), float(buf[1]), int(buf[2]) a = a0 if k: for j in range(y): b = (int)(a*r) a += b-f...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,003
s178311312
p00716
u759949288
1405398856
Python
Python3
py
Accepted
70
6744
602
import sys readline = sys.stdin.readline for _ in range(int(readline())): a = int(readline()) y = int(readline()) n = int(readline()) ans = a for _ in range(n): t, rate, fee = [f(x) for f, x in zip((int, float, int), readline().split())] if t == 1: res = a fo...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,004
s889392543
p00716
u766477342
1420961079
Python
Python3
py
Accepted
70
6744
519
M = int(input()) def tanri(a,y,nenri,tax): w = 0 for i in range(y): w += int(a * nenri) a -= tax return a+w def fukuri(a, y, nenri, tax): for i in range(y): a += int(a * nenri) - tax return a for i in range(M): A = int(input()) Y = int(input()) N = int(input())...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,005
s640388015
p00716
u798803522
1468148239
Python
Python3
py
Accepted
90
7664
876
trial = int(input()) for t in range(trial): money = int(input()) year = int(input()) cond = int(input()) answer = 0 for c in range(cond): initial = money bank = [float(n) for n in input().split(" ")] if bank[0] == 0: interest = 0 for y in range(ye...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,006
s260014699
p00716
u078042885
1484727420
Python
Python3
py
Accepted
80
7684
395
def co(a): global y,c,d for _ in range(y):a+=int(a*c)-d return int(a) def i(a): global y,c,d b=0 for _ in range(y): b+=int(a*c) a-=d return int(a+b) for _ in range(int(input())): m=0 a=int(input());y=int(input()) for _ in range(int(input())): b,c,d=map(f...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,007
s814213383
p00716
u078042885
1484727829
Python
Python3
py
Accepted
80
7640
388
def c(a): global y,r,d for _ in range(y):a+=int(a*r)-d return a def s(a): global y,r,d b=0 for _ in range(y): b+=int(a*r) a-=d return a+b for _ in range(int(input())): m=0 a=int(input());y=int(input()) for _ in range(int(input())): b,r,d=map(float,input(...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,008
s575662792
p00716
u779627195
1352650449
Python
Python
py
Accepted
40
4268
1,004
import sys n = int(raw_input()) for i in xrange(n): im = int(raw_input()) y = int(raw_input()) n = int(raw_input()) fm = 0 for j in xrange(n): w, ir, c = raw_input().split() w, ir, c = int(w), float(ir), int(c) if w == 1: ...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,009
s262564786
p00716
u109084363
1358010774
Python
Python
py
Accepted
30
4280
932
import sys def simple(money, rate, charge, year): temp = 0 for i in xrange(year): temp += int(money * rate) money -= charge return money + temp def compound(money, rate, charge, year): temp = 0 for i in xrange(year): money += int(money * rate) money -= charge r...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,010
s574010791
p00716
u104911888
1368575677
Python
Python
py
Accepted
40
4292
607
def simple(init,year,rate,fee): accum=0 for i in range(year): accum+=int(init*rate) init-=fee return init+accum def compound(init,year,rate,fee): for i in range(year): init+=int(init*rate-fee) return init m=input() for i in range(m): init=input() year=input() n=...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,011
s897767657
p00716
u617183767
1399194668
Python
Python
py
Accepted
40
4276
1,026
# -*- coding: utf-8 -*- import sys ''' ''' def func(): ''' ''' m = int(raw_input()) for num in range(m): init = int(raw_input()) years = int(raw_input()) n = int(raw_input()) answer = 0 for ope_num in range(n): operation, interest, fee = ma...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,012
s089231871
p00716
u633068244
1399450132
Python
Python
py
Accepted
50
4256
378
for _ in range(input()): asset = ans = input() year = input() n = input() for i in range(n): plan,rate,cost = map(float,raw_input().split()) if plan == 0.0: ans = max(ans,sum(int(rate*(asset - y*cost)) for y in range(year)) + asset - year*cost) else: cur = asset for y in range(year): cur = int(cu...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,013
s668856327
p00716
u240091169
1595372982
Python
Python3
py
Accepted
80
5640
569
def hukuri(y, m, p, t) : for i in range(y) : m += int(m * p) - t return m def tanri(y, m, p, t) : risoku = 0 for i in range(y) : risoku += int(m * p) m -= t return m+risoku M = int(input()) for i in range(M) : m = int(input()) y = int(input()) N = int(input(...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,014
s648593834
p00716
u829695570
1578782786
Python
Python3
py
Accepted
80
5632
552
def tanri(a, y, r, c): o = 0 for i in range(y): o += int((a-i*c)*r) o += a-y*c return o def fukuri(a, y, r, c): o = a for i in range(y): o = int(o*(1+r))-c return o m = int(input()) for _ in range(m): a = int(input()) y = int(input()) n = int(input()) b = ...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,015
s639182338
p00716
u314932236
1559721199
Python
Python3
py
Accepted
90
5636
994
def tanri(money, year, ritu, cost): temp = int(year*(money+cost)*ritu) temp -= (ritu * cost*year*(year-1))//2 return temp def tanri_a(m,y,r,c): temp = m ans = 0 for _ in range(y): ans += int(temp*r) temp -= c return ans + temp def hukuri(m, y, r, c): temp = (m-c/r)*((1+r)**(y-1)) return int(temp) def hu...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,016
s178484343
p00716
u245823788
1530771363
Python
Python3
py
Accepted
100
5624
464
m = int(input()) for _ in range(m): fund = int(input()) year = int(input()) n = int(input()) ans = fund for i in range(n): t, rate, fee = map(float, input().split()) if t: a = fund b = 0 for j in range(year): b = int(a*rate) a = a+b-fee ans = max(ans, a) els...
p00716
<h1><font color="#000">Problem A:</font> Ohgas' Fortune</h1> <p> The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by...
4 1000000 5 2 0 0.03125 3000 1 0.03125 3000 6620000 7 2 0 0.0732421875 42307 1 0.0740966796875 40942 39677000 4 4 0 0.0709228515625 30754 1 0.00634765625 26165 0 0.03662109375 79468 0 0.0679931640625 10932 10585000 6 4 1 0.0054931640625 59759 1 0.12353515625 56464 0 0.0496826171875 98193 0 0.0887451171875 78966
1150357 10559683 50796918 20829397
24,017
s383730792
p00717
u629780968
1545638125
Python
Python3
py
Accepted
60
5660
584
while 1: n=int(input()) if n==0: break data=[[] for i in range(n+1)] for i in range(n+1): m=int(input()) x,y=map(int,input().split()) for j in range(m-1): _x,_y=map(int,input().split()) data[i].append((abs(_x+_y-x-y),1 if x<_x else 3 if x>_x else 0 if y< _y else 2 )) x,y=_x,_y ...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,018
s435673476
p00717
u328199937
1556036043
Python
Python3
py
Accepted
50
6356
1,752
ans_list = [] while True: n = int(input()) if not n: break xy = [] for i in range(n + 1): xy.append([]) m = int(input()) x, y = map(int, input().split()) for j in range(m - 1): a, b = map(int, input().split()) xy[i].append([a - x, b - y]) ...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,019
s006682710
p00717
u731235119
1422899656
Python
Python
py
Accepted
30
4320
1,250
class Pline : def __init__(self, flag = False): self.m = int(raw_input()) self.points = [map(int,raw_input().split(" ")) for i in range(self.m)] self.points_rev = self.points[::-1] self.points = self.opt(self.points) if flag: self.points_rev = self.opt(self.points_rev) def isSame (self, pline): retu...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,020
s378890779
p00717
u633068244
1423749977
Python
Python
py
Accepted
30
4268
597
def is_same(A,B): for rot in range(4): for i in range(4): if A == B: return True B = [[y,-x] for x,y in B] B = [[x-B[-1][0],y-B[-1][-1]] for x,y in B][::-1] return False while 1: n = int(raw_input()) if n == 0: break poly = [] for loop in xrange(n+1):...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,021
s758339394
p00717
u633068244
1423750280
Python
Python
py
Accepted
30
4264
573
def is_same(A,B): for rot in range(2): for i in range(4): if A == B: return True B = [[y,-x] for x,y in B] B = [[x-B[-1][0],y-B[-1][-1]] for x,y in B][::-1] return False while 1: n = int(raw_input()) if n == 0: break poly = [] for i in xrange(n+1): ...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,022
s882800115
p00717
u399892098
1488955997
Python
Python
py
Accepted
30
6328
1,272
def rot90(li): li2 = [] for l in li: li2.append([l[0]*0+l[1]*(-1),l[0]*1+l[1]*0]) return li2 while True: num_in = input() if num_in == 0: break pattern_list = [] sam_li = [] num = input() flagg = 1 for j in range(num): x,y = map(int,raw_input().split()) ...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,023
s350223600
p00717
u371539389
1498201874
Python
Python3
py
Accepted
60
7792
1,139
import sys def spin(x): result=[] for i in x: result.append([-1*i[1],i[0]]) return result def rev(x): y=x.copy() y.reverse() a=y[0][0] b=y[0][1] for i in y: i[0]-=a i[1]-=b return y def check(x): if x==line_original or spin(x)==line_original or spin(spin...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,024
s726427911
p00717
u856705970
1498471949
Python
Python
py
Accepted
30
6316
688
def read_path(): m = int(raw_input()) return [complex(*[int(_) for _ in raw_input().split()]) for __ in xrange(m)] def is_cong(p1, p2): l = len(p1) if l != len(p2): return False r = (p1[1] - p1[0]) / (p2[1] - p2[0]) if r not in (1, 1j, -1, -1j): return False for i in xrange...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,025
s394062347
p00717
u509278866
1528436331
Python
Python3
py
Accepted
70
9108
1,560
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 998244353 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,026
s238677870
p00717
u855199458
1529734029
Python
Python3
py
Accepted
50
5632
1,679
# -*- coding: utf-8 -*- def main(): N = int(input()) while N: lines = [] for _ in range(N+1): tmp = [] M = int(input()) x0, y0 = map(int, input().split()) x1, y1 = map(int, input().split()) x2, y2 = map(int, input().split()) ...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,027
s040416622
p00717
u779627195
1352915373
Python
Python
py
Accepted
30
5016
1,976
def cross(a, b): return (a.real*b.imag - a.imag*b.real) EPS = 10**(-7) while 1: n = int(raw_input()) if n == 0: break l0 = [] d0 = [] for i in xrange(n+1): l = [] d = [] p = [] m = int(raw_input()) for j in xrange(m): x,y = map(int, raw_input...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,028
s705097112
p00717
u104911888
1389365015
Python
Python
py
Accepted
80
4380
909
from copy import deepcopy def rotate(L): return [[y, -x] for x, y in L] def move(src, tgt): for x, y in tgt: dx = x - src[0][0] dy = y - src[0][1] tmp = [[mx-dx, my-dy] for mx, my in tgt] yield tmp yield list(reversed(tmp)) def isSame(src, tgt): return src == tgt d...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,029
s809553801
p00717
u617183767
1399198936
Python
Python
py
Accepted
20
4420
2,837
# -*- coding: utf-8 -*- import sys ''' ''' def func(): ''' ''' while True: n = int(raw_input()) if n == 0: break # line_0 m = int(raw_input()) standard_positions = [] standard_lines = [] standard_reverse_lines = [] for pos_nu...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,030
s346432124
p00717
u668489394
1579248017
Python
Python3
py
Accepted
70
5632
2,803
class Line: def __init__(self, n, points): self.n = n self.points = points def getDesc(self): desc1 = self.getDist(self.points[0], self.points[1]) faceDir = self.getDir(self.points[0], self.points[1]) for i in range(1, self.n - 1): newDir = self.getDir(self.p...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,031
s848676083
p00717
u510451256
1570444866
Python
Python3
py
Accepted
50
5636
1,633
from sys import exit, stderr, stdin input = stdin.readline # setrecursionlimit(10**7) def debug(var, name="hoge"): print(name +":" + str(type(var)) + " = " + repr(var), file=stderr) return def main(): while(1): N = int(input()) if N == 0: break lines = [0] * (N+1) ...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,032
s247662519
p00717
u464321546
1562750587
Python
Python3
py
Accepted
50
5620
840
def check(a, b): for _ in range(4): if a == b: return True b = list(map(lambda x: [-x[1], x[0]], b)) return False def main(n): lines = [None] * n for i in range(n): m = int(input()) xy = [None] * m for j in range(m): xy[j] = list(map(int, in...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,033
s349124671
p00717
u191474223
1562660625
Python
Python3
py
Accepted
70
7176
1,590
from collections import defaultdict,deque import sys,heapq,bisect,math,itertools,string,queue,copy,time sys.setrecursionlimit(10**8) INF = float('inf') mod = 10**9+7 eps = 10**-7 def inp(): return int(input()) def inpl(): return list(map(int, input().split())) def inpl_str(): return list(input().split()) def calc_ar(b...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,034
s207214119
p00717
u886122084
1559756677
Python
Python3
py
Accepted
70
5732
2,118
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline def solve(): N = int(input()) if N == 0: exit() n = int(input()) true_Poly = [list(map(int, input().split())) for _ in range(n)] serach_Polys = [] for _ in range(N): n = int(input...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,035
s033157794
p00717
u281836941
1514520114
Python
Python3
py
Accepted
60
5660
669
# coding: utf-8 while 1: n=int(input()) if n==0: break data=[[] for i in range(n+1)] for i in range(n+1): m=int(input()) x,y=map(int,input().split()) for j in range(m-1): _x,_y=map(int,input().split()) data[i].append((abs(_x+_y-x-y),1 if x<_x else ...
p00717
<h1><font color="#000">Problem B:</font> Polygonal Line Search</h1> <p> Multiple polygonal lines are given on the <i>xy</i>-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. </p> <p> A polygonal line consists of several line segments ...
5 5 0 0 2 0 2 1 4 1 4 0 5 0 0 0 2 -1 2 -1 4 0 4 5 0 0 0 1 -2 1 -2 2 0 2 5 0 0 0 -1 2 -1 2 0 4 0 5 0 0 2 0 2 -1 4 -1 4 0 5 0 0 2 0 2 1 4 1 4 0 4 4 -60 -75 -60 -78 -42 -78 -42 -6 4 10 3 10 7 -4 7 -4 40 4 -74 66 -74 63 -92 63 -92 135 4 -12 22 -12 25 -30 25 -30 -47 4 12 -22 12 -25 30 -25 30 47 3 5 -8 5 -8 2 0 2 0 4 8 4 5 -...
1 3 5 +++++ 3 4 +++++ +++++
24,036
s397022437
p00718
u741801763
1531038900
Python
Python3
py
Accepted
80
5620
1,157
def get10(x): ans =0 alphabet = {'m':1000,'c':100,'x':10,'i':1} i =0 while i < len(x): if not x[i] in alphabet: ans += int(x[i])*alphabet[x[i+1]] i +=2 elif x[i] in alphabet: ans +=alphabet[x[i]] i+=1 return ans def getN(x): ans =[...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,037
s141270628
p00718
u328199937
1555849246
Python
Python3
py
Accepted
60
6296
1,301
ans_list = [] n = int(input()) def mcxl2digit(s): ans = 0 dig = 1 for i in range(len(s)): if "2" <= s[i] <= "9": dig = int(s[i]) else: if s[i] == "m": key = 1000 elif s[i] == "c": key = 100 elif s[i] == "x": ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,038
s955947447
p00718
u759949288
1405400190
Python
Python3
py
Accepted
90
6748
744
p = { 'm': 1000, 'c': 100, 'x': 10, 'i': 1, } def parseNum(s): if s[0].isdigit(): return int(s[0]), s[1:] return 1, s def parseChar(s): if s[0] in p: return p[s[0]], s[1:] print(s) def parseMCXI(s): res = 0 while s: x, s = parseNum(s) w, s = par...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,039
s433880264
p00718
u766477342
1420812382
Python
Python3
py
Accepted
90
6732
472
W = {'m':1000,'c':100,'x':10,'i':1} K = ['m','c','x','i'] for i in range(int(input())): x = input() tmp = 1 r = 0 for w in list(x): if w == ' ':continue if w in K: r += W[w] * tmp tmp = 1 else: tmp = int(w) div = 1000 res = '' for ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,040
s896057597
p00718
u316268279
1421850436
Python
Python3
py
Accepted
90
6724
660
#!/usr/bin/env python # -*- coding: utf-8 -*- mcxi = {'m' : 1000,'c' : 100, 'x': 10, 'i': 1} mcxi_inv = dict(zip(mcxi.values(),mcxi.keys())) def mcxi2num(text): num = 0 n = 1 for i in text: if i.isnumeric(): n = int(i) else: num += n * mcxi[i] n = 1 r...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,041
s036171909
p00718
u731235119
1421944315
Python
Python
py
Accepted
40
4288
605
def mcxi2num (mcxi): changer = {"m":1000, "c":100, "x":10, "i":1} num = 0 prefix = 1 for s in mcxi: if s in "mcxi": num += prefix * changer[s] prefix = 1 else : prefix = int(s) return num def num2mcxi (num): changer = ["i", "x", "c", "m"] mcxi = "" numstr = str(num) length = len(numstr) for i in...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,042
s621572712
p00718
u966364923
1436929023
Python
Python3
py
Accepted
90
6732
731
def MCXI_integer(mcxi): n = 0 buff = 1 for c in mcxi: if c in 'mcxi': buff *= 10**(3-['m', 'c', 'x', 'i'].index(c)) n += buff buff = 1 else: buff = int(c) return n def integer_MCXI(n): mcxi = '' buff = 0 for i in range(4): ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,043
s901800921
p00718
u998188826
1443334672
Python
Python3
py
Accepted
80
7724
697
def from_mcxi(s): n = 0 t = 1 for c in s: if c == 'm': n += t*1000 elif c == 'c': n += t*100 elif c == 'x': n += t*10 elif c == 'i': n += t*1 else: t = int(c) if c in 'mcxi': t = 1 return n def to_mcxi(n): s = '' if (n // 1000) > 0: if (n // 1000) > 1: s += str(n // 1000) s ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,044
s137102306
p00718
u338932851
1450787717
Python
Python
py
Accepted
50
6372
1,197
#num-> MCXI str #num <- int def encode(num): M=num/1000 num-=1000*M C=num/100 num-=100*C X=num/10 num-=X*10 I = num res="" l=[M,C,X,I] char=['m','c','x','i'] for i in range(4): if (l[i]==0): pass elif (l[i]==1): res=res+char[i] ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,045
s018863144
p00718
u488601719
1452489166
Python
Python
py
Accepted
30
6424
758
import math n = int(input()) def mcxi2int(s): m = {'m': 1000, 'c': 100, 'x': 10, 'i': 1} ret = 0 i = 0 while i < (len(s)): num = 1 maci = s[i] if maci.isdigit(): num = int(maci) maci = s[i + 1] i += 1 ret += num * m[maci] i +...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,046
s908853241
p00718
u166860661
1482067736
Python
Python
py
Accepted
60
6352
687
#coding: utf-8 n = int(raw_input()) def conv1(s): a = 0 st = ['i', 'x' , 'c', 'm'] for i in range(4): if s.find(st[i]) != -1: index = s.find(st[i]) try: a = a + 10 ** i * int(s[index - 1]) except: a = a + 10 ** i return a def...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,047
s046462460
p00718
u685815919
1482310539
Python
Python
py
Accepted
40
6360
582
w={"m":1000, "c":100, "x":10, "i":1} def mcxiToNum(s): res=0 while len(s)>0: if s[0] in w: res+=w[s[0]] s=s[1:] else: res+=w[s[1]]*int(s[0]) s=s[2:] return res def numToMcxi(n): s="ixcm" res="" for i in xrange(4): if n%10==...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,048
s790770329
p00718
u660912567
1484097146
Python
Python3
py
Accepted
80
7640
429
d = {'m':1000,'c':100,'x':10,'i':1} k = ['i','x','c','m'] def digit(s): r,p = 0,1 for x in s: if x.isdigit(): p = int(x) else: r += p*d[x] p = 1 return r for _ in range(int(input())): a,b = input().split() s = digit(a)+digit(b) r = [] for i,x in enume...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,049
s319443061
p00718
u078042885
1484721935
Python
Python3
py
Accepted
90
7696
305
a={'m':1000,'c':100,'x':10,'i':1} for _ in range(int(input())): b,s,t=input(),0,1 for x in b: if x==' ':continue if x in a:s+=a[x]*t;t=1 else:t=int(x) ans='' for k in ['m','c','x','i']: c,s=divmod(s,a[k]) if c:ans+=['',str(c)][c!=1]+k print(ans)
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,050
s527405047
p00718
u078042885
1484723225
Python
Python3
py
Accepted
80
7648
288
a={'m':1000,'c':100,'x':10,'i':1} for _ in range(int(input())): b,s,t=input().replace(' ',''),0,1 for x in b: if x in a:s+=a[x]*t;t=1 else:t=int(x) d='' for k in ['m','c','x','i']: c,s=divmod(s,a[k]) if c:d+=['',str(c)][c!=1]+k print(d)
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,051
s710568901
p00718
u399892098
1487324336
Python
Python
py
Accepted
60
6440
809
di = {"m":1000,"c":100,"x":10,"i":1} num = input() def decod(st): buf = 1 tot = 0 for i in st: if ((i == 'm') or (i == 'c') or (i == 'x') or (i == 'i')): tot += buf * di[i] buf = 1 else: buf = int(i) return tot def encod(num): l = [] st2 = "...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,052
s935527696
p00718
u546285759
1494485559
Python
Python3
py
Accepted
90
7612
841
mcxi = {"m": 1000, "c": 100, "x": 10, "i": 1} nums = [str(i) for i in range(2, 10)] def calc(s): tmp = 0 while s: c = s.pop() if c in nums: a = int(c) if len(s) == 0: tmp += a break c = s.pop() tmp += a * mcxi[c] ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,053
s021393219
p00718
u923668099
1495668719
Python
Python3
py
Accepted
60
7960
1,587
import sys inf = 1<<30 def solve(): n = int(sys.stdin.readline().rstrip()) for i in range(n): x, y = sys.stdin.readline().split() x = mcxi_to_digit(x) y = mcxi_to_digit(y) ans = digit_to_mcxi(x + y) print(ans) def mcxi_to_digit(x): res = 0 ps = -1 for ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,054
s133815019
p00718
u923668099
1495668986
Python
Python3
py
Accepted
70
7900
918
import sys inf = 1<<30 def solve(): n = int(sys.stdin.readline().rstrip()) for i in range(n): x, y = sys.stdin.readline().split() x = mcxi_to_digit(x) y = mcxi_to_digit(y) ans = digit_to_mcxi(x + y) print(ans) def mcxi_to_digit(x): res = 0 ps = -1 mcxi...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,055
s772865928
p00718
u506554532
1513130021
Python
Python3
py
Accepted
90
5620
565
def decode(s): ret = 0 u = 1 for c in 'ixcm': i = s.find(c) if i < 0: pass elif i == 0 or not s[i-1].isdigit(): ret += u else: ret += u * int(s[i-1]) u *= 10 return ret def encode(n): ret = '' for c in 'ixcm': d...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,056
s300083851
p00718
u509278866
1527906979
Python
Python3
py
Accepted
80
9428
1,747
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF()...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,057
s831202237
p00718
u314932236
1529826149
Python
Python3
py
Accepted
100
5632
1,062
import sys sys.setrecursionlimit(10**6) def toord(st): ans = "" if st//1000 != 0: if st // 1000 != 1: ans += str(st//1000) ans+="m" st = st % 1000 if st // 100 != 0: if st // 100 != 1: ans += str(st//100) ans += "c" st = st % 100 if st // 10 != 0: if st // 10 != 1: ans += str(st//10) ans +...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,058
s951333673
p00718
u136916346
1530290857
Python
Python3
py
Accepted
70
5620
765
def mtoi(l): r=0 c=1 for i in l: if i=="m": r+=c*1000 c=1 elif i=="c": r+=c*100 c=1 elif i=="x": r+=c*10 c=1 elif i=="i": r+=c c=1 else: c=int(i) return r ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,059
s998560154
p00718
u779627195
1352834237
Python
Python
py
Accepted
60
5596
982
n = int(raw_input()) num = [1000, 100, 10, 1] cha = ['m', 'c', 'x', 'i'] for i in xrange(n): po = raw_input().split() poyo = [0, 0] for j in xrange(2): c = 1 for k in xrange(len(po[j])): if po[j][k] == cha[0]: poyo[j] += c*num[0] c = 1 ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,060
s009886071
p00718
u109084363
1360336931
Python
Python
py
Accepted
30
4256
824
import sys def parse(n): temp = 0 digit = 1 for c in n: if c == 'm': temp += digit * 1000 digit = 1 elif c == 'c': temp += digit * 100 digit = 1 elif c == 'x': temp += digit * 10 digit = 1 elif c == 'i'...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,061
s856350645
p00718
u104911888
1368579720
Python
Python
py
Accepted
50
4296
563
def mcxiToDigit(s): s="1"+s num=0 dic={"m":1000,"c":100,"x":10,"i":1} for c in dic: if c in s: if "2"<=s[s.index(c)-1]<="9": num+=int(s[s.index(c)-1])*dic[c] else: num+=dic[c] return num for i in range(input()): L=raw_input().split...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,062
s496245520
p00718
u633068244
1399448955
Python
Python
py
Accepted
50
4288
458
dic = {"i":1,"x":10,"c":100,"m":1000} for r in range(input()): a,b = raw_input().split() s = 0 for i in range(len(a)-1,-1,-1): if a[i] in "ixcm": try: s += int(a[i-1])*dic[a[i]] except: s += dic[a[i]] for i in range(len(b)-1,-1,-1): if b[i] in "ixcm": try: s += int(b[i-1])*dic[b[i]] except: s+= dic[...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,063
s672892522
p00718
u708217907
1399560247
Python
Python
py
Accepted
40
4288
555
def mxciToDegit(s): dict = {'m': 1000, 'c': 100, 'x': 10, 'i': 1} sum = 0 for c in dict: if c in s: if "2" <= s[s.index(c)-1] <= "9": sum += int(s[s.index(c)-1])*dict[c] else: sum += dict[c] return sum n = int(raw_input()) for i in range(n): a, b = raw_input().split() sum = ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,064
s510942432
p00718
u617183767
1400463153
Python
Python
py
Accepted
40
4404
2,628
# -*- coding: utf-8 -*- import sys ''' ''' def func(): ''' ''' n = int(raw_input()) for i in range(n): numstr1, numstr2 = raw_input().split() num1 = 0 for index, c in enumerate(numstr1): if c == 'm': if index != 0 and numstr1[index-1].is...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,065
s377148427
p00718
u240091169
1595371907
Python
Python3
py
Accepted
80
5628
1,153
def m_i(l): stack = 1 ans = 0 l = list(l) for i in l : if i == 'm' : ans += stack * 1000 stack = 1 elif i == 'c' : ans += stack * 100 stack = 1 elif i == 'x' : ans += stack * 10 stack = 1 elif i == 'i...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,066
s350221892
p00718
u464321546
1562052482
Python
Python3
py
Accepted
100
5616
691
def S(s): m = ["i", "x", "c", "m"] res = 0 i = 0 tmp = 1 while i < len(s): if "2" <= s[i] <= "9": tmp = int(s[i]) else: res += tmp * 10 ** m.index(s[i]) tmp = 1 i += 1 return res def main(): m1 = ["i", "x", "c", "m"] s1, s2 = li...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,067
s409374948
p00718
u591052358
1561968946
Python
Python3
py
Accepted
100
5640
952
import sys sys.setrecursionlimit(10**5) def L(): return [x for x in input().split()] def LI(): return [int(x) for x in input().split()] def LF(): return [float(x) for x in input().split()] def LI_(): return [-1*int(x) for x in input().split()] def II(): return int(input()) def IF(): return float(input()) def LM(func,n...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,068
s319579117
p00718
u788553535
1561094501
Python
Python3
py
Accepted
100
5624
809
n = int(input()) for i in range(n): S,T = input().split() ans = [0,0,0,0] for s in range(len(S)): if S[s] in "mcxi": if s!=0 and not(S[s-1] in "mcxi"): ans["mcxi".find(S[s])] = int(S[s-1]) else: ans["mcxi".find(S[s])] = 1 for t in range(len...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,069
s988618147
p00718
u269127502
1560964922
Python
Python3
py
Accepted
80
5612
750
dic = {"m":1000, "c":100, "x":10, "i":1} dic_rev = {1000:"m", 100:"c", 10:"x", 1:"i"} N = int(input()) for i in range(N): slist = list(map(str, input().split())) numlist = [] for word in slist: before = 1 word_sum = 0 for c in word: if c in dic: word_sum ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,070
s614292841
p00718
u317942270
1559809302
Python
Python3
py
Accepted
80
5852
790
ans_list = [] # m:1000, c:100. x:10, i:1 n = int(input()) mcxi = list("mcxi")[::-1] def value(string): res = 0 for i in range(4): index = string.find(mcxi[i]) if index != -1: if string[index-1] in mcxi: res += pow(10,i) else: res += int(s...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,071
s550714458
p00718
u701749469
1556548480
Python
Python3
py
Accepted
90
5620
1,308
def main(): d_num = int(input()) for i in range(d_num): a, b = map(str, input().split(" ")) print(NtoS(StoN(a) + StoN(b))) def StoN(mcxi): slist = list(mcxi) for i in range(len(slist)): if slist[i] == 'm': slist[i] = 1000 elif slist[i] == 'c': slist[i] = 100 elif...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,072
s227998925
p00718
u352394527
1544476321
Python
Python3
py
Accepted
90
5620
662
def parse(s): ret = 0 dic = {"m":1000, "c":100, "x":10, "i":1} while s: if s[0] in dic: ret += dic[s[0]] s = s[1:] else: ret += int(s[0]) * dic[s[1]] s = s[2:] return ret def conv(n): ret = "" def func(ret, c, i): if i == 0: pass elif i == 1: ret += c ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,073
s006833958
p00718
u260980560
1542541691
Python
Python3
py
Accepted
80
5856
587
D = "mcxi" V = [1000, 100, 10, 1] def conv1(s): v = 0; t = 1 for c in s: idx = D.find(c) if idx > -1: v += t * V[idx] t = 1 else: t = int(c) return v def conv2(v): s = [] for i in range(4): if v >= V[i]: k = v // V[i] ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,074
s658618986
p00718
u281836941
1513186665
Python
Python3
py
Accepted
100
5624
548
# coding: utf-8 r=list('mcxi') m=r[::-1] n=int(input()) for i in range(n): a,b=input().split() x=int(''.join(['0' if len(a.split(c))==1 else '1' if a.split(c)[0]=='' or a.split(c)[0][-1] in 'mcxi' else a.split(c)[0][-1] for c in r])) y=int(''.join(['0' if len(b.split(c))==1 else '1' if b.split(c)[0]=='' or ...
p00718
<h1><font color="#000">Problem C:</font> Numeral System</h1> <p> Prof. Hachioji has devised a new numeral system of integral numbers with four lowercase letters "m", "c", "x", "i" and with eight digits "2", "3", "4", "5", "6", "7", "8", "9". He doesn't use digit "0" nor digit "1" in this system. </p> <p> The let...
10 xi x9i i 9i c2x2i 4c8x8i m2ci 4m7c9x8i 9c9x9i i i 9m9c9x8i m i i m m9i i 9m8c7xi c2x8i
3x x 6cx 5m9c9x9i m 9m9c9x9i mi mi mx 9m9c9x9i
24,075
s058879693
p00723
u010611609
1558953082
Python
Python3
py
Accepted
80
5636
348
def solve(s): res = set([s]) for split_at in range(1, len(s)): a = s[:split_at] b = s[split_at:] res.add(a[::-1] + b) res.add(a + b[::-1]) res.add(a[::-1] + b[::-1]) res.add(b + a) res.add(b[::-1] + a) res.add(b + a[::-1]) res.add(b[::-1] + a[::-1]) return len(res) N = int(input()) for _ in range(...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,076
s361066017
p00723
u844945939
1414329274
Python
Python3
py
Accepted
60
6792
327
for i in range(int(input())): d = input() s = {d, d[::-1]} for j in range(1, len(d)): da, db = d[:j], d[j:] dar, dbr = da[::-1], db[::-1] s.add(da + dbr) s.add(dar + db) s.add(dar + dbr) s.add(db + da) s.add(db + dar) s.add(dbr + da) print(...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,077
s603134068
p00723
u844945939
1414392452
Python
Python3
py
Accepted
50
6792
327
for i in range(int(input())): d = input() s = {d, d[::-1]} for j in range(1, len(d)): da, db = d[:j], d[j:] dar, dbr = da[::-1], db[::-1] s.add(da + dbr) s.add(dar + db) s.add(dar + dbr) s.add(db + da) s.add(db + dar) s.add(dbr + da) print(...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,078
s508638494
p00723
u408260374
1418575886
Python
Python3
py
Accepted
80
6848
304
m = int(input()) for i in range(m): d = input() trains = [d] for j in range(1, len(d)): trains.extend([d[:j][::-1] + d[j:], d[:j] + d[j:][::-1], d[:j][::-1] + d[j:][::-1], d[j:] + d[:j], d[j:][::-1] + d[:j], d[j:] + d[:j][::-1], d[j:][::-1] + d[:j][::-1]]) print(len(set(trains)))
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,079
s052425122
p00723
u408260374
1418576420
Python
Python3
py
Accepted
50
6848
256
m = int(input()) for i in range(m): d = input() trains = [d] for j in range(1, len(d)): f, b = d[:j], d[j:] rf, rb = f[::-1], b[::-1] trains.extend([rf+b, f+rb, rf+rb, b+f, rb+f, b+rf, rb+rf]) print(len(set(trains)))
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,080
s517191747
p00723
u617183767
1420614768
Python
Python
py
Accepted
50
4752
886
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys import itertools import math from collections import Counter, defaultdict class Main(object): def __init__(self): pass def solve(self): ''' insert your code ''' m = input() for i in range(...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,081
s189692167
p00723
u766477342
1420756758
Python
Python3
py
Accepted
60
6792
435
m = int(input()) for i in range(m): d = input() _set = set() for i in range(len(d)-1): w1 = d[:i+1] w2 = d[i+1:] w1_r = w1[::-1] w2_r = w2[::-1] _set.add(w1 + w2) _set.add(w2 + w1) _set.add(w1_r+w2_r) _set.add(w2_r+w1_r) _set.add(w1 + ...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,082
s472788404
p00723
u731235119
1421942851
Python
Python
py
Accepted
30
4264
392
n = int(raw_input()) for i in range(n): s = raw_input() length = len(s) organize_set = set([s, s[::-1]]) for j in range(1,length): f = s[:j] frev = f[::-1] b = s[j:] brev = b[::-1] organize_set.add(f + brev) organize_set.add(b + f) organize_set.add(brev + f) organize_set.add(frev + b) organize_se...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,083
s300521028
p00723
u120360464
1423015154
Python
Python
py
Accepted
50
4272
438
#! /usr/bin/python # -*- coding: utf-8 -*- n = int(raw_input()) for i in range(n): ft = raw_input() s = set([ft]) for j in range(1, len(ft)): c1 = ft[j:] c2 = ft[:j] s.add(c1+c2) s.add(c1[::-1]+c2) s.add(c1[::-1]+c2[::-1]) s.add(c1+c2[::-1]) s.add(c2+...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,084
s746341524
p00723
u966364923
1436927427
Python
Python3
py
Accepted
80
6872
898
def prime_list(n): p = [True for i in range(n)] p[0] = False p[1] = False for j in range(4, n, 2): p[j] = False i = 3 while i*i < n: if p[i]: for j in range(2*i, n, i): p[j] = False i += 2 p_list = [2*i+1 for i in range(1,n//2) if p[2*i...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,085
s035567287
p00723
u998188826
1443333648
Python
Python3
py
Accepted
70
7600
312
n = int(input()) for i in range(n): s = input() ss = set() for i in range(len(s)-1): s1 = s[0:i+1] s2 = s[i+1:] ss.add(s1+s2) ss.add(s1+s2[::-1]) ss.add(s1[::-1]+s2) ss.add(s1[::-1]+s2[::-1]) ss.add(s2+s1) ss.add(s2+s1[::-1]) ss.add(s2[::-1]+s1) ss.add(s2[::-1]+s1[::-1]) print(len(ss))
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,086
s036814655
p00723
u488601719
1452596375
Python
Python
py
Accepted
60
6436
447
n = input() for _ in range(n): s = raw_input() bag = set() for i in range(len(s)): head = s[:i] tail = s[i:] bag.add(head + tail) bag.add(head + tail[:: -1]) bag.add(head[:: -1] + tail) bag.add(head[:: -1] + tail[:: -1]) bag.add(tail + head) ...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,087
s669727099
p00723
u338932851
1456382678
Python
Python
py
Accepted
70
6348
531
n=int(raw_input()) def comb(tr): l=len(tr) res=[] for i in range(l): head,tail=tr[i:],tr[:i] headrev=head[::-1] tailrev=tail[::-1] res.append(head+tail) res.append(headrev+tail) res.append(head+tailrev) res.append(headrev+tailrev) res.append(t...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,088
s584282166
p00723
u660912567
1484161188
Python
Python3
py
Accepted
70
7652
224
for _ in range(int(input())): s = input() l = set([s,s[::-1]]) for i in range(1,len(s)): a,b,ra,rb = s[:i],s[i:],s[:i][::-1],s[i:][::-1] l |= set([a+rb,ra+b,ra+rb,b+a,b+ra,rb+a]) print(len(l))
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,089
s892260422
p00723
u856705970
1493033475
Python
Python
py
Accepted
40
6312
268
M = int(raw_input()) for _ in xrange(M): S = raw_input() a = {S} for i in xrange(len(S)): L = S[:i] R = S[i:] L2 = L[::-1] R2 = R[::-1] a |= {L + R2, L2 + R, L2 + R2, R + L, R + L2, R2 + L, R2 + L2} print(len(a))
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,090
s364968094
p00723
u910106747
1493569397
Python
Python3
py
Accepted
90
7996
440
import collections for t in range(int(input())): res = collections.defaultdict(int) s = input() for i in range(len(s)-1): s1 = s[:i+1] s2 = s[i+1:] res[s1+s2] += 1 res[s1[::-1]+s2] += 1 res[s1+s2[::-1]] += 1 res[s1[::-1]+s2[::-1]] += 1 res[s2+s1] +...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,091
s805790397
p00723
u923668099
1495621768
Python
Python3
py
Accepted
60
7632
741
import sys def solve(): m = int(sys.stdin.readline().rstrip()) for i in range(m): train = sys.stdin.readline().rstrip() n = len(train) s = set() s.add(train) s.add(train[::-1]) for j in range(1, n): # s.add(train[:j] + train[j:]) = train ...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,092
s406951686
p00723
u807440918
1498799522
Python
Python3
py
Accepted
80
7716
496
# coding: utf-8 for i in range(int(input())): data = input() d_set = set() for i in range(len(data)-1): str1 = data[ 0 : i+1 ] str2 = data[ i+1 : len(data) ] d_set.add(str1+str2) d_set.add(str1+str2[::-1]) d_set.add(str1[::-1]+str2) d_set.add(str1[::-1]+str2[:...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,093
s441896637
p00723
u947762778
1510026020
Python
Python3
py
Accepted
90
7648
450
def reverseStr(s): return s[::-1] n = int(input()) for i in range(n): s = input() d = set([]) for j in range(1,len(s)): a = s[:j] b = s[j:] d.add(a+b) d.add(b+a) d.add(a + reverseStr(b)) d.add(b + reverseStr(a)) d.add(reverseStr(a) + b) d....
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,094
s674206606
p00723
u506554532
1513069383
Python
Python3
py
Accepted
70
5636
363
N = int(input()) src = [input() for i in range(N)] for s in src: st = set([s]) for n in range(1,len(s)): s1,s2 = s[:n], s[n:] r1,r2 = s1[::-1], s2[::-1] st.add(s1 + r2) st.add(r1 + s2) st.add(r1 + r2) st.add(s2 + s1) st.add(s2 + r1) st.add(r2 + s1)...
p00723
<h1><font color="#000">Problem B:</font> <a name="section_B">Organize Your Train part II</a></h1> <p> RJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1. </p> <center> <img src="https://judgeapi.u...
4 aa abba abcd abcde
1 6 12 18
24,095