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
s422445060
p00815
u281836941
1573810296
Python
Python3
py
Accepted
40
6208
1,057
#1236 q=int(input()) for _ in range(q): data=[] while 1: data+=list(map(int,input().split())) if data[-1]==0: break rooms=[(-1,1,[])] now=0 i=0 st=[] counter=[-1 for i in range(1000)] while data[i]!=0: while rooms[now][1]<=len(rooms[now][2]): ...
p00815
<H1><font color="#000">Problem E:</font> Map of Ninja House</H1> <p> An old document says that a Ninja House in Kanazawa City was in fact a defensive fortress, which was designed like a maze. Its rooms were connected by hidden doors in a complicated manner, so that any invader would become lost. Each room has at least...
2 3 3 3 3 -3 3 2 -5 3 2 -5 -3 0 3 5 4 -2 4 -3 -2 -2 -1 0
1 2 4 6 2 1 3 8 3 2 4 7 4 1 3 5 5 4 6 7 6 1 5 7 3 5 8 8 2 7 1 2 3 4 2 1 3 3 4 4 3 1 2 2 4 4 1 2 2 3
25,017
s094363710
p00815
u509278866
1543379069
Python
Python3
py
Accepted
70
9124
1,769
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**13 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin....
p00815
<H1><font color="#000">Problem E:</font> Map of Ninja House</H1> <p> An old document says that a Ninja House in Kanazawa City was in fact a defensive fortress, which was designed like a maze. Its rooms were connected by hidden doors in a complicated manner, so that any invader would become lost. Each room has at least...
2 3 3 3 3 -3 3 2 -5 3 2 -5 -3 0 3 5 4 -2 4 -3 -2 -2 -1 0
1 2 4 6 2 1 3 8 3 2 4 7 4 1 3 5 5 4 6 7 6 1 5 7 3 5 8 8 2 7 1 2 3 4 2 1 3 3 4 4 3 1 2 2 4 4 1 2 2 3
25,018
s095022407
p00816
u467175809
1531285599
Python
Python
py
Accepted
20
5036
911
#!/usr/bin/env python import sys import math import itertools as it from collections import deque sys.setrecursionlimit(10000000) while True: N, S = raw_input().split() if N == "0" and S == "0": break N = int(N) m = {} def func(index, num, lst): if index == len(S): if ...
p00816
<H1><font color="#000">Problem F:</font> Shredding Company</H1> <p> You have just been put in charge of developing a new shredder for the Shredding Company. Although a ``normal'' shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, this new shredder needs to have t...
50 12346 376 144139 927438 927438 18 3312 9 3142 25 1299 111 33333 103 862150 6 1104 0 0
43 1 2 34 6 283 144 139 927438 927438 18 3 3 12 error 21 1 2 9 9 rejected 103 86 2 15 0 rejected
25,019
s007762318
p00816
u633068244
1424023860
Python
Python
py
Accepted
20
4400
694
import itertools while 1: t,s = map(int,raw_input().split()) if t == 0: break ans = s if s <= t else 0 s = str(s) nums = [s] if ans > 0 else [] n = len(s) reject = False for split in xrange(1,n): for cuts in itertools.combinations(range(1,n),split): cuts = [0]+list(cu...
p00816
<H1><font color="#000">Problem F:</font> Shredding Company</H1> <p> You have just been put in charge of developing a new shredder for the Shredding Company. Although a ``normal'' shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, this new shredder needs to have t...
50 12346 376 144139 927438 927438 18 3312 9 3142 25 1299 111 33333 103 862150 6 1104 0 0
43 1 2 34 6 283 144 139 927438 927438 18 3 3 12 error 21 1 2 9 9 rejected 103 86 2 15 0 rejected
25,020
s658214058
p00816
u858560358
1508408741
Python
Python
py
Accepted
20
6412
905
#!/usr/bin/python def shred(num, bit): num = list(str(num)) i = 0 while bit: if bit & 1: num[i] += num[i+1] num.pop(i+1) else: i += 1 bit >>= 1 return num def testcase_ends(): t, num = map(int, raw_input().split()) if t == 0 and num...
p00816
<H1><font color="#000">Problem F:</font> Shredding Company</H1> <p> You have just been put in charge of developing a new shredder for the Shredding Company. Although a ``normal'' shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, this new shredder needs to have t...
50 12346 376 144139 927438 927438 18 3312 9 3142 25 1299 111 33333 103 862150 6 1104 0 0
43 1 2 34 6 283 144 139 927438 927438 18 3 3 12 error 21 1 2 9 9 rejected 103 86 2 15 0 rejected
25,021
s934797280
p00816
u144532944
1508752363
Python
Python
py
Accepted
30
6296
926
def shred(num, bit): num = list(str(num)) i = 0 while bit: if bit & 1: num[i] += num.pop(i+1) else: i += 1 bit >>= 1 return num def testcase_ends(): t, num = map(int, raw_input().split()) if t == 0 and num == 0: return 1 cutcand = [...
p00816
<H1><font color="#000">Problem F:</font> Shredding Company</H1> <p> You have just been put in charge of developing a new shredder for the Shredding Company. Although a ``normal'' shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, this new shredder needs to have t...
50 12346 376 144139 927438 927438 18 3312 9 3142 25 1299 111 33333 103 862150 6 1104 0 0
43 1 2 34 6 283 144 139 927438 927438 18 3 3 12 error 21 1 2 9 9 rejected 103 86 2 15 0 rejected
25,022
s815837957
p00816
u509278866
1528694976
Python
Python3
py
Accepted
70
9036
1,642
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 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdi...
p00816
<H1><font color="#000">Problem F:</font> Shredding Company</H1> <p> You have just been put in charge of developing a new shredder for the Shredding Company. Although a ``normal'' shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, this new shredder needs to have t...
50 12346 376 144139 927438 927438 18 3312 9 3142 25 1299 111 33333 103 862150 6 1104 0 0
43 1 2 34 6 283 144 139 927438 927438 18 3 3 12 error 21 1 2 9 9 rejected 103 86 2 15 0 rejected
25,023
s310016625
p00816
u998437062
1572436112
Python
Python3
py
Accepted
40
5592
718
#!/usr/bin/env python3 while True: t, n = input().split() t = int(t) if t == 0: exit() L = len(n) m = 0 parts = [] f = False for b in range(1 << (L - 1)): c = int(n[0]) s = 0 li = [] for k in range(L - 1): if b >> k & 1 == 1: ...
p00816
<H1><font color="#000">Problem F:</font> Shredding Company</H1> <p> You have just been put in charge of developing a new shredder for the Shredding Company. Although a ``normal'' shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, this new shredder needs to have t...
50 12346 376 144139 927438 927438 18 3312 9 3142 25 1299 111 33333 103 862150 6 1104 0 0
43 1 2 34 6 283 144 139 927438 927438 18 3 3 12 error 21 1 2 9 9 rejected 103 86 2 15 0 rejected
25,024
s948156602
p00816
u464321546
1571818653
Python
Python3
py
Accepted
40
6044
1,227
import itertools from heapq import heappop, heappush from collections import defaultdict def main(t, num): num = list(str(num)) d = defaultdict(int) if t < sum(map(int, num)): print("error") return q = [[0,[]]] itertools.product() fulls = itertools.product(range(2), repeat=len(nu...
p00816
<H1><font color="#000">Problem F:</font> Shredding Company</H1> <p> You have just been put in charge of developing a new shredder for the Shredding Company. Although a ``normal'' shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, this new shredder needs to have t...
50 12346 376 144139 927438 927438 18 3312 9 3142 25 1299 111 33333 103 862150 6 1104 0 0
43 1 2 34 6 283 144 139 927438 927438 18 3 3 12 error 21 1 2 9 9 rejected 103 86 2 15 0 rejected
25,025
s272251499
p00817
u844945939
1417912275
Python
Python3
py
Accepted
70
6944
2,872
from collections import defaultdict class UnionFind(): def __init__(self, n): self.parent = list(range(n)) self.rank = [0] * n def find(self, x): if self.parent[x] == x: return x else: self.parent[x] = self.find(self.parent[x]) return self.p...
p00817
<H1><font color="#000">Problem G:</font> True Liars</H1> <p> After having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ashore on a foggy island. Though he was exhausted and despaired, he was still fortunate to remember a legend of the foggy island, which he had heard from pat...
2 1 1 1 2 no 2 1 no 3 2 1 1 1 yes 2 2 yes 3 3 yes 2 2 1 1 2 yes 2 3 no 5 4 3 1 2 yes 1 3 no 4 5 yes 5 6 yes 6 7 no 0 0 0
no no 1 2 end 3 4 5 6 end
25,026
s999788776
p00817
u260980560
1591527757
Python
Python3
py
Accepted
50
6328
1,934
from collections import deque import sys readline = sys.stdin.readline write = sys.stdout.write def solve(): N, p1, p2 = map(int, readline().split()) if N == p1 == p2 == 0: return False P = p1 + p2 G = [[] for i in range(P)] for i in range(N): x, y, a = readline().strip().split() ...
p00817
<H1><font color="#000">Problem G:</font> True Liars</H1> <p> After having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ashore on a foggy island. Though he was exhausted and despaired, he was still fortunate to remember a legend of the foggy island, which he had heard from pat...
2 1 1 1 2 no 2 1 no 3 2 1 1 1 yes 2 2 yes 3 3 yes 2 2 1 1 2 yes 2 3 no 5 4 3 1 2 yes 1 3 no 4 5 yes 5 6 yes 6 7 no 0 0 0
no no 1 2 end 3 4 5 6 end
25,027
s984573839
p00819
u144532944
1531369734
Python
Python3
py
Accepted
20
5604
487
funcs = { 'J': lambda s: s[-1:]+s[:-1], 'C': lambda s: s[1:]+s[0], 'E': lambda s: s[(len(s)+1)//2:]+s[len(s)//2:(len(s)+1)//2]+s[:len(s)//2], 'A': lambda s: s[::-1], 'P': lambda s: s.translate(str.maketrans('0123456789', '9012345678')), 'M': lambda s: s.translate(str.maketrans('0123456789', '123...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,028
s960072119
p00819
u617183767
1421850468
Python
Python
py
Accepted
20
4680
1,756
#! /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 ''' n = input() for i in range(...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,029
s123259054
p00819
u633068244
1421854110
Python
Python
py
Accepted
20
4272
906
for loop in range(int(raw_input())): manu = raw_input() msg = raw_input() size = len(msg) for s in manu[::-1]: if s == "J": msg = msg[-1]+msg[:-1] if size > 1 else msg elif s == "C": msg = msg[1:]+msg[0] if size > 1 else msg elif s == "E": ...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,030
s751824727
p00819
u316268279
1422001405
Python
Python3
py
Accepted
30
6840
730
#!/usr/bin/env python # -*- coding: utf-8 -*- from math import * functions = dict() functions['J'] = lambda s: s[1:]+s[0] functions['C'] = lambda s: s[-1] + s[:-1] functions['A'] = lambda s: ''.join(reversed(s)) functions['E'] = lambda s: s[ceil(len(s)/2):] + s[len(s)//2:ceil(len(s)/2)] + s[:len(s)//2] functions['P']...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,031
s616308714
p00819
u731235119
1422033044
Python
Python
py
Accepted
10
4276
782
def correct(m, s): if m == "J": return s[-1] + s[:len(s)-1] elif m == "C": return s[1:] + s[0] elif m == "E": length = len(s) if length % 2 == 0: return s[length / 2:] + s[:length / 2] else : return s[(length+1) / 2:] + s[(length-1) / 2] + s[:(length-1) / 2] elif m == "A": return s[::-1] elif m =...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,032
s928173943
p00819
u120360464
1423554641
Python
Python
py
Accepted
10
4312
1,210
#! /usr/bin/python # -*- coding: utf-8 -*- n = int(raw_input()) for i in range(n): ger = raw_input() mes = raw_input() for j in range(len(ger)-1, -1, -1): if ger[j] == 'J': mes = mes[len(mes)-1]+mes[0:len(mes)-1] elif ger[j] == 'C': mes = mes[1:len(mes)]+mes[0] ...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,033
s215588863
p00819
u408260374
1432271577
Python
Python3
py
Accepted
30
6748
849
def decodeJ(s): return s[-1] + s[:-1] def decodeC(s): return s[1:] + s[0] def decodeE(s): lenS = len(s) return s[lenS//2:] + s[:lenS//2] if lenS % 2 == 0 else s[lenS//2+1:] + s[lenS//2] + s[:lenS//2] def decodeA(s): return s[::-1] def decodeP(s): ret = [] for i in s: try: ...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,034
s177857098
p00819
u728992264
1490470272
Python
Python3
py
Accepted
20
7720
867
n = int(input()) for i in range(n): order = input()[::-1] message = input() for s in order: if s == 'J': message = message[len(message) - 1] + message[:len(message) - 1] elif s == 'C': message = message[1:] + message[0] elif s == 'E': message = message[(len(message)+1)//2:] + mess...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,035
s334502698
p00819
u506554532
1513415114
Python
Python3
py
Accepted
20
5596
731
def decode(mes,command): if command == 'J': return mes[-1] + mes[:-1] elif command == 'C': return mes[1:] + mes[0] elif command == 'E': m = len(mes)//2 if len(mes)%2 == 0: return mes[m:] + mes[:m] else: return mes[m+1:] + mes[m] + mes[:m] e...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,036
s846221701
p00819
u023471147
1527152520
Python
Python3
py
Accepted
20
5608
965
n = int(input()) for i in range(n): order = str(input()) mes = str(input()) l = len(mes) for p in reversed(order): if p == "J": mes = mes[-1] + mes[:-1] elif p == "C": mes = mes[1:] + mes[0] elif p == "E": if l % 2 == 0: mes ...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,037
s607267489
p00819
u509278866
1528087484
Python
Python3
py
Accepted
60
9028
1,405
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...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,038
s084201669
p00819
u109084363
1360340798
Python
Python
py
Accepted
20
4352
1,113
import sys import bisect n = int(sys.stdin.readline()) for z in xrange(n): order = sys.stdin.readline().strip() string = sys.stdin.readline().strip() half = len(string) / 2 num = set(map(str, [0,1,2,3,4,5,6,7,8,9])) for o in order[::-1]: # print string, o if o == 'J': ...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,039
s372641650
p00819
u759949288
1361889983
Python
Python
py
Accepted
20
4268
638
def P(m): if m.isdigit(): next = int(m) - 1 if next < 0: return "9" return str(next) return m def M(m): if m.isdigit(): return str((int(m) + 1) % 10) return m n = input() for i in xrange(n): order = raw_input() msg = raw_input() for c in reversed(order): if c == "J": msg = msg[-1] + msg[:-1] if c ...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,040
s009649264
p00819
u104911888
1372581993
Python
Python
py
Accepted
10
4276
1,099
def C(m): return m[1:]+m[:1] def J(m): return m[-1:]+m[:-1] def E(m): lenm=len(m) h=lenm/2 if h*2==lenm or h==0: temp=m[-h:]+m[:h] else: temp=m[-h:]+m[h]+m[:h] return temp def A(m): return m[::-1] def M(m): m=list(m) for i in range(len(m)): if m[i].isd...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,041
s866644673
p00819
u240091169
1594036392
Python
Python3
py
Accepted
20
5612
1,427
def J(m) : tmp = m[-1] del m[-1] m.insert(0, tmp) return m def C(m) : tmp = m[0] del m[0] m.append(tmp) return m def E(m) : if len(m) % 2 == 1 : x = len(m) // 2 tmp = m[0:x] middle = m[x] del m[0:x+1] m = m + [middle] + tmp re...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,042
s978654022
p00819
u304266926
1592622724
Python
Python3
py
Accepted
20
5604
487
funcs = { 'J': lambda s: s[-1:]+s[:-1], 'C': lambda s: s[1:]+s[0], 'E': lambda s: s[(len(s)+1)//2:]+s[len(s)//2:(len(s)+1)//2]+s[:len(s)//2], 'A': lambda s: s[::-1], 'P': lambda s: s.translate(str.maketrans('0123456789', '9012345678')), 'M': lambda s: s.translate(str.maketrans('0123456789', '123...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,043
s237761980
p00819
u823642749
1590369382
Python
Python3
py
Accepted
20
5628
2,656
""" J氏は、メッセージのすべての文字を左に1つ回転させます。 たとえば、「aB23d」を「B23da」に変換します。 ミスCは、メッセージのすべての文字を1つ右に回転します。 たとえば、彼女は「aB23d」を「daB23」に変換します。 E氏はメッセージの左半分を右半分と入れ替えます。メッセージの文字数が奇数の場合、中央の文字は移動しません。 たとえば、「e3ac」を「ace3」に、「aB23d」を「3d2aB」に変換します。 A氏はメッセージを逆にします。たとえば、「aB23d」を「d32Ba」に変換します。 Dr. Pは、メッセージ内のすべての数字を1つ増やします。数字が「9」の場合、「0」になります。アルファベット...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,044
s649574990
p00819
u325540378
1589794155
Python
Python3
py
Accepted
20
5608
1,110
def C(S): return S[1:] + S[0] def J(S): return S[-1] + S[:-1] def E(S): temp = len(S) // 2 if len(S) % 2 == 0: S = S[temp:] + S[:temp] else: S = S[temp + 1:] + S[temp] + S[:temp] return S def A(S): return S[::-1] def M(S): temp = [] for s in S: if s.i...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,045
s038517121
p00819
u611579581
1589640172
Python
Python3
py
Accepted
20
5604
1,439
def J(string): return string[-1] + string[:-1] if len(string) >= 2 else string def C(string): return string[1:] + string[0] if len(string) >= 2 else string def E(string): if len(string) == 1: return string if len(string) % 2: return string[len(string) // 2 + 1:] + string[...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,046
s618113402
p00819
u668489394
1579481777
Python
Python3
py
Accepted
20
5616
1,418
def rotateRight(msg): if len(msg) == 1: return msg return msg[-1] + msg[:-1] def rotateLeft(msg): if len(msg) == 1: return msg return msg[1:] + msg[0] def swapHalf(msg): if len(msg) == 1: return msg H = len(msg) // 2 if len(msg) % 2 == 0: return msg[H:] + ms...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,047
s837673639
p00819
u464321546
1572421961
Python
Python3
py
Accepted
20
5608
916
def main(): s = input() ans = list(input()) s = reversed(s) for si in s: if si == "C": ans = ans[1:] + [ans[0]] if si == "J": ans = [ans[-1]] + ans[:-1] if si == "E": tmp = [ans[len(ans) // 2]] if len(ans) & 1 else [] ans = ans[len(...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,048
s266662926
p00819
u853158149
1572420428
Python
Python3
py
Accepted
40
8168
1,589
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()]...
p00819
<H1><font color="#000">Problem A:</font> Unreliable Messengers</H1> <p> The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servant...
5 AJMP aB23d E 86AE AM 6 JPEM WaEaETC302Q CP rTurnAGundam1isdefferentf
32Bad AE86 7 EC302QTWaEa TurnAGundam0isdefferentfr
25,049
s790748856
p00823
u509278866
1535359221
Python
Python3
py
Accepted
60
9080
3,362
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 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin....
p00823
<H1><font color="#000">Problem E:</font> Molecular Formula</H1> <p> Your mission in this problem is to write a computer program that manipulates molecular for- mulae in <i>virtual chemistry</i>. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not hav...
H 1 He 4 C 12 O 16 F 19 Ne 20 Cu 64 Cc 333 END_OF_FIRST_PART H2C (MgF)2As Cu(OH)2 H((CO)2F)99 0
14 UNKNOWN 98 7426
25,050
s880797289
p00823
u591052358
1540391614
Python
Python3
py
Accepted
30
5604
1,834
dic = {} while 1: line = input() if line == "END_OF_FIRST_PART": break index,num = line.split() dic[index] = int(num) def solve(st): #print(st) if st == "0": return False ans = 0 kigou = "" mass = 0 num = "" i = 0 while i < len(st): #print(st...
p00823
<H1><font color="#000">Problem E:</font> Molecular Formula</H1> <p> Your mission in this problem is to write a computer program that manipulates molecular for- mulae in <i>virtual chemistry</i>. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not hav...
H 1 He 4 C 12 O 16 F 19 Ne 20 Cu 64 Cc 333 END_OF_FIRST_PART H2C (MgF)2As Cu(OH)2 H((CO)2F)99 0
14 UNKNOWN 98 7426
25,051
s878794576
p00823
u856705970
1499078293
Python
Python
py
Accepted
10
6376
1,510
weights = {} def calc(expr): ans = 0 i = 0 l = len(expr) while i < l: c = expr[i] if c == "(": expr2 = "" depth = 1 i += 1 while i < l and depth > 0: c2 = expr[i] if c2 == "(": depth += ...
p00823
<H1><font color="#000">Problem E:</font> Molecular Formula</H1> <p> Your mission in this problem is to write a computer program that manipulates molecular for- mulae in <i>virtual chemistry</i>. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not hav...
H 1 He 4 C 12 O 16 F 19 Ne 20 Cu 64 Cc 333 END_OF_FIRST_PART H2C (MgF)2As Cu(OH)2 H((CO)2F)99 0
14 UNKNOWN 98 7426
25,052
s483280988
p00823
u467175809
1529696331
Python
Python
py
Accepted
10
5036
952
#!/usr/bin/env python from collections import deque import itertools as it import sys sys.setrecursionlimit(1000000) m = {} m2 = {} def check(S): return ord('0') <= ord(S) and ord(S) <= ord('9') while True: S = raw_input() if S == 'END_OF_FIRST_PART': break atom, w = S.split() if len(at...
p00823
<H1><font color="#000">Problem E:</font> Molecular Formula</H1> <p> Your mission in this problem is to write a computer program that manipulates molecular for- mulae in <i>virtual chemistry</i>. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not hav...
H 1 He 4 C 12 O 16 F 19 Ne 20 Cu 64 Cc 333 END_OF_FIRST_PART H2C (MgF)2As Cu(OH)2 H((CO)2F)99 0
14 UNKNOWN 98 7426
25,053
s506346887
p00823
u464321546
1572425436
Python
Python3
py
Accepted
30
6020
2,040
from collections import defaultdict d = defaultdict(int) def main(s, x=1): f = True l = 0 r = 0 index = float("INF") res = 0 i = 0 lis = [] if x: while i < len(s): if s[i].isupper(): tmp = s[i] i += 1 while i < len(s) a...
p00823
<H1><font color="#000">Problem E:</font> Molecular Formula</H1> <p> Your mission in this problem is to write a computer program that manipulates molecular for- mulae in <i>virtual chemistry</i>. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not hav...
H 1 He 4 C 12 O 16 F 19 Ne 20 Cu 64 Cc 333 END_OF_FIRST_PART H2C (MgF)2As Cu(OH)2 H((CO)2F)99 0
14 UNKNOWN 98 7426
25,054
s476403573
p00823
u966401365
1554229878
Python
Python3
py
Accepted
50
7204
1,722
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1244 from typing import List, Dict atomic_table: Dict[str, int] = {} class NoAppearAtomicSymbol(Exception): pass class Token: s: str index = 0 def __init__(self, s: str): self.s = s @property def c(self) -> str: as...
p00823
<H1><font color="#000">Problem E:</font> Molecular Formula</H1> <p> Your mission in this problem is to write a computer program that manipulates molecular for- mulae in <i>virtual chemistry</i>. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not hav...
H 1 He 4 C 12 O 16 F 19 Ne 20 Cu 64 Cc 333 END_OF_FIRST_PART H2C (MgF)2As Cu(OH)2 H((CO)2F)99 0
14 UNKNOWN 98 7426
25,055
s939141740
p00823
u281836941
1523976671
Python
Python3
py
Accepted
30
5620
1,666
# coding: utf-8 def mole(): global p global s num=term() while len(s)>p: if s[p]=='+': p+=1 num+=term() else: break return num def term(): global p global s num=factor() while len(s)>p: if s[p]=='*': p+=1 ...
p00823
<H1><font color="#000">Problem E:</font> Molecular Formula</H1> <p> Your mission in this problem is to write a computer program that manipulates molecular for- mulae in <i>virtual chemistry</i>. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not hav...
H 1 He 4 C 12 O 16 F 19 Ne 20 Cu 64 Cc 333 END_OF_FIRST_PART H2C (MgF)2As Cu(OH)2 H((CO)2F)99 0
14 UNKNOWN 98 7426
25,056
s781086492
p00829
u633068244
1424446729
Python
Python
py
Accepted
20
4224
309
n = int(raw_input()) for loop in xrange(n): a = [] while len(a) < 9: a += map(lambda i:int(i,16),raw_input().split()) key = 0 for i in xrange(32): s = sum(a[j]^key for j in xrange(8)) if s&(1 << (i+1)-1) != (a[-1]^key)&(1 << (i+1)-1): key |= (1 << i) print "%x"%key
p00829
<H1><font color="#000">Problem C:</font> Leaky Cryptography</H1> <p> The ACM ICPC judges are very careful about not leaking their problems, and all communications are encrypted. However, one does sometimes make mistakes, like using too weak an encryption scheme. Here is an example of that. </p> <p> The encryption cho...
8 1 1 1 1 1 1 1 1 8 3 2 3 2 3 2 3 2 6 3 4 4 7 7 b a 2 2e e1 13 ce 28 ca 6 ab 46 a6d b08 49e2 6128 f27 8cf2 bc50 7380 7fe1 723b 4eba eb4 a352 fd14 6ac1 eed1 dd06 bb83 392bc ef593c08 847e522f 74c02b9c 26f3a4e1 e2720a01 6fe66007 7a4e96ad 6ee5cef6 3853cd88 60202fb8 757d6d66 9c3a9525 fbcd7983 82b9571c ddc54bab 853e52da 2204...
0 2 6 1c6 4924afc7 ffff95c5 546991d 901c4a16
25,057
s706554198
p00829
u633068244
1424446914
Python
Python
py
Accepted
20
4224
298
n = int(raw_input()) for loop in xrange(n): a = [] while len(a) < 9: a += map(lambda i:int(i,16),raw_input().split()) key = 0 for i in xrange(32): s = sum(a[j]^key for j in xrange(8)) if (s^a[-1]^key) & (1 << (i+1)-1) != 0: key |= (1 << i) print "%x"%key
p00829
<H1><font color="#000">Problem C:</font> Leaky Cryptography</H1> <p> The ACM ICPC judges are very careful about not leaking their problems, and all communications are encrypted. However, one does sometimes make mistakes, like using too weak an encryption scheme. Here is an example of that. </p> <p> The encryption cho...
8 1 1 1 1 1 1 1 1 8 3 2 3 2 3 2 3 2 6 3 4 4 7 7 b a 2 2e e1 13 ce 28 ca 6 ab 46 a6d b08 49e2 6128 f27 8cf2 bc50 7380 7fe1 723b 4eba eb4 a352 fd14 6ac1 eed1 dd06 bb83 392bc ef593c08 847e522f 74c02b9c 26f3a4e1 e2720a01 6fe66007 7a4e96ad 6ee5cef6 3853cd88 60202fb8 757d6d66 9c3a9525 fbcd7983 82b9571c ddc54bab 853e52da 2204...
0 2 6 1c6 4924afc7 ffff95c5 546991d 901c4a16
25,058
s829617336
p00829
u509278866
1528942828
Python
Python3
py
Accepted
70
9048
1,221
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 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdi...
p00829
<H1><font color="#000">Problem C:</font> Leaky Cryptography</H1> <p> The ACM ICPC judges are very careful about not leaking their problems, and all communications are encrypted. However, one does sometimes make mistakes, like using too weak an encryption scheme. Here is an example of that. </p> <p> The encryption cho...
8 1 1 1 1 1 1 1 1 8 3 2 3 2 3 2 3 2 6 3 4 4 7 7 b a 2 2e e1 13 ce 28 ca 6 ab 46 a6d b08 49e2 6128 f27 8cf2 bc50 7380 7fe1 723b 4eba eb4 a352 fd14 6ac1 eed1 dd06 bb83 392bc ef593c08 847e522f 74c02b9c 26f3a4e1 e2720a01 6fe66007 7a4e96ad 6ee5cef6 3853cd88 60202fb8 757d6d66 9c3a9525 fbcd7983 82b9571c ddc54bab 853e52da 2204...
0 2 6 1c6 4924afc7 ffff95c5 546991d 901c4a16
25,059
s497938525
p00830
u633068244
1424610621
Python
Python
py
Accepted
10
4256
858
def check(a): path = [] for direct in a[1:].split("/"): if direct == ".": continue elif direct == "" : direct = "/" elif direct == "..": if len(path) == 0 or max(url.find("/"+"/".join(path)+"/") for url in urls) == -1: return False path.pop() continu...
p00830
<H1><font color="#000">Problem D:</font> Pathological Paths</H1> <p> Professor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For establishing his hypotheses, he has been developing software agents, which automatically traverse hyperlinks and analyze the structure of the...
5 6 /home/ACM/index.html /ICPC/index.html /ICPC/general.html /ICPC/japanese/index.html /ICPC/secret/confidential/2005/index.html /home/ACM/ /home/ICPC/../ACM/ /ICPC/secret/ /ICPC/secret/index.html /ICPC /ICPC/../ICPC/index.html /ICPC /ICPC/general.html /ICPC/japanese/.././ /ICPC/japanese/./../ /home/ACM/index.html /hom...
not found not found yes no yes not found not found yes not found not found
25,060
s284080713
p00830
u633068244
1424610814
Python
Python
py
Accepted
20
4256
797
def check(a): path = [] for d in a[1:].split("/"): if d == ".": continue elif d == "" : d = "/" elif d == "..": if len(path) == 0 or max(url.find("/"+"/".join(path)+"/") for url in urls) == -1: return False path.pop() continue path.append(d) ...
p00830
<H1><font color="#000">Problem D:</font> Pathological Paths</H1> <p> Professor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For establishing his hypotheses, he has been developing software agents, which automatically traverse hyperlinks and analyze the structure of the...
5 6 /home/ACM/index.html /ICPC/index.html /ICPC/general.html /ICPC/japanese/index.html /ICPC/secret/confidential/2005/index.html /home/ACM/ /home/ICPC/../ACM/ /ICPC/secret/ /ICPC/secret/index.html /ICPC /ICPC/../ICPC/index.html /ICPC /ICPC/general.html /ICPC/japanese/.././ /ICPC/japanese/./../ /home/ACM/index.html /hom...
not found not found yes no yes not found not found yes not found not found
25,061
s867500369
p00830
u633068244
1424610822
Python
Python
py
Accepted
20
4256
797
def check(a): path = [] for d in a[1:].split("/"): if d == ".": continue elif d == "" : d = "/" elif d == "..": if len(path) == 0 or max(url.find("/"+"/".join(path)+"/") for url in urls) == -1: return False path.pop() continue path.append(d) ...
p00830
<H1><font color="#000">Problem D:</font> Pathological Paths</H1> <p> Professor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For establishing his hypotheses, he has been developing software agents, which automatically traverse hyperlinks and analyze the structure of the...
5 6 /home/ACM/index.html /ICPC/index.html /ICPC/general.html /ICPC/japanese/index.html /ICPC/secret/confidential/2005/index.html /home/ACM/ /home/ICPC/../ACM/ /ICPC/secret/ /ICPC/secret/index.html /ICPC /ICPC/../ICPC/index.html /ICPC /ICPC/general.html /ICPC/japanese/.././ /ICPC/japanese/./../ /home/ACM/index.html /hom...
not found not found yes no yes not found not found yes not found not found
25,062
s573863774
p00830
u633068244
1424610834
Python
Python
py
Accepted
10
4256
797
def check(a): path = [] for d in a[1:].split("/"): if d == ".": continue elif d == "" : d = "/" elif d == "..": if len(path) == 0 or max(url.find("/"+"/".join(path)+"/") for url in urls) == -1: return False path.pop() continue path.append(d) ...
p00830
<H1><font color="#000">Problem D:</font> Pathological Paths</H1> <p> Professor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For establishing his hypotheses, he has been developing software agents, which automatically traverse hyperlinks and analyze the structure of the...
5 6 /home/ACM/index.html /ICPC/index.html /ICPC/general.html /ICPC/japanese/index.html /ICPC/secret/confidential/2005/index.html /home/ACM/ /home/ICPC/../ACM/ /ICPC/secret/ /ICPC/secret/index.html /ICPC /ICPC/../ICPC/index.html /ICPC /ICPC/general.html /ICPC/japanese/.././ /ICPC/japanese/./../ /home/ACM/index.html /hom...
not found not found yes no yes not found not found yes not found not found
25,063
s247820804
p00830
u491071312
1429645142
Python
Python
py
Accepted
20
4356
1,837
N, M = map(int, raw_input().split() ) TimeStamp = 0 Stamp = "&Stamp&" while N+M: not_found = {} Root = {} Root[Stamp] = TimeStamp TimeStamp+=1 not_found[Stamp] = TimeStamp TimeStamp+=1 Root["."] = Root Root[".."] = not_found for i in range(N): url = raw_input() conte...
p00830
<H1><font color="#000">Problem D:</font> Pathological Paths</H1> <p> Professor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For establishing his hypotheses, he has been developing software agents, which automatically traverse hyperlinks and analyze the structure of the...
5 6 /home/ACM/index.html /ICPC/index.html /ICPC/general.html /ICPC/japanese/index.html /ICPC/secret/confidential/2005/index.html /home/ACM/ /home/ICPC/../ACM/ /ICPC/secret/ /ICPC/secret/index.html /ICPC /ICPC/../ICPC/index.html /ICPC /ICPC/general.html /ICPC/japanese/.././ /ICPC/japanese/./../ /home/ACM/index.html /hom...
not found not found yes no yes not found not found yes not found not found
25,064
s599017133
p00830
u823642749
1597418280
Python
Python3
py
Accepted
30
5616
1,495
# from urllib.parse import urljoin def testcase_ends(): n, m = map(int, input().split()) if (n, m) == (0, 0): return 1 htmls = set(input() for i in range(n)) files = set('/') for html in htmls: sp = html.split('/') for i in range(2, len(sp)): files.add('/'.join(...
p00830
<H1><font color="#000">Problem D:</font> Pathological Paths</H1> <p> Professor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For establishing his hypotheses, he has been developing software agents, which automatically traverse hyperlinks and analyze the structure of the...
5 6 /home/ACM/index.html /ICPC/index.html /ICPC/general.html /ICPC/japanese/index.html /ICPC/secret/confidential/2005/index.html /home/ACM/ /home/ICPC/../ACM/ /ICPC/secret/ /ICPC/secret/index.html /ICPC /ICPC/../ICPC/index.html /ICPC /ICPC/general.html /ICPC/japanese/.././ /ICPC/japanese/./../ /home/ACM/index.html /hom...
not found not found yes no yes not found not found yes not found not found
25,065
s948983767
p00830
u144532944
1543673067
Python
Python3
py
Accepted
20
5620
1,495
# from urllib.parse import urljoin def testcase_ends(): n, m = map(int, input().split()) if (n, m) == (0, 0): return 1 htmls = set(input() for i in range(n)) files = set('/') for html in htmls: sp = html.split('/') for i in range(2, len(sp)): files.add('/'.join(...
p00830
<H1><font color="#000">Problem D:</font> Pathological Paths</H1> <p> Professor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For establishing his hypotheses, he has been developing software agents, which automatically traverse hyperlinks and analyze the structure of the...
5 6 /home/ACM/index.html /ICPC/index.html /ICPC/general.html /ICPC/japanese/index.html /ICPC/secret/confidential/2005/index.html /home/ACM/ /home/ICPC/../ACM/ /ICPC/secret/ /ICPC/secret/index.html /ICPC /ICPC/../ICPC/index.html /ICPC /ICPC/general.html /ICPC/japanese/.././ /ICPC/japanese/./../ /home/ACM/index.html /hom...
not found not found yes no yes not found not found yes not found not found
25,066
s485951685
p00836
u921537862
1591608032
Python
Python3
py
Accepted
90
5696
841
import sys sys.setrecursionlimit(10000000) MOD = 10 ** 9 + 7 INF = 10 ** 15 def sieve(n): if n == 1:return [] primes = [1 if i%2 == 1 else 0 for i in range(n + 1)] primes[1] = 0 primes[2] = 1 for i in range(3,n + 1,2): if i * i > n: break if primes[i]: for j ...
p00836
<H1><font color="#000">Problem A:</font> Sum of Consecutive Prime Numbers</H1> <p> Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integer have? For example, the integer 53 has two representations 5 + 7 + 11 + 13 + 17 and...
2 3 17 41 20 666 12 53 0
1 1 2 3 0 0 1 2
25,067
s420571573
p00836
u072053884
1542852624
Python
Python3
py
Accepted
70
5832
881
def solve(): # making a list of prime numbers primes = [2, 3] for n in range(5, 10000, 2): l = n ** 0.5 for p in primes: if n % p == 0: break if l < p: primes.append(n) break primes = [0] + primes from ...
p00836
<H1><font color="#000">Problem A:</font> Sum of Consecutive Prime Numbers</H1> <p> Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integer have? For example, the integer 53 has two representations 5 + 7 + 11 + 13 + 17 and...
2 3 17 41 20 666 12 53 0
1 1 2 3 0 0 1 2
25,068
s056743384
p00842
u072053884
1596854314
Python
Python3
py
Accepted
70
6140
2,429
def solve(): from sys import stdin f_i = stdin # function to update distance between switch and computer def dfs(sw_id, prev, dist): switch[sw_id].append(dist) for next_sw in adj[sw_id]: if next_sw != prev: dfs(next_sw, sw_id, dist + 1) while Tru...
p00842
<H1><font color="#000">Problem G:</font> Network Mess</H1> <p> Gilbert is the network admin of Ginkgo company. His boss is mad about the messy network cables on the floor. He finally walked up to Gilbert and asked the lazy network admin to illustrate how computers and switches are connected. Since he is a programmer,...
4 0 2 2 2 2 0 2 2 2 2 0 2 2 2 2 0 4 0 2 4 4 2 0 4 4 4 4 0 2 4 4 2 0 2 0 12 12 0 0
4 2 3 3 2 2 2 2 2 2 2 2 2 2 2
25,069
s762055260
p00854
u300645821
1413361211
Python
Python
py
Accepted
100
4496
125
while True: n,k,m=[int(e) for e in raw_input().split()] if n==0:break r=0 for i in range(1,n):r=(r+k)%i print((r+m)%n+1)
p00854
<H1><font color="#000">Problem A:</font> And Then There Was One</H1> <p> Let’s play a stone removing game. </p> <p> Initially, <i>n</i> stones are arranged on a circle and numbered 1, ... , <i>n</i> clockwise (Figure 1). You are also given two numbers <i>k</i> and <i>m</i>. From this state, remove stones one by one ...
8 5 3 100 9999 98 10000 10000 10000 0 0 0
1 93 2019
25,070
s994631965
p00861
u858560358
1524480701
Python
Python3
py
Accepted
100
6724
1,036
import re def deref(d, expr): expr = expr.replace(']', '') symb = expr.split('[') symb[-1] = symb[-1] while len(symb) > 1: name, index = symb[-2:] if index not in d[name]: return None symb.pop() symb.pop() symb.append(d[name][index]) return symb[0] def check(s): d = {} dd = ...
p00861
<H1><font color="#000">Problem H:</font> Bug Hunt</H1> <p> In this problem, we consider a simple programming language that has only declarations of one- dimensional integer arrays and assignment statements. The problem is to find a bug in the given program. </p> <p> The syntax of this language is given in BNF as foll...
a[3] a[0]=a[1] . x[1] x[0]=x[0] . a[0] a[0]=1 . b[2] b[0]=2 b[1]=b[b[0]] b[0]=b[1] . g[2] G[10] g[0]=0 g[1]=G[0] . a[2147483647] a[0]=1 B[2] B[a[0]]=2 a[B[a[0]]]=3 a[2147483646]=a[2] . .
2 2 2 3 4 0
25,071
s038668362
p00865
u731235119
1423296721
Python
Python
py
Accepted
80
4752
401
while 1: n,m,k = map(int,raw_input().split(" ")) if n == m == k == 0: break dice = [[0 for _ in range(m * n)] for _ in range(n)] for i in range(m): dice[0][i] = 1 for i in range(n-1): for j in range(m * n): if dice[i][j] == 0: continue for l in range(1,m+1): dice[i+1][j+l] += dice[i][j] print sum([(...
p00865
<H1><font color="#000">Problem B:</font> Expected Allowance</H1> <p> Hideyuki is allowed by his father Ujisato some 1000 yen bills every month for his pocket money. In the first day of every month, the number of bills is decided as follows. Ujisato prepares <i>n</i> pieces of <i>m</i>-sided dice and declares the cutb...
2 6 0 2 6 3 3 10 9 13 3 27 1 2008 3 0 0 0
7.00000000 4.11111111 7.71000000 1.42902599 1001.50298805
25,091
s189524957
p00865
u633068244
1424360405
Python
Python
py
Accepted
40
4496
382
while 1: n,m,k = map(int,raw_input().split()) if n == 0: break dp = [[0]*(m*n+1) for i in xrange(n)] dp[0][1:m+1] = [1]*m for i in xrange(1,n): for j in xrange(1,m*n+1): dp[i][j] = sum(dp[i-1][max(j-m,0):j]) s = sum(dp[n-1]) ans = 0 for i in xrange(1,m*n+1): ...
p00865
<H1><font color="#000">Problem B:</font> Expected Allowance</H1> <p> Hideyuki is allowed by his father Ujisato some 1000 yen bills every month for his pocket money. In the first day of every month, the number of bills is decided as follows. Ujisato prepares <i>n</i> pieces of <i>m</i>-sided dice and declares the cutb...
2 6 0 2 6 3 3 10 9 13 3 27 1 2008 3 0 0 0
7.00000000 4.11111111 7.71000000 1.42902599 1001.50298805
25,092
s100668384
p00874
u591052358
1540371048
Python
Python3
py
Accepted
20
5600
613
while True: w,d = [int(i) for i in input().split()] if w == 0: break h = [int(i) for i in input().split()] h_ = [int(i) for i in input().split()] h = sorted(h) h_ = sorted(h_) hdic = {} h_dic = {} for i in h: if i in hdic.keys(): hdic[i]+= 1 else:...
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,093
s108108335
p00874
u731235119
1423291946
Python
Python
py
Accepted
20
4204
265
while 1 : w, d = map(int,raw_input().split(" ")) if w == d == 0: break front = map(int,raw_input().split(" ")) side = map(int,raw_input().split(" ")) number = sum(front) for h in side: if h in front: front.remove(h) else : number += h print number
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,094
s119274000
p00874
u633068244
1423852851
Python
Python
py
Accepted
10
4200
251
while 1: w,d = map(int,raw_input().split()) if w == 0: break front = map(int,raw_input().split()) side = map(int,raw_input().split()) for i in front: if i in side: side.remove(i) ans = sum(front)+sum(side) print ans
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,095
s079066129
p00874
u633068244
1423852998
Python
Python
py
Accepted
20
4200
212
while 1: w,d = map(int,raw_input().split()) if w == 0: break f = map(int,raw_input().split()) s = map(int,raw_input().split()) for i in f: if i in s:s.remove(i) print sum(f)+sum(s)
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,096
s789493692
p00874
u078042885
1483591957
Python
Python3
py
Accepted
30
7644
308
while 1: w,d=map(int,input().split()) if w==d==0:break a=[0]*21 ans=0 b=list(map(int,input().split())) for i in range(w): a[b[i]]+=1 ans=sum(b) b=list(map(int,input().split())) for i in range(d): if a[b[i]]:a[b[i]]-=1 else: ans+=b[i] print(ans)
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,097
s190044155
p00874
u408260374
1493933979
Python
Python3
py
Accepted
30
7956
418
from collections import Counter while True: W, D = map(int, input().split()) if not (W | D): break hw = [int(x) for x in input().split()] hd = [int(x) for x in input().split()] cnt_hw = Counter(hw) cnt_hd = Counter(hd) print(min(sum(hw) + sum(max(0, v - cnt_hw[k]) * k for k, v in cn...
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,098
s866239742
p00874
u408260374
1493934154
Python
Python3
py
Accepted
40
7936
290
from collections import Counter while True: W, D = map(int, input().split()) if not (W | D): break hw = [int(x) for x in input().split()] hd = [int(x) for x in input().split()] print(sum(hw) + sum(hd) - sum(k * v for k, v in (Counter(hw) & Counter(hd)).items()))
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,099
s570055819
p00874
u408260374
1493934179
Python
Python3
py
Accepted
40
7880
290
from collections import Counter while True: W, D = map(int, input().split()) if not (W | D): break hw = [int(x) for x in input().split()] hd = [int(x) for x in input().split()] print(sum(hw) + sum(hd) - sum(k * v for k, v in (Counter(hw) & Counter(hd)).items()))
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,100
s803161223
p00874
u408260374
1493934227
Python
Python
py
Accepted
20
6624
364
from collections import Counter import sys if sys.version[0] == '2': range, input = xrange, raw_input while True: W, D = map(int, input().split()) if not (W | D): break hw = [int(x) for x in input().split()] hd = [int(x) for x in input().split()] print(sum(hw) + sum(hd) - sum(k * v for k...
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,101
s918581269
p00874
u214600613
1498472886
Python
Python
py
Accepted
20
6244
189
while True: n,m=map(int,raw_input().split()) if n==0:break a=raw_input().split() b=raw_input().split() out=0 for i in range(21):out+=i*max(a.count(str(i)),b.count(str(i))) print(out)
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,102
s536277747
p00874
u509278866
1527761244
Python
Python3
py
Accepted
70
9028
1,287
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**3 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():...
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,103
s987305842
p00874
u048191691
1575541061
Python
Python3
py
Accepted
30
5596
373
while True: w,d = map(int,input().split()) if w == 0 and d == 0: break h = list(map(int,input().split())) m = list(map(int,input().split())) hl = [0] * 30 ml = [0] * 30 for i in h: hl[i] += 1 for i in m: ml[i] += 1 ans = 0 for i in range(30): ...
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,104
s152608889
p00874
u072053884
1573450500
Python
Python3
py
Accepted
30
6004
496
def solve(): from sys import stdin from collections import Counter f_i = stdin while True: w, d = map(int, f_i.readline().split()) if w == 0: break h_w = Counter(map(int, f_i.readline().split())) h_d = Counter(map(int, f_i.readline().split())) ...
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,105
s667504669
p00874
u273756488
1563517663
Python
Python3
py
Accepted
30
6000
526
from collections import defaultdict while True: a, b = [int(i) for i in input().split()] if a == 0 and b == 0: exit() H = [int(i) for i in input().split()] W = [int(i) for i in input().split()] h_cnt = defaultdict(int) w_cnt = defaultdict(int) for h in H: h_cnt[h] += 1 ...
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,106
s575911614
p00874
u886122084
1561508880
Python
Python3
py
Accepted
30
5996
553
from collections import defaultdict # python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline def solve(): H, W = map(int, input().split()) if H == 0 and W == 0: exit() A = list(map(int, input().split())) B = list(map(int, input().split())) d_a = d...
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,107
s865686900
p00874
u281836941
1513663329
Python
Python3
py
Accepted
30
5600
356
while 1: w,d=map(int,input().split()) if w==0: break W=list(map(int,input().split())) D=list(map(int,input().split())) ans=0 table=[0 for i in range(21)] for n in W: ans+=n table[n]+=1 for n in D: if table[n]>0: table[n]-=1 else: ...
p00874
<H1><font color="#000">Problem A:</font> Cubist Artwork</H1> <p> <i>International Center for Picassonian Cubism</i> is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwor...
5 5 1 2 3 4 5 1 2 3 4 5 5 5 2 5 4 1 3 4 1 5 3 2 5 5 1 2 3 4 5 3 3 3 4 5 3 3 7 7 7 7 7 7 3 3 4 4 4 4 3 4 4 3 4 2 2 4 4 2 1 4 4 2 8 8 8 2 3 8 3 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 20 1 20 20 20 20 20 18 20 20 20 20 20 20 7 20 20 20 20 0 0
15 15 21 21 15 13 32 90 186
25,108
s173716070
p00875
u633068244
1424611322
Python
Python
py
Accepted
50
4472
475
while 1: n = int(raw_input()) if n == 0: break ab = [raw_input().split() for i in xrange(n)] s = raw_input() g = raw_input() memo = set([s]) que = [[s,0]] while que: c,i = que.pop(0) if c == g: print i break for a,b in ab: cc = ...
p00875
<H1><font color="#000">Problem B:</font> Repeated Substitution with Sed</H1> <p> Do you know "sed," a tool provided with Unix? Its most popular use is to substitute every occurrence of a string <i.&alpha;</i> contained in the input string (actually each input line) with another string <i>&beta;</i>. More precisely, i...
2 a bb b aa a bbbbbbbb 1 a aa a aaaaa 3 ab aab abc aadc ad dee abc deeeeeeeec 10 a abc b bai c acf d bed e abh f fag g abe h bag i aaj j bbb a abacfaabe 0
3 -1 7 4
25,109
s509092495
p00875
u260980560
1482840593
Python
Python
py
Accepted
80
6456
515
INF = 10**9 def dfs(s, d, P): if len(s) > len(d): return INF if s == d: return 0 if s in memo: return memo[s] res = INF for a, b in P: r = s.replace(a, b) if r != s: res = min(res, dfs(r, d, P)+1) memo[s] = res return res while 1: n = ...
p00875
<H1><font color="#000">Problem B:</font> Repeated Substitution with Sed</H1> <p> Do you know "sed," a tool provided with Unix? Its most popular use is to substitute every occurrence of a string <i.&alpha;</i> contained in the input string (actually each input line) with another string <i>&beta;</i>. More precisely, i...
2 a bb b aa a bbbbbbbb 1 a aa a aaaaa 3 ab aab abc aadc ad dee abc deeeeeeeec 10 a abc b bai c acf d bed e abh f fag g abe h bag i aaj j bbb a abacfaabe 0
3 -1 7 4
25,110
s249603316
p00875
u509278866
1529904776
Python
Python3
py
Accepted
80
9200
1,428
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 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdin....
p00875
<H1><font color="#000">Problem B:</font> Repeated Substitution with Sed</H1> <p> Do you know "sed," a tool provided with Unix? Its most popular use is to substitute every occurrence of a string <i.&alpha;</i> contained in the input string (actually each input line) with another string <i>&beta;</i>. More precisely, i...
2 a bb b aa a bbbbbbbb 1 a aa a aaaaa 3 ab aab abc aadc ad dee abc deeeeeeeec 10 a abc b bai c acf d bed e abh f fag g abe h bag i aaj j bbb a abacfaabe 0
3 -1 7 4
25,111
s702870859
p00875
u144532944
1543615319
Python
Python3
py
Accepted
80
6032
742
from collections import deque def testcase_ends(): n = int(input()) if n == 0: return 1 sub = [input().split() for i in range(n)] gamma = input() delta = input() q = deque() q.append((gamma, 0)) res = 10000 while q: s, i = q.popleft() for alpha, beta in sub...
p00875
<H1><font color="#000">Problem B:</font> Repeated Substitution with Sed</H1> <p> Do you know "sed," a tool provided with Unix? Its most popular use is to substitute every occurrence of a string <i.&alpha;</i> contained in the input string (actually each input line) with another string <i>&beta;</i>. More precisely, i...
2 a bb b aa a bbbbbbbb 1 a aa a aaaaa 3 ab aab abc aadc ad dee abc deeeeeeeec 10 a abc b bai c acf d bed e abh f fag g abe h bag i aaj j bbb a abacfaabe 0
3 -1 7 4
25,112
s956779542
p00880
u072053884
1554778647
Python
Python3
py
Accepted
80
5820
881
def solve(): from sys import stdin file_input = stdin while True: x1, y1, x2, y2, x3, y3 = map(int, file_input.readline().split()) if x1 == y1 == x2 == y2 == 0: break A = x1 + y1 * 1j B = x2 + y2 * 1j C = x3 + y3 * 1j a = abs...
p00880
<H1><font color="#000">Problem G:</font> Malfatti Circles</H1> <p> The configuration of three circles packed inside a triangle such that each circle is tangent to the other two circles and to two of the edges of the triangle has been studied by many mathematicians for more than two centuries. Existence and uniqueness...
20 80 -40 -20 120 -20 20 -20 120 -20 -40 80 0 0 1 0 0 1 0 0 999 1 -999 1 897 -916 847 -972 890 -925 999 999 -999 -998 -998 -999 -999 -999 999 -999 0 731 -999 -999 999 -464 -464 999 979 -436 -955 -337 157 -439 0 0 0 0 0 0
21.565935 24.409005 27.107493 9.942044 19.150565 19.913790 0.148847 0.207107 0.207107 0.125125 0.499750 0.499750 0.373458 0.383897 0.100456 0.706768 0.353509 0.353509 365.638023 365.638023 365.601038 378.524085 378.605339 378.605339 21.895803 22.052921 5.895714
25,113
s308609245
p00884
u011621222
1422514281
Python
Python3
py
Accepted
40
6904
746
def get_num(u, map, vis): if u in vis: return 0; else: vis[u] = True; ans = 0; if u in map: for v in map[u]: ans += get_num(v, map, vis); else: ans += 1; return ans; def main(): while True: n = int(input()); if n == 0: ...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,114
s654739039
p00884
u260980560
1432476679
Python
Python
py
Accepted
50
4384
706
def dfs(dg, gs, ms, used, v): if used[v]: return dg[gs[v]] used[v] = 1 me = ms[v] for i in xrange(len(me)): if me[i] in dg: ret = dfs(dg, gs, ms, used, gs.index(me[i])) for e in ret: if e not in dg[gs[v]]: dg[gs[v]].append(e) ...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,115
s495435617
p00884
u063091489
1432706026
Python
Python3
py
Accepted
100
6780
555
while True: N = int(input()) if N == 0: break first_group_menbers = set(input()[:-1].split(":")[1].split(",")) d = {} for i in range(N-1): group, members = input()[:-1].split(":") d[group] = set(members.split(",")) for i in range(N-1): for group, mem...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,116
s636489355
p00884
u063091489
1432706037
Python
Python3
py
Accepted
100
6776
555
while True: N = int(input()) if N == 0: break first_group_menbers = set(input()[:-1].split(":")[1].split(",")) d = {} for i in range(N-1): group, members = input()[:-1].split(":") d[group] = set(members.split(",")) for i in range(N-2): for group, mem...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,117
s451877142
p00884
u509278866
1529646581
Python
Python3
py
Accepted
70
9516
1,335
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 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdi...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,118
s857327380
p00884
u633068244
1399618027
Python
Python
py
Accepted
90
4416
442
while 1: n = input() if n == 0: break ans = {} for i in range(n): group,name = raw_input().split(":") if i == 0: first = group ans[group] = set(name[:-1].split(",")) while 1: for key in ans: flag = 0 if key == first: continue for key1 in ans: if key in ans[key1]: ans[key1] |= ans[key] ...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,119
s359519565
p00884
u823642749
1597418934
Python
Python3
py
Accepted
40
5716
748
def get_num(u, map, vis): if u in vis: return 0; else: vis[u] = True; ans = 0; if u in map: for v in map[u]: ans += get_num(v, map, vis); else: ans += 1; return ans; def main(): while True: n = int(input()); if n == 0: ...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,120
s693679701
p00884
u781622789
1586688847
Python
Python3
py
Accepted
80
5712
419
while True: n = int(input()) if n == 0: break group = dict() ls = set() for i in range(n): g,s = input().split(':') group[g] = set(s[:-1].split(',')) if i == 0: ls.add(g) ans = set() while len(ls) > 0: s = ls.pop() if s in group.key...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,121
s142768132
p00884
u052554890
1576564539
Python
Python3
py
Accepted
60
5720
487
while True: n = int(input()) if(n==0): break data = {} firstname = '' for i in range(n): d = input() name = d.split(':')[0] if(i==0): firstname = name data[name] = [] for x in d.split(':')[1].strip('.').split(','): data[name].append(x) removed = [] for x in data[firstname]: if x in data: remove...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,122
s732192628
p00884
u989573662
1575900140
Python
Python3
py
Accepted
70
7036
1,232
#!/usr/bin/env python3 import sys import math import re from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from col...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,123
s728275108
p00884
u464321546
1575891003
Python
Python3
py
Accepted
50
8964
1,579
#!/usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys, random, itertools, math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(): return...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,124
s339333634
p00884
u591052358
1539579449
Python
Python3
py
Accepted
90
5712
517
def check(dic,index): ret = [] for c in dic[index]: if c in dic.keys(): for d in check(dic,c): if not(d in ret): ret.append(d) else: if not(c in ret): ret.append(c) dic[index] = ret return ret while True: n = int(input()) if n == 0: break dic = {} inde...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,125
s673127686
p00884
u281836941
1525175538
Python
Python3
py
Accepted
50
5848
640
# coding: utf-8 def addset(args): global a for m in args: if dic[m]==1: a.add(m) else: if m not in used: used.add(m) addset(dc[m]) while True: n=int(input()) if n==0: break dic={} first=[] dc={} for i in ra...
p00884
<H1><font color="#000">Problem A:</font> Membership Management</H1> <p> Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is hi...
2 development:alice,bob,design,eve. design:carol,alice. 3 one:another. another:yetanother. yetanother:dave. 3 friends:alice,bob,bestfriends,carol,fran,badcompany. bestfriends:eve,alice. badcompany:dave,carol. 5 a:b,c,d,e. b:c,d,e,f. c:d,e,f,g. d:e,f,g,h. e:f,g,h,i. 4 aa:bb. cc:dd,ee. ff:gg. bb:cc. 0
4 1 6 4 2
25,126
s032093803
p00885
u633068244
1424530069
Python
Python
py
Accepted
30
4304
728
inf = 1 << 28 while 1: n = int(raw_input()) if n == 0: break pt = [map(int,raw_input().split()) for i in xrange(n)] p = [0]+[ele[0] for ele in pt] t = [0]+[ele[1] for ele in pt] dp = [[inf]*4 for i in xrange(n+1)] dp[0][0] = 0 for i in xrange(1,n+1): for j in xrange(1,4): ...
p00885
<H1><font color="#000">Problem B:</font> Balloon Collecting</H1> <p> "Balloons should be captured efficiently", the game designer says. He is designing an oldfashioned game with two dimensional graphics. In the game, balloons fall onto the ground one after another, and the player manipulates a robot vehicle on the gr...
2 10 100 100 270 2 10 100 100 280 3 100 150 10 360 40 450 3 100 150 10 360 40 440 2 100 10 50 200 2 100 100 50 110 1 15 10 4 1 10 2 20 3 100 90 200 0
OK 220 OK 200 OK 260 OK 280 NG 1 NG 2 NG 1 OK 188
25,127
s648637554
p00885
u260980560
1432481414
Python
Python
py
Accepted
20
4296
934
INF = 10**9 while 1: n = input() if not n: break dp = [INF]*4 dp[0] = 0 pos = 0; time = 0 k = -1 ps = []; ts = [] for i in xrange(n): p, t = map(int, raw_input().split()) ps.append(p); ts.append(t) for i in xrange(n): p, t = ps[i], ts[i] d = ab...
p00885
<H1><font color="#000">Problem B:</font> Balloon Collecting</H1> <p> "Balloons should be captured efficiently", the game designer says. He is designing an oldfashioned game with two dimensional graphics. In the game, balloons fall onto the ground one after another, and the player manipulates a robot vehicle on the gr...
2 10 100 100 270 2 10 100 100 280 3 100 150 10 360 40 450 3 100 150 10 360 40 440 2 100 10 50 200 2 100 100 50 110 1 15 10 4 1 10 2 20 3 100 90 200 0
OK 220 OK 200 OK 260 OK 280 NG 1 NG 2 NG 1 OK 188
25,128
s588958635
p00885
u260980560
1432481865
Python
Python
py
Accepted
20
4296
902
INF = 10**9 while 1: n = input() if not n: break dp = [INF]*5 dp[0] = 0 pos = 0; time = 0 k = -1 ps = []; ts = [] for i in xrange(n): p, t = map(int, raw_input().split()) ps.append(p); ts.append(t) for i in xrange(n): p, t = ps[i], ts[i] d = ab...
p00885
<H1><font color="#000">Problem B:</font> Balloon Collecting</H1> <p> "Balloons should be captured efficiently", the game designer says. He is designing an oldfashioned game with two dimensional graphics. In the game, balloons fall onto the ground one after another, and the player manipulates a robot vehicle on the gr...
2 10 100 100 270 2 10 100 100 280 3 100 150 10 360 40 450 3 100 150 10 360 40 440 2 100 10 50 200 2 100 100 50 110 1 15 10 4 1 10 2 20 3 100 90 200 0
OK 220 OK 200 OK 260 OK 280 NG 1 NG 2 NG 1 OK 188
25,129
s156654524
p00885
u509278866
1529911625
Python
Python3
py
Accepted
60
9068
1,743
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 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdin....
p00885
<H1><font color="#000">Problem B:</font> Balloon Collecting</H1> <p> "Balloons should be captured efficiently", the game designer says. He is designing an oldfashioned game with two dimensional graphics. In the game, balloons fall onto the ground one after another, and the player manipulates a robot vehicle on the gr...
2 10 100 100 270 2 10 100 100 280 3 100 150 10 360 40 450 3 100 150 10 360 40 440 2 100 10 50 200 2 100 100 50 110 1 15 10 4 1 10 2 20 3 100 90 200 0
OK 220 OK 200 OK 260 OK 280 NG 1 NG 2 NG 1 OK 188
25,130
s061664922
p00885
u781622789
1586690249
Python
Python3
py
Accepted
40
5624
870
inf = 10**9 while True: n = int(input()) if n == 0: break b = [(0,0)] b.extend([tuple(map(int,input().split())) for i in range(n)]) dp = [[inf]*4 for i in range(n+1)] dp[0][0] = 0 for i in range(n): update = False for j in range(4): if dp[i][j] is inf: ...
p00885
<H1><font color="#000">Problem B:</font> Balloon Collecting</H1> <p> "Balloons should be captured efficiently", the game designer says. He is designing an oldfashioned game with two dimensional graphics. In the game, balloons fall onto the ground one after another, and the player manipulates a robot vehicle on the gr...
2 10 100 100 270 2 10 100 100 280 3 100 150 10 360 40 450 3 100 150 10 360 40 440 2 100 10 50 200 2 100 100 50 110 1 15 10 4 1 10 2 20 3 100 90 200 0
OK 220 OK 200 OK 260 OK 280 NG 1 NG 2 NG 1 OK 188
25,131
s228457690
p00885
u853158149
1572427741
Python
Python3
py
Accepted
50
8192
1,715
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()]...
p00885
<H1><font color="#000">Problem B:</font> Balloon Collecting</H1> <p> "Balloons should be captured efficiently", the game designer says. He is designing an oldfashioned game with two dimensional graphics. In the game, balloons fall onto the ground one after another, and the player manipulates a robot vehicle on the gr...
2 10 100 100 270 2 10 100 100 280 3 100 150 10 360 40 450 3 100 150 10 360 40 440 2 100 10 50 200 2 100 100 50 110 1 15 10 4 1 10 2 20 3 100 90 200 0
OK 220 OK 200 OK 260 OK 280 NG 1 NG 2 NG 1 OK 188
25,132
s439892260
p00894
u633068244
1424618728
Python
Python
py
Accepted
60
4296
567
while 1: n = int(raw_input()) if n == 0: break exist = set([]) time = [0]*1000 bless = [0]*1000 for loop in xrange(n): md,hm,io,p = raw_input().split() h,m = map(int,hm.split(":")) t = 60*h+m p = int(p) if io == "I": time[p] = t exi...
p00894
<H1><font color="#000">Problem A: </font> Gift from the Goddess of Programming </H1> <p> The goddess of programming is reviewing a thick logbook, which is a yearly record of visitors to her holy altar of programming. The logbook also records her visits at the altar. </p> <p> The altar attracts programmers from all ...
14 04/21 09:00 I 000 04/21 09:00 I 001 04/21 09:15 I 002 04/21 09:30 O 001 04/21 09:45 O 000 04/21 10:00 O 002 04/28 09:00 I 003 04/28 09:15 I 000 04/28 09:30 I 004 04/28 09:45 O 004 04/28 10:00 O 000 04/28 10:15 O 003 04/29 20:00 I 002 04/29 21:30 O 002 20 06/01 09:00 I 001 06/01 09:15 I 002 06/01 09:15 I 003 06/01 09...
45 120
25,133
s761074082
p00894
u633068244
1424619611
Python
Python
py
Accepted
50
4296
573
while 1: n = int(raw_input()) if n == 0: break exist = set([]) enter = [0]*1000 bless = [0]*1000 for loop in xrange(n): md,hm,io,p = raw_input().split() h,m = map(int,hm.split(":")) t = 60*h+m p = int(p) if io == "I": enter[p] = t e...
p00894
<H1><font color="#000">Problem A: </font> Gift from the Goddess of Programming </H1> <p> The goddess of programming is reviewing a thick logbook, which is a yearly record of visitors to her holy altar of programming. The logbook also records her visits at the altar. </p> <p> The altar attracts programmers from all ...
14 04/21 09:00 I 000 04/21 09:00 I 001 04/21 09:15 I 002 04/21 09:30 O 001 04/21 09:45 O 000 04/21 10:00 O 002 04/28 09:00 I 003 04/28 09:15 I 000 04/28 09:30 I 004 04/28 09:45 O 004 04/28 10:00 O 000 04/28 10:15 O 003 04/29 20:00 I 002 04/29 21:30 O 002 20 06/01 09:00 I 001 06/01 09:15 I 002 06/01 09:15 I 003 06/01 09...
45 120
25,134
s865173998
p00894
u260980560
1482843049
Python
Python
py
Accepted
70
6520
885
while 1: n = input() if n == 0: break status = {} god_st = -1 res = {} for i in xrange(n): s = raw_input().split() #M, D = map(int, s[0].split("/")) h, m = map(int, s[1].split(":")) mi = 60*h + m st = s[2] == 'I' ID = s[3] if ID ==...
p00894
<H1><font color="#000">Problem A: </font> Gift from the Goddess of Programming </H1> <p> The goddess of programming is reviewing a thick logbook, which is a yearly record of visitors to her holy altar of programming. The logbook also records her visits at the altar. </p> <p> The altar attracts programmers from all ...
14 04/21 09:00 I 000 04/21 09:00 I 001 04/21 09:15 I 002 04/21 09:30 O 001 04/21 09:45 O 000 04/21 10:00 O 002 04/28 09:00 I 003 04/28 09:15 I 000 04/28 09:30 I 004 04/28 09:45 O 004 04/28 10:00 O 000 04/28 10:15 O 003 04/29 20:00 I 002 04/29 21:30 O 002 20 06/01 09:00 I 001 06/01 09:15 I 002 06/01 09:15 I 003 06/01 09...
45 120
25,135