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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s238629279 | p04035 | u489959379 | 1596666904 | Python | Python (3.8.2) | py | Accepted | 80 | 19788 | 611 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, L = map(int, input().split())
A = list(map(int, input().split()))
init = -1
for i in range(1, n):
if A[i] + A[i - 1] >= L:
init = i
break
... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,217 |
s162109713 | p04035 | u729133443 | 1596613812 | Python | Python (3.8.2) | py | Accepted | 84 | 19864 | 152 | n,l,*a=map(int,open(i:=0).read().split())
for a,b in zip(a,a[1:]):i+=1;a+b>=l>exit(print('Possible',*range(1,i),*range(n-1,i-1,-1)))
print('Impossible') | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,218 |
s954786591 | p04035 | u169138653 | 1596550657 | Python | Python (3.8.2) | py | Accepted | 98 | 20080 | 322 | n,l=map(int,input().split())
a=list(map(int,input().split()))
ok=False
for i in range(n-1):
if a[i]+a[i+1]>=l:
ok=True
idx=i
if ok:
print("Possible")
for i in range(1,idx+1):
print(i)
for i in reversed(range(idx+2,n)):
print(i)
print(idx+1)
else:
print("Impossible... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,219 |
s506251653 | p04035 | u923270446 | 1596236342 | Python | Python (3.8.2) | py | Accepted | 93 | 20000 | 330 | n, l = map(int, input().split())
a = list(map(int, input().split()))
ans = float("inf")
for i in range(n - 1):
if a[i] + a[i + 1] >= l:
ans = i + 1
if ans == float("inf"):
print("Impossible")
else:
print("Possible")
print(*range(1, ans), sep="\n")
print(*range(n - 1, ans, -1), sep="\n")
... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,220 |
s954461356 | p04035 | u995062424 | 1595626018 | Python | Python (3.8.2) | py | Accepted | 88 | 20100 | 310 | import sys
N, L = map(int, input().split())
a = list(map(int, input().split()))
for i in range(N-1):
if(a[i]+a[i+1] >= L):
idx = i
break
else:
print("Impossible")
sys.exit()
print("Possible")
for i in range(1, i+1):
print(i)
for i in range(N-1, i, -1):
print(i) | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,221 |
s566401464 | p04035 | u445624660 | 1595539563 | Python | Python (3.8.2) | py | Accepted | 97 | 19996 | 561 | # 隣り合う和がL未満ならそもそもimpossible
# ならば隣り合う和がL以上ならば? -> そこから連続して隣り合うやつをどうやって足しても常にL以上
n, l = map(int, input().split())
a = list(map(int, input().split()))
idx = 0
for i in range(1, n):
if a[i - 1] + a[i] >= l:
idx = i
break
if idx == 0:
print("Impossible")
exit()
print("Possible")
ans = [idx]
f... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,222 |
s601609946 | p04035 | u788717734 | 1595527747 | Python | Python (3.8.2) | py | Accepted | 90 | 19968 | 300 | N, L = map(int, input().split())
a = list(map(int, input().split()))
idx = -1
for i in range(N - 1):
if a[i] + a[i + 1] >= L:
idx = i
break
if idx == -1:
print("Impossible")
else:
print("Possible")
for i in range(idx):
print(i + 1)
for i in range(N - 1, idx, -1):
print(i) | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,223 |
s615621133 | p04035 | u707124227 | 1594778505 | Python | Python (3.8.2) | py | Accepted | 96 | 19932 | 390 | n,l=map(int,input().split())
a=list(map(int,input().split()))
lastmusubi=-1
tmp=0
for i in range(n-1):
if a[i]+a[i+1]>tmp:
lastmusubi=i
tmp=a[i]+a[i+1]
if tmp>=l:
print('Possible')
if lastmusubi>0:
for j in range(lastmusubi):
print(j+1)
if lastmusubi<n-1:
for j in range(n-2,lastmusubi,-1):... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,224 |
s678427575 | p04035 | u936985471 | 1593878951 | Python | Python (3.8.2) | py | Accepted | 100 | 19856 | 561 | import sys
readline = sys.stdin.readline
N,L = map(int,readline().split())
A = list(map(int,readline().split()))
# 2個でL以上の隣合うペアがどこかにあれば、そこを最後に残せば大丈夫
target = -1
for i in range(1,len(A)):
if A[i] + A[i - 1] >= L:
target = i
break
if target == -1:
print("Impossible")
exit(0)
left = []
for i in range(1,ta... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,225 |
s229554934 | p04035 | u102461423 | 1592719626 | Python | Python (3.8.2) | py | Accepted | 87 | 19940 | 372 | import sys
import os
N, L, *A = map(int, os.read(0, 10**8).split())
def main(L, A):
N = len(A)
is_long = [x + y >= L for x, y in zip(A, A[1:])]
if not any(is_long):
print('Impossible')
return
print('Possible')
i = is_long.index(True)
nums = list(range(1, i + 1)) + list(range(N ... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,226 |
s273769636 | p04035 | u279493135 | 1592694109 | Python | Python (3.8.2) | py | Accepted | 98 | 21560 | 995 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,227 |
s083613832 | p04035 | u102461423 | 1592593142 | Python | Python (3.8.2) | py | Accepted | 79 | 20060 | 456 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, L, *A = map(int, read().split())
def main(L, A):
N = len(A)
is_long = [x + y >= L for x, y in zip(A, A[1:])]
if not any(is_long):
print('Impossible')
return
print('Po... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,228 |
s443639456 | p04035 | u561231954 | 1589147229 | Python | Python (3.4.3) | py | Accepted | 78 | 18120 | 555 | INF = 10 ** 15
MOD = 10 ** 9 + 7
def main():
N,L = map(int,input().split())
A = list(map(int,input().split()))
point = -1
for i in range(N - 1):
if A[i] + A[i + 1] >= L:
point = i + 1
break
if point == - 1:
print('Impossible')
return
ans = []
... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,229 |
s559709129 | p04035 | u340781749 | 1588803795 | Python | Python (3.4.3) | py | Accepted | 87 | 17764 | 462 | n, l = map(int, input().split())
aaa = list(map(int, input().split()))
max_i = 0
max_two_ropes = 0
for i in range(n - 1):
two_ropes = aaa[i] + aaa[i + 1]
if max_two_ropes < two_ropes:
max_i = i
max_two_ropes = two_ropes
if max_two_ropes < l:
print('Impossible')
else:
print('Possible')
... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,230 |
s557141860 | p04035 | u139112865 | 1586063809 | Python | Python (3.4.3) | py | Accepted | 100 | 14052 | 353 | #002_C
n, l = map(int, input().split())
a = list(map(int, input().split()))
flg = False
ans = []
for i in range(n-1):
if a[i] + a[i+1] >= l:
ans = [j for j in range(1, i+1)] + [j for j in range(n-1, i+1, -1)] + [i+1]
flg = True
break
if flg:
print('Possible')
print(*ans, sep='\... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,231 |
s644027366 | p04035 | u761320129 | 1584586429 | Python | Python (3.4.3) | py | Accepted | 96 | 14052 | 302 | N,L = map(int,input().split())
A = list(map(int,input().split()))
last = -1
for i,(a,b) in enumerate(zip(A,A[1:])):
if a+b >= L:
last = i
break
if last < 0:
print('Impossible')
exit()
print('Possible')
ans = list(range(1,i+1)) + list(range(N-1,i,-1))
print(*ans, sep='\n') | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,232 |
s126160104 | p04035 | u945181840 | 1583769204 | Python | Python (3.4.3) | py | Accepted | 74 | 17868 | 387 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
N, L, *a = map(int, read().split())
knot = -1
for idx, (i, j) in enumerate(zip(a, a[1:])):
if i + j >= L:
knot = idx + 1
print('Possible')
break
else:
print('Impossible')
exit()
answer = list(range(1, knot)) + list(ran... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,233 |
s337444975 | p04035 | u073852194 | 1583430116 | Python | Python (3.4.3) | py | Accepted | 79 | 17892 | 408 | N,L = map(int,input().split())
A = list(map(int,input().split()))
untiable = False
lastknot = None
for i in range(N-1):
if A[i]+A[i+1] >= L:
untiable = True
lastknot = i+1
break
if untiable:
ans = [i for i in range(1,lastknot)] + [i for i in range(lastknot+1,N)[::-1]] + [lastknot]
... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,234 |
s200739423 | p04035 | u905582793 | 1579987620 | Python | Python (3.4.3) | py | Accepted | 100 | 14060 | 323 | n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n-1):
if a[i]+a[i+1] >= k:
print("Possible")
x = i
break
else:
print("Impossible")
exit()
if x == 0:
print(*list(range(1,n))[::-1],sep="\n")
else:
ans = list(range(1,n))
ans[x:] = ans[n-1:x-1:-1]
print(*ans,sep="\... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,235 |
s657023090 | p04035 | u102461423 | 1577455480 | Python | Python (3.4.3) | py | Accepted | 74 | 22496 | 526 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
# 和がL以上の2つをつなぐ
# 和がL以上のものが1つ作れたら、その周辺だけ処理していけばよい
N,L,*A = map(int,read().split())
S = [0] + [x+y for x,y in zip(A,A[1:])]
M = max(S)
i = S.index(M)
if M < L:
print('Impossible')
... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,236 |
s935557547 | p04035 | u670180528 | 1577428022 | Python | Python (3.4.3) | py | Accepted | 71 | 19660 | 279 | def s():
n, l, *a = map(int, open(0).read().split())
for i, (x, y) in enumerate(zip(a, a[1:])):
if x + y >= l:
print("Possible")
r = list(range(n))
print("\n".join(map(str, r[1:i + 1] + r[n:i:-1])))
break
else:
print("Impossible")
if __name__=="__main__":
s() | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,237 |
s409301628 | p04035 | u670180528 | 1577427811 | Python | Python (3.4.3) | py | Accepted | 77 | 19660 | 206 | n,l,*a=map(int,open(0).read().split())
for i,(x,y) in enumerate(zip(a,a[1:])):
if x+y>=l:
print("Possible")
r=list(range(n))
print("\n".join(map(str,r[1:i+1]+r[n:i:-1])))
exit()
print("Impossible") | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,238 |
s546839497 | p04035 | u226108478 | 1569550635 | Python | Python (3.4.3) | py | Accepted | 79 | 17892 | 791 | # -*- coding: utf-8 -*-
def main():
n, l = map(int, input().split())
a = list(map(int, input().split()))
# KeyInsight
# 最後から直前の状態を考える
# ある位置a[i]と右隣の値a[i+1]の和がL以上であれば構成できる
# iの位置を特定
# 左右の両端から切る
pos = -1
for i in range(n - 1):
if (a[i] + a[i + 1]) >= l:
pos = i
... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,239 |
s500724159 | p04035 | u077291787 | 1569148612 | Python | Python (3.4.3) | py | Accepted | 74 | 21836 | 458 | # AGC002C - Knot Puzzle
def main():
N, L, *A = map(int, open(0).read().split())
B = [i + j for i, j in zip(A, A[1:])]
x = max(B)
if x < L: # corner case
print("Impossible")
return
idx = B.index(x) + 1
# keep the biggest one until the end
ans = [i for i in range(1, idx)] + [i... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,240 |
s610373607 | p04035 | u077291787 | 1569148447 | Python | Python (3.4.3) | py | Accepted | 74 | 21836 | 512 | # AGC002C - Knot Puzzle
def main():
N, L, *A = map(int, open(0).read().split())
B = [i + j for i, j in zip(A, A[1:])]
x = max(B)
if x >= L: # at least one pair must be equal or greater than L
idx = B.index(x) + 1
# keep the biggest one until the end
ans = [i for i in range(1, id... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,241 |
s312618760 | p04035 | u509368316 | 1567213726 | Python | Python (3.4.3) | py | Accepted | 99 | 14264 | 277 | N,L=map(int,input().split())
A=list(map(int,input().split()))
x=-1
for i in range(N-1):
if A[i]+A[i+1]>=L:
x=i
break
if x==-1:
print('Impossible')
else:
print('Possible')
r=list(range(1,x+1))+list(range(N-1,x+1,-1))+[x+1,]
print(*r,sep='\n') | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,242 |
s199052158 | p04035 | u102461423 | 1567032208 | Python | Python (3.4.3) | py | Accepted | 80 | 19368 | 566 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
"""
逆再生。長さL以上になるものをくっつけられる。
一度L以上になったらそこだけ見ていけばよい
"""
N,L = map(int,input().split())
A = [int(x) for x in input().split()]
A2 = [x+y for x,y in zip(A,A[1:])]
M = max(A2)
i = A2.index(M)
if M < L:
answer = ['Impossible']
else:
answer = ['Po... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,243 |
s807816969 | p04035 | u077291787 | 1566840676 | Python | Python (3.4.3) | py | Accepted | 94 | 17900 | 455 | # AGC002C - Knot Puzzle
def main():
N, L = tuple(map(int, input().split()))
A = tuple(map(int, input().split()))
B = [i + j for i, j in zip(A, A[1:])]
x = max(B)
if x >= L:
idx = B.index(x) + 1
ans = [i for i in range(1, idx)]
ans += [i for i in range(N - 1, idx, -1)] + [idx... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,244 |
s453912429 | p04035 | u564902833 | 1553460291 | Python | Python (3.4.3) | py | Accepted | 89 | 21352 | 368 | N, L = map(int, input().split())
a = list(map(int, input().split()))
I = [i + 1 for i in range(N - 1) if a[i] + a[i + 1] >= L]
ans = (
'Possible\n{}'.format(
'\n'.join(
map(
str,
list(range(1, I[0])) + list(range(N - 1, I[0], -1)) + [I[0]]
)
)... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,245 |
s180637994 | p04035 | u690536347 | 1547787508 | Python | Python (3.4.3) | py | Accepted | 95 | 14060 | 234 | n,l=map(int,input().split())
*a,=map(int,input().split())
for i in range(n-1):
if a[i]+a[i+1]>=l:
print("Possible")
print(*range(i+2,n)[::-1],sep="\n")
print(*range(1,i+2),sep="\n")
break
else:
print("Impossible") | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,246 |
s154609759 | p04035 | u690536347 | 1547787076 | Python | Python (3.4.3) | py | Accepted | 100 | 14076 | 266 | n,l=map(int,input().split())
*a,=map(int,input().split())
v=[0]
for i in range(n-1):
if a[i]+a[i+1]>=l:
v[0]=i+1
v+=list(range(1,i+1)[::-1])
v+=list(range(i+2,n))
print("Possible")
print(*v[::-1],sep="\n")
break
else:
print("Impossible") | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,247 |
s272344355 | p04035 | u177398299 | 1539127766 | Python | Python (3.4.3) | py | Accepted | 98 | 14924 | 298 | N, L = map(int, input().split())
a = list(map(int, input().split()))
end = 0
for i in range(N - 1):
if a[i] + a[i + 1] >= L:
end = i + 1
break
else:
print('Impossible')
exit()
ans = list(range(1, end)) + list(range(end, N))[::-1]
print('Possible')
print(*ans, sep='\n') | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,248 |
s657126669 | p04035 | u536113865 | 1537565731 | Python | Python (3.4.3) | py | Accepted | 99 | 14448 | 322 | ai = lambda: list(map(int, input().split()))
n,l = ai()
a = ai()
f = 0
for i in range(1,n):
if a[i-1]+a[i] >= l:
f = 1
key = i
break
if f:
print('Possible')
b = list(range(n))
c = b[1:key]
c += b[-1:key:-1]
c += [key]
print(*c, sep='\n')
else:
print('Impossible'... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,249 |
s979240059 | p04035 | u624475441 | 1536989872 | Python | Python (3.4.3) | py | Accepted | 74 | 14732 | 273 | N, L, *a = map(int, open(0).read().split())
for i, (n, m) in enumerate(zip(a, a[1:]), 1):
if n + m >= L:
print('Possible')
print('\n'.join(c for it in (range(1,i), range(N-1,i,-1), [i]) for c in map(str, it)))
break
else:
print('Impossible') | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,250 |
s538197411 | p04035 | u215693191 | 1519775057 | Python | Python (2.7.6) | py | Accepted | 94 | 11852 | 503 | def cutSequence(piles, threshold):
for i in xrange(len(piles)-1):
if piles[i]+piles[i+1]>=threshold:
return range(0, i)+range(len(piles)-2, i-1, -1)
return []
def main():
n, m = [int(x) for x in raw_input().strip().split()]
a = [int(x) for x in raw_input().strip().split()]
foo =... | p04035 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>We have <var>N</var> pieces of ropes, numbered <var>1</var> through <var>N</var>. The length of piece <var>i</var> is <var>a_i</var>.</p>
<p>At first, for each <var>i (1≤i≤N-1)</var>, piece <var>i</var> and piece <var>i+1</var> are tied at... | 3 50
30 20 10
| Possible
2
1
| 1,209,251 |
s063616288 | p04037 | u488401358 | 1597191375 | Python | PyPy3 (7.3.0) | py | Accepted | 99 | 84976 | 657 | N=int(input())
A=list(map(int,input().split()))
A.append(0)
A.sort()
winner=""
for i in range(N+1):
if A[N-i]>i:
if (A[N-i]-i)%2==0:
winner="First"
else:
winner="Second"
elif A[N-i]==i:
if (A[N-i+1]-A[N-i])%2==1:
winner="First"
break
... | p04037 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>There are <var>N</var> piles of candies on the table. The piles are numbered <var>1</var> through <var>N</var>. At first, pile <var>i</var> contains <var>a_i</var> candies.</p>
<p>Snuke and Ciel are playing a game. They take alternating tu... | 2
1 3
| First
| 1,209,252 |
s806512746 | p04037 | u923270446 | 1596238430 | Python | Python (3.8.2) | py | Accepted | 79 | 20384 | 266 | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
a.append(0)
i = 0
j = 0
while i + 1 < a[i + 1]:
i += 1
j += 1
while i + 1 <= a[j]:
j += 1
if (j - i) % 2 == 0 or (a[i] - i) % 2 == 0:
print("First")
else:
print("Second") | p04037 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>There are <var>N</var> piles of candies on the table. The piles are numbered <var>1</var> through <var>N</var>. At first, pile <var>i</var> contains <var>a_i</var> candies.</p>
<p>Snuke and Ciel are playing a game. They take alternating tu... | 2
1 3
| First
| 1,209,253 |
s034757599 | p04037 | u340781749 | 1594314906 | Python | Python (3.8.2) | py | Accepted | 72 | 19984 | 290 | import sys
n, *aaa = map(int, sys.stdin.read().split())
aaa.sort(reverse=True)
aaa.append(-1)
i = 0
while aaa[i + 1] > i + 1:
i += 1
j = i
while aaa[j] >= i + 1:
j += 1
if (aaa[i] - i) % 2 == 0 or (j - i) % 2 == 0:
ans = 0
else:
ans = 1
print(['First', 'Second'][ans])
| p04037 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>There are <var>N</var> piles of candies on the table. The piles are numbered <var>1</var> through <var>N</var>. At first, pile <var>i</var> contains <var>a_i</var> candies.</p>
<p>Snuke and Ciel are playing a game. They take alternating tu... | 2
1 3
| First
| 1,209,254 |
s619269550 | p04037 | u143509139 | 1587343663 | Python | Python (3.4.3) | py | Accepted | 89 | 14212 | 306 | n = int(input())
a = list(map(int, input().split())) + [0]
a.sort(reverse=True)
for i in range(n):
if a[i + 1] <= i + 1:
y = a[i + 1:].count(i + 1)
x = i - a[i] - 1
if x % 2 == 0 and y % 2 == 0:
print('Second')
else:
print('First')
break
| p04037 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>There are <var>N</var> piles of candies on the table. The piles are numbered <var>1</var> through <var>N</var>. At first, pile <var>i</var> contains <var>a_i</var> candies.</p>
<p>Snuke and Ciel are playing a game. They take alternating tu... | 2
1 3
| First
| 1,209,255 |
s598646700 | p04037 | u211706121 | 1576525446 | Python | Python (3.4.3) | py | Accepted | 89 | 14212 | 396 | n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
a.append(0)
#after win=false first win = true
ans = False
for i in range(n):
if i+1>=a[i+1]:
ans=(((a[i]-i)%2)==0)
for j in range(i+1,n+1):
if a[j]<=i:
ans = ans or (((i-j)%2)==0)
... | p04037 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>There are <var>N</var> piles of candies on the table. The piles are numbered <var>1</var> through <var>N</var>. At first, pile <var>i</var> contains <var>a_i</var> candies.</p>
<p>Snuke and Ciel are playing a game. They take alternating tu... | 2
1 3
| First
| 1,209,256 |
s229203274 | p04037 | u102461423 | 1574525502 | Python | Python (3.4.3) | py | Accepted | 96 | 12528 | 350 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,*A = map(int,read().split())
A.sort(reverse = True)
A.append(0)
i = 0
while A[i + 1] > i + 1:
i += 1
x = A[i] - (i + 1)
y = max(j for j in range(N) if A[j] > i) - i
answer = 'First' if x&1 or y... | p04037 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>There are <var>N</var> piles of candies on the table. The piles are numbered <var>1</var> through <var>N</var>. At first, pile <var>i</var> contains <var>a_i</var> candies.</p>
<p>Snuke and Ciel are playing a game. They take alternating tu... | 2
1 3
| First
| 1,209,257 |
s512433915 | p04037 | u132291455 | 1478023702 | Python | PyPy2 (5.6.0) | py | Accepted | 84 | 23920 | 188 | n=int(raw_input())
a=sorted(map(int,raw_input().split()))
a.reverse()
i=0
while i<n and a[i]>=i+1:i+=1
j=i
while j<n and a[j]>=i:j+=1
print 'First' if (a[i-1]-i)%2 or (j-i)%2 else 'Second' | p04037 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>There are <var>N</var> piles of candies on the table. The piles are numbered <var>1</var> through <var>N</var>. At first, pile <var>i</var> contains <var>a_i</var> candies.</p>
<p>Snuke and Ciel are playing a game. They take alternating tu... | 2
1 3
| First
| 1,209,258 |
s472219494 | p04037 | u132291455 | 1478023430 | Python | PyPy2 (5.6.0) | py | Accepted | 89 | 23920 | 199 | n=int(raw_input())
a=sorted(map(int,raw_input().split()))
a.reverse()
i=0
while i<n and a[i]>=i+1:i+=1
m1=a[i-1]-i
j=i
while j<n and a[j]>=i:j+=1
m2=j-i
print 'First' if (m1%2 or m2%2) else 'Second'
| p04037 | <span class="lang-en">
<div class="part">
<section>
<h3>Problem Statement</h3><p>There are <var>N</var> piles of candies on the table. The piles are numbered <var>1</var> through <var>N</var>. At first, pile <var>i</var> contains <var>a_i</var> candies.</p>
<p>Snuke and Ciel are playing a game. They take alternating tu... | 2
1 3
| First
| 1,209,259 |
s997569854 | p04039 | u648315264 | 1601296708 | Python | PyPy3 (7.3.0) | py | Accepted | 85 | 67664 | 976 | import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7
import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): retu... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,260 |
s002047516 | p04039 | u385551158 | 1601250138 | Python | Python (3.8.2) | py | Accepted | 23 | 9100 | 919 | s = input()
s = s.split(" ")
N = s[0]
K = int(s[1])
s = input()
s = s.split(" ")
ds = [int(digit) for digit in s]
minNum = min([digit for digit in range(0, 10) if digit not in ds])
nonZerominNum = min([digit for digit in range(1, 10) if digit not in ds])
maxNum = max([digit for digit in range(0, 10) if digit not in d... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,261 |
s045159561 | p04039 | u512551187 | 1600471751 | Python | PyPy3 (7.3.0) | py | Accepted | 93 | 73632 | 245 | n,k=map(int,input().split())
l=list(map(int,input().split()))
for i in range(n,100000):
s=str(i)
d=list(map(int,s))
f=0
for j in range(len(d)):
if(d[j] in l):
f=1
if(f==0):
print(i)
exit()
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,262 |
s774051850 | p04039 | u816631826 | 1598584161 | Python | Python (3.8.2) | py | Accepted | 75 | 9192 | 213 | n,k = map(int, input().split())
d = list(map(int, input().split()))
def v(n):
for c in map(int, str(n)):
if (c in d):
return False
return True
while (v(n) == False):
n += 1
print(n) | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,263 |
s077575886 | p04039 | u089230684 | 1597953125 | Python | Python (3.8.2) | py | Accepted | 38 | 9176 | 241 | n, k = map(int, input().split())
d = list(map(int, input().split()))
w = [False] * 10
for i in d:
w[i] = True
def check(n):
while n:
if w[n % 10]:
return False
n //= 10
return True
ans = n
while not check(ans):
ans += 1
print(ans) | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,264 |
s662934236 | p04039 | u277236383 | 1597029499 | Python | Python (3.8.2) | py | Accepted | 90 | 9208 | 319 | n, k =map(int, input().split())
d = list(map(int, input().split()))
a = [0]*10
for i in d:
a[i]=1
ans = n
while True:
flg = False
temp = str(n)
l = len(temp)
for i in range(l):
if a[int(temp[i])]==1:
n+=1
flg = True
break
if flg:
continue
else:
print(n)
quit()
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,265 |
s474948354 | p04039 | u277236383 | 1597027810 | Python | Python (3.8.2) | py | Accepted | 32 | 9128 | 1,165 | def ume(n):
st = str(n)
le = len(st)
re = ["0"]*le
for i in range(le):
if st[i]=="0":
re[i]=str(m)
else:
re[i]=st[i]
return int("".join(re))
n, k = map(int, input().split())
d = list(map(int, input().split()))
num = []
#使える文字をリスト化
for i in range(10):
if not i in d:
num.append(i)
... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,266 |
s190503359 | p04039 | u374051158 | 1596038722 | Python | Python (3.8.2) | py | Accepted | 56 | 9076 | 213 | n, k = map(int, input().split())
d = input().split()
def is_ok(num):
s = str(num)
for ng in d:
if ng in s: return False
return True
while True:
if is_ok(n):
print(n)
exit()
n += 1
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,267 |
s631015940 | p04039 | u894312115 | 1595791225 | Python | PyPy3 (7.3.0) | py | Accepted | 78 | 67764 | 199 | n,k=map(int,input().split())
ar=list(map(int,input().split()))
def f(n):
s=str(n)
for el in ar:
if(str(el) in s):
return 0
return 1
while(not f(n)):
n+=1
print(n)
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,268 |
s203710848 | p04039 | u371409687 | 1595043518 | Python | Python (3.8.2) | py | Accepted | 93 | 9112 | 175 | n,k=map(int,input().split())
D=set(map(str,input().split()))
ans=''
while True:
tmp=set(list(str(n)))
if len(D&tmp)==0:
ans=n
break
n+=1
print(ans) | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,269 |
s565860442 | p04039 | u730769327 | 1594781671 | Python | PyPy3 (7.3.0) | py | Accepted | 74 | 73408 | 185 | from itertools import permutations
n,k=map(int,input().split())
d=input().split()
i=n
while True:
for j in str(i):
if j in d:
i+=1
break
else:
print(i)
break | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,270 |
s171617594 | p04039 | u978167553 | 1593896729 | Python | Python (3.8.2) | py | Accepted | 75 | 9104 | 235 |
(n, k) = map(int, input().split())
d = input().split()
ans = n
while True:
check = True
for dk in d:
if dk in str(ans):
check = False
break
if check:
break
ans += 1
print(ans)
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,271 |
s379410335 | p04039 | u222668979 | 1590782526 | Python | Python (3.4.3) | py | Accepted | 97 | 2940 | 200 | n, k = map(int, input().split())
d = set(range(10)) - set(map(int, input().split()))
i = n
while True:
if (i >= n) and all(int(j) in d for j in str(i)):
print(i)
break
i += 1
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,272 |
s004340442 | p04039 | u222668979 | 1590782459 | Python | Python (3.4.3) | py | Accepted | 99 | 2940 | 200 | n, k = map(int, input().split())
d = set(range(10)) - set(map(int, input().split()))
i = n
while True:
if (i >= n) and all(int(k) in d for k in str(i)):
print(i)
break
i += 1
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,273 |
s893373728 | p04039 | u222668979 | 1590782286 | Python | Python (3.4.3) | py | Accepted | 36 | 3064 | 298 | from itertools import product
n, k = map(int, input().split())
d = set(range(10)) - set(map(int, input().split()))
for i in product(d | set([0]), repeat=len(str(n)) + 1):
i = int("".join(str(j) for j in i))
if (i >= n) and all(int(k) in d for k in str(i)):
print(i)
break
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,274 |
s750683403 | p04039 | u391589398 | 1590608717 | Python | Python (3.4.3) | py | Accepted | 58 | 2940 | 188 | n, k = map(int, input().split())
D = tuple(input().split())
while True:
sn = str(n)
for s in sn:
if s in D:
break
else:
break
n += 1
print(n)
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,275 |
s925341321 | p04039 | u658113376 | 1590366379 | Python | Python (3.4.3) | py | Accepted | 17 | 3064 | 1,602 | oldMoney, hateNumberLength = map(list, input().split())
hateLines = list(str(input()).rsplit(" "))
okLines = []
FirstBigList = []
newMoney = list(oldMoney)
def FindFirstBig(okLines, m, FirstBig):
for i in okLines:
if i > m:
FirstBig.append(i)
break
return FirstBig
for i i... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,276 |
s159387233 | p04039 | u658113376 | 1590366083 | Python | Python (3.4.3) | py | Accepted | 18 | 3188 | 1,578 | oldMoney, hateNumberLength = map(list, input().split())
hateLines = list(str(input()).rsplit(" "))
okLines = []
FirstBigList = []
newMoney = list(oldMoney)
def FindFirstBig(okLines, m, FirstBig):
for i in okLines:
if i > m:
FirstBig.append(i)
return FirstBig
for i in range(10):
if st... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,277 |
s706292369 | p04039 | u848647227 | 1590029102 | Python | Python (3.4.3) | py | Accepted | 79 | 3060 | 226 | a,b = map(int,input().split(" "))
ar = input().split(" ")
while True:
count = 0
for r in ar:
if r in str(a):
count += 1
break
if count == 0:
print(a)
break
a += 1 | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,278 |
s318580077 | p04039 | u026788530 | 1589990231 | Python | Python (3.4.3) | py | Accepted | 52 | 3060 | 178 | n,k=[int(_) for _ in input().split()]
d=[_ for _ in input().split()]
for i in range(n,10*n):
s =str(i)
for c in s:
if c in d:
break
else:
print(i)
exit() | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,279 |
s910679923 | p04039 | u925051897 | 1589224541 | Python | Python (3.4.3) | py | Accepted | 100 | 2940 | 288 | input_1st=input()
input_2nd=input()
N, K = input_1st.split(" ")
D = input_2nd.split(" ")
for ans in range(int(N), 100000):
flg = True
for i in range(len(str(ans))):
if str(ans)[i] in D:
flg = False
break
if flg:
print(ans)
break
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,280 |
s321923985 | p04039 | u188745744 | 1588533792 | Python | Python (3.4.3) | py | Accepted | 60 | 3060 | 241 | A,B = list(map(int,input().split()))
l_n = list(input().split())
sw = 0
for i in range(A,A*10+1):
sw=0
C = str(i)
for j in C:
if j in l_n:
sw=1
break
if sw == 0:
print(i)
exit() | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,281 |
s163460929 | p04039 | u152992875 | 1588218372 | Python | PyPy2 (5.6.0) | py | Accepted | 60 | 32156 | 362 | n, k = map(int, raw_input().strip().split())
diss = map(int, raw_input().strip().split())
like = [1] * 10
for d in diss: like[d] = 0
ok = 1
amt = n
for c in str(amt):
if not like[int(c)]:
ok = 0
break
while not ok:
amt += 1
ok = 1
for c in str(amt):
if not like[int(c)]:
... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,282 |
s184559803 | p04039 | u896726004 | 1586314669 | Python | Python (3.4.3) | py | Accepted | 57 | 2940 | 242 | N, K = map(int, input().split())
D = list(input().split())
ans = N
for p in range(N, N+10**9):
flag = True
s = str(p)
for c in s:
if c in D:
flag = False
break
if flag:
break
print(s) | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,283 |
s773771989 | p04039 | u102242691 | 1585390630 | Python | Python (3.4.3) | py | Accepted | 71 | 2940 | 183 | n,m = input().split()
k=int(n)
l = list(input().split())
for i in range(k,100000):
for e in l:
if e in str(i):
break
else:
print(i)
break
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,284 |
s399287572 | p04039 | u102242691 | 1585370020 | Python | Python (3.4.3) | py | Accepted | 66 | 2940 | 185 | n,m = input().split()
k=int(n)
li = list(input().split())
for i in range(k,100000):
for e in li:
if e in str(i):
break
else:
print(i)
break
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,285 |
s181504864 | p04039 | u204616996 | 1585158173 | Python | Python (3.4.3) | py | Accepted | 19 | 3064 | 325 | N,K=map(int,input().split())
D=[1]*10
for i in map(int,input().split()):
D[i]=0
ans=''
while N>0:
n=N%10
N=N//10
while D[n%10]==0:
n+=1
if n>9:
N+=1
elif N>0 and D[N%10]==0:
for i in range(n):
if D[i]==1:
n=i
break
ans+=str(n%10)
if ans=='':
print(N)
else:
print(ans[:... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,286 |
s933250700 | p04039 | u881116515 | 1583711703 | Python | Python (3.4.3) | py | Accepted | 93 | 3060 | 208 | n,k = map(int,input().split())
d = input().split()
ans = n-1
while True:
ok = True
ans += 1
z = list(str(ans))
for i in z:
if i in d:
ok = False
break
if ok:
print(ans)
break | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,287 |
s125264295 | p04039 | u433195318 | 1581929615 | Python | Python (3.4.3) | py | Accepted | 85 | 5076 | 1,741 | import sys
import math
import fractions
import bisect
import queue
import heapq
import collections
import itertools
sys.setrecursionlimit(4100000)
MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18
'''
1行のint=====================================
N, K = map(int, input().split())
N, M = map(int, inp... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,288 |
s385762802 | p04039 | u863370423 | 1580543221 | Python | Python (3.4.3) | py | Accepted | 49 | 3060 | 404 | n, k = list(map(int, input().split()))
digits = [0]*10
digits_disliked = list(map(int, input().split()))
for i in digits_disliked:
digits[i] = 1
for i in range(n, 10**7+1):
temp = i
flag = True
while(temp):
rem = temp%10
temp = temp//10
if(digits[rem] != 0):
flag... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,289 |
s325880124 | p04039 | u863370423 | 1580542201 | Python | Python (3.4.3) | py | Accepted | 67 | 2940 | 184 | n,m = input().split()
k=int(n)
li = list(input().split())
for i in range(k,100000):
for e in li:
if e in str(i):
break
else:
print(i)
break | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,290 |
s094846693 | p04039 | u993435350 | 1579636681 | Python | Python (3.4.3) | py | Accepted | 69 | 3060 | 263 | N,K = map(int,input().split())
D = list(map(int,input().split()))
flag = False
inf = 10 ** 6
while flag == False:
for i in range(N,inf):
L = str(i)
for j in L:
if int(j) in D:
break
else:
print(i)
flag = True
break | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,291 |
s703202794 | p04039 | u018679195 | 1579106074 | Python | Python (3.4.3) | py | Accepted | 71 | 3060 | 207 | s, k = [int(i) for i in input().split(" ")]
num = [int(i) for i in input().split(" ")]
def check(n):
for _s in str(n):
if int(_s) in num:
return True
return False
while check(s):
s += 1
print(s)
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,292 |
s965884117 | p04039 | u799691369 | 1576942416 | Python | Python (3.4.3) | py | Accepted | 60 | 2940 | 256 | n, k = map(int, input().split())
checker = list(map(str, input().split()))
cont = True
while cont:
keep = True
for nn in str(n):
if nn in checker:
keep = False
break
if keep: break
n += 1
print(n) | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,293 |
s980779186 | p04039 | u780475861 | 1576034301 | Python | Python (3.4.3) | py | Accepted | 51 | 3060 | 287 | n, k = map(int, input().split())
dlst = [int(i) for i in input().split()]
lst = []
for i in range(10):
if i not in dlst:
lst.append(str(i))
for i in range(n, 10 * n + 1):
a = True
for j in str(i):
if j not in lst:
a = False
break
if a:
print(i)
quit() | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,294 |
s251781667 | p04039 | u077291787 | 1571152867 | Python | Python (3.4.3) | py | Accepted | 90 | 2940 | 261 | # ABC042C - こだわり者いろはちゃん / Iroha's Obsession (ARC058)
def main():
N, K, *D = map(int, open(0).read().split())
D = set(D)
while any(int(i) in D for i in str(N)):
N += 1
print(N)
if __name__ == "__main__":
main() | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,295 |
s769008937 | p04039 | u744901930 | 1570570586 | Python | Python (3.4.3) | py | Accepted | 57 | 2940 | 222 | n,k=map(int,input().split())
d=list(input().split())
while True:
ok=True
for c in str(n):
if c in d:
ok=False
break
if ok:
print(n)
break
else:
n+=1
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,296 |
s345133893 | p04039 | u392319141 | 1568980004 | Python | Python (3.4.3) | py | Accepted | 85 | 2940 | 130 | N, K = map(int, input().split())
D = set(input().split())
ans = N
while any([i in D for i in str(ans)]):
ans += 1
print(ans) | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,297 |
s501539524 | p04039 | u285443936 | 1568978327 | Python | Python (3.4.3) | py | Accepted | 77 | 2940 | 328 | N, K = map(int, input().split())
D = [int(i) for i in input().split()]
M = N
while True:
S = str(M)
flag = 0
for s in S:
if int(s) in D:
M += 1
break
else:
break
print(S)
#N = str(N)
#L = len(N)
#for i in range(L):
# j = -1-i
# x = int(N[j])
# if int(N[j]) in D:
# while int(N[j]) in D... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,298 |
s975869809 | p04039 | u392319141 | 1568977792 | Python | Python (3.4.3) | py | Accepted | 91 | 2940 | 198 | N, K = map(int, input().split())
D = set(input().split())
safe = set([str(i) for i in range(10) if not str(i) in D])
ans = N
while not all([i in safe for i in str(ans)]):
ans += 1
print(ans)
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,299 |
s649773900 | p04039 | u761320129 | 1568977442 | Python | Python (3.4.3) | py | Accepted | 72 | 3060 | 191 | N,K = map(int,input().split())
D = list(map(int,input().split()))
while 1:
for d in str(N):
if int(d) in D:
break
else:
print(N)
exit()
N += 1 | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,300 |
s746066807 | p04039 | u126823513 | 1568585857 | Python | Python (3.4.3) | py | Accepted | 83 | 2940 | 157 | n, k = map(int, input().split())
li_d = list(input().split())
answer = n
while not all(w not in li_d for w in str(answer)):
answer += 1
print(answer)
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,301 |
s214125836 | p04039 | u970308980 | 1567995199 | Python | Python (3.4.3) | py | Accepted | 52 | 2940 | 251 | N, K = map(int, input().split())
D = set(map(str, input().split()))
while True:
S = str(N)
hit = True
for s in S:
if s in D:
N += 1
hit = False
break
if hit:
print(N)
exit()
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,302 |
s991915497 | p04039 | u538381753 | 1567464482 | Python | Python (3.4.3) | py | Accepted | 69 | 2940 | 184 | n, k = [int(x) for x in input().split(' ')]
d = set(x for x in input().split(' '))
for i in range(100000):
if set(str(i)).isdisjoint(d) and i >= n:
print(i)
exit() | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,303 |
s394285646 | p04039 | u753803401 | 1566615292 | Python | Python (3.4.3) | py | Accepted | 28 | 3060 | 329 | import itertools
n, k = map(int, input().split())
d = list(map(int, input().split()))
u = []
for i in range(0, 10):
if i not in d:
u.append(i)
for j in range(1, 6):
for i in itertools.product(u, repeat=j):
t = int("".join(map(str, i)))
if n <= t <= 100000:
print(t)
... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,304 |
s033885262 | p04039 | u141610915 | 1566529297 | Python | Python (3.4.3) | py | Accepted | 18 | 3064 | 563 | from bisect import bisect_left as bl
N, K = map(list, input().split())
D = list(map(int, input().split()))
D = [i for i in range(10) if not i in D]
res = []
big = 0
if int("".join([str(D[-1])] * len(N))) < int("".join(N)):
if int(K[0]) < 9:
if D[0] == 0:
res = [D[1]] + [0] * len(N)
else:
res = [D[... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,305 |
s455233767 | p04039 | u753803401 | 1566242085 | Python | Python (3.4.3) | py | Accepted | 80 | 2940 | 240 | n, k = map(int, input().split())
d = tuple(map(str, input().split()))
for i in range(n, 10 ** 9):
b = True
for s in tuple(str(i)):
if s in d:
b = False
break
if b:
print(i)
exit()
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,306 |
s738230216 | p04039 | u392319141 | 1565831595 | Python | Python (3.4.3) | py | Accepted | 46 | 2940 | 196 | N, K = map(int, input().split())
D = set(input().split())
ans = N
while True:
for s in str(ans):
if s in D:
break
else:
print(ans)
break
ans += 1
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,307 |
s949832119 | p04039 | u875291233 | 1564807141 | Python | Python (3.4.3) | py | Accepted | 64 | 3064 | 398 | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
n,k = [int(i) for i in readline().split()]
d = [int(i) for i in readline().split()]
ng = [1 if i in d else 0 for i in range(10)]
for i in range(n,10**6):
s = str(i)
for j in s:
if ng... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,308 |
s109118522 | p04039 | u473291366 | 1564003247 | Python | Python (3.4.3) | py | Accepted | 68 | 3064 | 357 | N, K = map(int,input().split())
U = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
for d in list(map(int,input().split())):
if d in U:
U.remove(d)
def check(n):
for s in str(n):
if int(s) not in U:
return False
if n >= N:
return True
else:
return False
ans = N
while not c... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,309 |
s509053722 | p04039 | u426108351 | 1563930973 | Python | Python (3.4.3) | py | Accepted | 30 | 3064 | 335 | n, k = map(int, input().split())
d = set(list(map(int, input().split())))
d = list(set([i for i in range(10)])-d)
d.sort()
import itertools
import sys
for k in range(6):
for i in itertools.product(d, repeat=k):
ans = 0
for j in range(len(i)):
ans += i[-j-1]*10**j
if ans >= n:
print(ans)
... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,310 |
s214591134 | p04039 | u927534107 | 1563378283 | Python | Python (3.4.3) | py | Accepted | 28 | 3940 | 358 | import itertools
n,k=map(int,input().split())
l=list(range(10))
l_tmp=list(map(int,input().split()))
for i in l_tmp:
l.remove(i)
keta=len(str(n))
li=list(itertools.product(l,repeat=keta))
ans=[int("".join(map(str,i))) for i in li]
tmp=[str(min([i for i in l if i>0]))]+[str(min(l))]*keta
ans.append(int("".join(tmp))... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,311 |
s545372193 | p04039 | u532966492 | 1562877513 | Python | Python (3.4.3) | py | Accepted | 86 | 2940 | 145 | N,K=map(int,input().split())
a=set(map(str,input().split()))
for i in range(N,10**5):
if a&set(str(i))==set():
print(i)
break | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,312 |
s855783575 | p04039 | u077291787 | 1562188199 | Python | Python (3.4.3) | py | Accepted | 89 | 3060 | 317 | # ARC058C - こだわり者いろはちゃん / Iroha's Obsession (ABC042C)
def main():
n, k = list(map(int, input().rstrip().split()))
D = set(map(int, input().rstrip().split()))
ans = n
while any(int(i) in D for i in str(ans)):
ans += 1
print(ans)
if __name__ == "__main__":
main() | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,313 |
s115269938 | p04039 | u367130284 | 1561999436 | Python | Python (3.4.3) | py | Accepted | 76 | 3188 | 178 | n,k,*d=map(int,open(0).read().split())
t=set(map(str,set(d)))
#print(t)
for i in range(n,1000000):
if set(str(i))&t:
continue
else:
print(i)
break | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,314 |
s197544737 | p04039 | u097121858 | 1561033523 | Python | Python (3.4.3) | py | Accepted | 84 | 8728 | 310 | def main():
n, k = map(int, input().split())
D = set(input().split())
numbers = [str(number) for number in range(n, 10 * n)]
for number in numbers:
if ok(number, D):
print(number)
break
def ok(number, D):
return len({c for c in number} & D) == 0
main()
| p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,315 |
s660338219 | p04039 | u139937121 | 1560590050 | Python | Python (2.7.6) | py | Accepted | 18 | 2816 | 1,016 | import collections, heapq, math, sys
n, k = map(int, sys.stdin.readline().rstrip().split(' '))
dislikes = map(int, sys.stdin.readline().rstrip().split(' '))
dislikess= set(dislikes)
for i in range(9):
if i not in dislikess:
smallest = i
break
cp = n
s = []
while cp:
s.append(cp%10)
cp //= 10
s.append(0)
... | p04039 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha is very particular about numbers. There are <var>K</var> digits that she dislikes: <var>D_1, D_2, ..., D_K</var>.</p>
<p>She is shopping, and now paying at the cashier.
Her total is <var>N</var> y... | 1000 8
1 3 4 5 6 7 8 9
| 2000
| 1,209,316 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.