submission_id string | problem_id string | status string | code string | input string | output string | problem_description string |
|---|---|---|---|---|---|---|
s676024136 | p04044 | Runtime Error | N, L = map(int, input().split())
s = []
ans = []
dj = list(arange(N))
for i in range(N):
s.append(input())
s = sorted(s)
ans = "".join(s) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s186242362 | p04044 | Runtime Error | L,N=map(int,input().split())
l=[]
for i in range(N):
l.append(input())
l.sort()
print(''.join(l))
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s742288298 | p04044 | Runtime Error | L,N=map(int,input().split())
l=[]
for i in range(N):
s=list(input())
s.sort()
a=''.join(s)
l.append(a)
l.sort()
print(''.join(l))
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s543182404 | p04044 | Runtime Error | N, L = map(int, input().split())
inputs = [input() for _ in range(N)]
ans = [
inputs[0] + inputs[1] + inputs[2],
inputs[0] + inputs[2] + inputs[1],
inputs[1] + inputs[0] + inputs[2],
inputs[1] + inputs[2] + inputs[0],
inputs[2] + inputs[0] + inputs[1],
inputs[2] + inputs[1] + inputs[0],
]
print(min(ans)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s625960720 | p04044 | Runtime Error | N, L = map(int, input().split())
inputs = [input() for _ in range(N)]
ans = []
for i in range(L):
for j in range(L):
for k in range(L):
if i != j and j != k:
ans.append(inputs[i] + inputs[j] + inputs[k])
print(min(ans)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s031334713 | p04044 | Runtime Error | n = int(raw_input())
s = ''
for i in range(n):
s += raw_input()
s = sorted(s)
ans = ''
for i in s:
ans += i
print ans
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s971247476 | p04044 | Runtime Error | lengh,num = map(int,input().split())
lis = [input() for i in range(num)]
print("".join(sorted(lis))) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s207586369 | p04044 | Runtime Error | s,l=map(int,input().split())
m=sorted([input() for _ in range(l)])
print("".join(m))
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s170391482 | p04044 | Runtime Error | N, L = map(int, input().split())
S = [input() for i in range(N)]
for i in range(3):
print(sorted(S)[i], end="") | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s582461042 | p04044 | Runtime Error | N, L = map(int, input().split())
S = [input() for i in range(N)]
print("{0}{1}{2}".format(sorted(S)[0],sorted(S)[1],sorted(S)[2])) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s760580659 | p04044 | Runtime Error | n,m=map(int,input().split())
s=sorted([input() for i in range(m)])
print("".join(s)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s214732425 | p04044 | Runtime Error | # -*- coding: utf-8 -*-
N, L = map(int, input().split())
str_list = [input() for i in range(L)]
str_list.sort()
ans = ""
for i in range(L):
ans += str_list[i]
print(ans) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s421462981 | p04044 | Runtime Error | print("".join(sorted([input() for _ in range(input().split()[0])))) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s840296008 | p04044 | Runtime Error | n, l = map(int, input().split())
array = sorted([input() for x in range(l)])
res = ""
for i in array:
res += i
print(res)
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s602666687 | p04044 | Runtime Error | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B
if __name__ == '__main__':
n, length = list(map(int, input().split()))
s = sorted([input() for _ in range(length)])
print(''.join(s))
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s170412342 | p04044 | Runtime Error | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
int N, L;
cin >> N >> L;
vector<string> v;
string ret;
string s;
for(int i=0; i<N; i++){
cin >> s;
v.push_back(s);
}
sort(v.begin(), v.end(), less<string>() );
for(vector<string>::iterator it = v.begin(); it != v.end(); it++){
ret += *it;
}
cout << ret << endl;
return 0;
}
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s544070355 | p04044 | Runtime Error | # -*- coding: utf-8 -*-
N,L = map(int,input().split())
ANS=[]
ans=""
for hoge in range(L):
S=input()
ANS.append(S)
ANS=sorted(ANS)
for fuga in ANS:
ans=ans+fuga
print(ans) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s253322812 | p04044 | Runtime Error | n,l = list(map(int, input().split(" ")))
s = []
for i in range(n):
s.append(input())
sort(s)
print("".join(s)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s938073830 | p04044 | Runtime Error | n, l = map(int, input().split())
str_list = [input() for i in range(l)]
str_list.sort()
print("".join(str_list))
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s618891314 | p04044 | Runtime Error | n, l = map(int, input().split())
str_list = [input() for i in range(3)]
str_list.sort()
print("".join(str_list))
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s574114986 | p04044 | Runtime Error | n,l = input().split()
n = int(n)
s = []
for i in range(n):
s.append(input())
s.sort()
print(s[0]+s[1]+s[2])
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s274838556 | p04044 | Runtime Error | n,l = map(int,input().split())
s = []
for i in range(n):
s.append(input())
s.sort()
print(s[0]+s[1]+s[2]) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s854903642 | p04044 | Runtime Error | 3 3
dxx
axx
cxx | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s031201613 | p04044 | Runtime Error | N,L=map(int,input().split())
S=[input() for i in range(N)]
Ts=""
T=[]
for j in range(L):
t=j
for i in range(N):
if t==L: t=0
Ts+=S[t]
t+=1
T.append(Ts)
Ts=""
print(min(T)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s287575071 | p04044 | Runtime Error | N,L = [int(i) for i in input().split()]
S=[[i for i in input().strip()] for j in range(N)]
print(''.join(sorted(S))) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s294011735 | p04044 | Runtime Error | def power_func(a,b,p):
"""a^b mod p を求める"""
if b==0: return 1
if b%2==0:
d=power_func(a,b//2,p)
return d*d %p
if b%2==1:
return (a*power_func(a,b-1,p ))%p
from math import factorial
H,W,A,B=map(int, input().split())
p=10**9+7
ans=0
X=[1]
Y=[1]
for i in range(H+W-2):
fact=factorial(i+1)%p
X+=[fact]
Y+=[power_func( fact, p-2,p)]
for i in range(B,W):
ans+=X[H-A-1+i]*X[A+W-2-i]*(Y[H-A-1]*Y[i]*Y[A-1]*Y[W-1-i])%p
print(ans) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s411602408 | p04044 | Runtime Error | L, N = map(int,input().split())
S = [input() for i in range(N)]
S.sort()
print("".join(S)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s663938167 | p04044 | Runtime Error | L, N = map(int,input().split())
S = [input() for i in range(N)]
B=sorted(S)
A=''.join(B)
print(str(A)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s500720939 | p04044 | Runtime Error | L, N = map(int,input().split())
S = [input() for i in range(N)]
S=sorted(S)
A=''.join(S)
print(str(A)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s176621176 | p04044 | Runtime Error | L, N = map(int,input().split())
S = [input() for i in range(N)]
S.sort()
A=''.join(S)
print(str(A)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s348097574 | p04044 | Runtime Error | L, N = map(int,input().split())
S = [input() for i in range(N)]
S.sort()
A=''.join(S)
print(A) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s740244698 | p04044 | Runtime Error | n, l = map(int, raw_input().split())
for i in xrange(n):
a.append(raw_input())
a.sort()
print "".join(a) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s734545290 | p04044 | Runtime Error | n, l = map(int, raw_input().split())
for i in xrange(n):
a.append(raw_input())
a.sort()
print " ".join(a) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s949202935 | p04044 | Runtime Error | import sys
L, N = map(int, raw_input().split())
input = []
for i in range(0, N):
sentence = raw_input()
input.append(sentence)
for x in sorted(input):
sys.stdout.write(x) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s288822451 | p04044 | Runtime Error | #pythonだとsortでそのまま何文字でもソートしてくれる
n, l = map(int, input().split())
s = [input() for _ in range(n)]]
print(''.join(sorted(s))) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s447909598 | p04044 | Runtime Error | # -*- coding: utf-8 -*-
# problem B
N, L = map(int, input().split())
ls = []
for _ in N:
input_data = input()
ls.append(input_data)
ls.sort()
print(''.join(ls)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s297337832 | p04044 | Runtime Error | N, L = map(int, input().split())
data = []
for _ in range(N):
input_data = input()
data.append(input_data)
print(data)
data.sort()
print(''.join(data))
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s844234676 | p04044 | Runtime Error | n,l=map(int,input().split())
print("".join(sorted[input() for i in range(n)])) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s814716947 | p04044 | Runtime Error | N,L = map(int, input().split())
S = 26*[""]
for i in range(N):
S[i] = input()
S.sort()
str = ""
for s in S:
str += s
print(str)
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s460675917 | p04044 | Runtime Error | import heapq
N, L = map(int, raw_input().split())
hq = []
for _ in xrange(N:
s = raw_input()
heapq.heappush(hq, s)
ans = ''
while len(hq) > 0:
ans += heapq.heappop(hq)
print ans | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s905483219 | p04044 | Runtime Error | print("".join(sorted([input() for i in range(int(input().split[0]))]))) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s481440393 | p04044 | Runtime Error | import sys
def main(lines):
print(''.join(sorted(lines.split())))
next(sys.stdin)
for line in sys.stdin:
lines += line
main(lines)
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s583679897 | p04044 | Runtime Error | N = int(input().split()[0])
words = [input() for i in range(N)]
print("".join(words.sort())) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s136690770 | p04044 | Runtime Error | N = input().split()[0]
words = [input() for i in range(N)]
print("".join(words.sort())) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s848410609 | p04044 | Runtime Error | import sys
sys.setrecursionlimit(10000000)
n, l = map(int, raw_input().split())
s = [raw_input() for _ in xrange(n)]
gtable = [[] for _ in xrange(26)]
result = []
def searchPrint(e, n):
table = [[] for _ in xrange(26)]
for i in e:
table[ord(s[i][n]) - 97].append(i)
for el in table:
if len(el) == 0:
continue
if len(el) == 1:
result.append(s[el[0]])
continue
if n == l-1:
for i in el:
result.append(s[i])
continue
searchPrint(el, n+1)
for i in xrange(n):
gtable[ord(s[i][0]) - 97].append(i)
for e in gtable:
if len(e) == 0:
continue
searchPrint(e, 1)
print "".join(result)
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s234130821 | p04044 | Runtime Error | n, l = map(int, raw_input().split())
s = [raw_input() for _ in xrange(n)]
gtable = [[] for _ in xrange(26)]
result = []
def searchPrint(e, n):
table = [[] for _ in xrange(26)]
for i in e:
table[ord(s[i][n]) - 97].append(i)
for el in table:
if len(el) == 0:
continue
if len(el) == 1:
result.append(s[el[0]])
continue
if n == l-1:
for i in el:
result.append(s[i])
continue
searchPrint(el, n+1)
for i in xrange(n):
gtable[ord(s[i][0]) - 97].append(i)
for e in gtable:
if len(e) == 0:
continue
searchPrint(e, 1)
print "".join(result)
| 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s724696645 | p04044 | Runtime Error | N, L = raw_input().split()
l = []
for _ in range(N):
l.append(raw_input().strip())
print "".join(sorted(l)) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s018621055 | p04044 | Runtime Error | n, l = map(int, input().split())
s = []
for i in range(n):
t = input()
s.append(t)
s.sort()
print(s.join('')) | 3 3
dxx
axx
cxx
| axxcxxdxx
| <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Iroha has a sequence of <var>N</var> strings <var>S_1, S_2, ..., S_N</var>. The length of each string is <var>L</var>.</p>
<p>She will concatenate all of the strings in some order, to produce a long string.</p>
<p>Among all strings that she can produce in this way, find the lexicographically smallest one.</p>
<p>Here, a string <var>s=s_1s_2s_3</var>...<var>s_n</var> is <em>lexicographically smaller</em> than another string <var>t=t_1t_2t_3</var>...<var>t_m</var> if and only if one of the following holds:
<ul>
<li>There exists an index <var>i(1≦i≦min(n,m))</var>, such that <var>s_j = t_j</var> for all indices <var>j(1≦j<i)</var>, and <var>s_i<t_i</var>.</li>
<li><var>s_i = t_i</var> for all integers <var>i(1≦i≦min(n,m))</var>, and <var>n<m</var>.</li>
</ul></p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var>1 ≦ N, L ≦ 100</var></li>
<li>For each <var>i</var>, the length of <var>S_i</var> equals <var>L</var>.</li>
<li>For each <var>i</var>, <var>S_i</var> consists of lowercase letters.</li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>L</var>
<var>S_1</var>
<var>S_2</var>
:
<var>S_N</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the lexicographically smallest string that Iroha can produce.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>3 3
dxx
axx
cxx
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>axxcxxdxx
</pre>
<p>The following order should be used: <code>axx</code>, <code>cxx</code>, <code>dxx</code>.</p></section>
</div>
</span> |
s693222529 | p04045 | Wrong Answer | import math
total = list(map(lambda x: int(x), input().split()))
possible = list({0,1,2,3,4,5,6,7,8,9} - set(list(map(lambda x: int(x), input().split()))))
yen = [int(d) for d in str(total[0])]
i = 0
if yen[0] == 9 and 9 not in possible:
zeros = [0] * len(yen)
yen = [1] + zeros
print(int(''.join(map(str, yen))))
while i < len(yen):
if yen[i] not in possible:
if yen[i] == 9 and i != 0:
yen[i - 1] += 1
for i in range(i, len(yen)):
yen[i] = 0
elif yen[i] != 9:
for j in possible:
if j > i:
yen[i] = j
i = i + 1
print(int(''.join(map(str, yen))))
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s183304908 | p04045 | Wrong Answer | import math
total = list(map(lambda x: int(x), input().split()))
possible = list({0,1,2,3,4,5,6,7,8,9} - set(list(map(lambda x: int(x), input().split()))))
yen = [int(d) for d in str(total[0])]
for index, i in enumerate(yen):
if i not in possible:
for j in possible:
if j > i:
yen[index] = j
print(int(''.join(map(str, yen))))
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s784174888 | p04045 | Wrong Answer | n = list(map(int, input().split()))
a = list(map(int, input().split()))
c = [1,2,3,4,5,6,7,8,9]
b = list(set(a) ^ set(c))
print(b[0] * n[0]) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s818542899 | p04045 | Wrong Answer | n,thevailladadu = [int(x) for x in input().split()]
d = [int(x) for x in input().split()]
m = n
while(n>=10):
n=n//10
check = n
while check in d:
check=(check+1)%10
if check>n:
a = 0
while a in d:
a+=1
while check<m:
check=(check*10)+a
print(check)
elif check<n:
a=1
while a in d:
a+=1
b = 0
while b in d:
b+=1
while a<m:
a=(a*10)+b
print(a)
else:
i=0
ans=0
while (m>0):
a = m%10
#print(a)
while a in d:
a=(a+1)%10
ans+=(a*(10**i))
m//=10
i+=1
#if ans<m:
# j=1
# while j in d:
# j+=1
# ans+=(j*(10**i))
print(ans)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s990109675 | p04045 | Wrong Answer | n,thevailladadu = [int(x) for x in input().split()]
d = [int(x) for x in input().split()]
m = n
while(n>0):
n=n//10
check = n
while check in d:
check+=1
if check>n:
a = 0
while a in d:
a+=1
while check<m:
check=(check*10)+a
print(check)
else:
a=1
while a in d:
a+=1
b = 0
while b in d:
b+=1
while a<m:
a=(a*10)+b
print(a)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s985851436 | p04045 | Wrong Answer | n,thevailladadu = [int(x) for x in input().split()]
d = [int(x) for x in input().split()]
m = n
while(n>0):
n=n//10
check = n
while check in d:
check+=1
if check>n:
a = 0
while a in d:
a+=1
while n<m:
n=(n*10)+a
print(n)
else:
a=1
while a in d:
a+=1
b = 0
while b in d:
b+=1
while a<m:
a=(a*10)+b
print(a) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s717404441 | p04045 | Wrong Answer | n,thevailladadu = [int(x) for x in input().split()]
d = [int(x) for x in input().split()]
m = n
i=0
ans=0
while (n>0):
a = n%10
#print(a)
while a in d:
a=(a+1)%10
ans+=(a*(10**i))
n//=10
i+=1
if ans<m:
j=1
while j in d:
j+=1
ans+=(j*(10**i))
print(ans) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s199433730 | p04045 | Wrong Answer | import re
N, K = map(int, input().split())
unlike_list = set(map(str, input().split()))
unlike_nums = ''.join(unlike_list)
ans = False
while not ans:
if re.match(r'([' + unlike_nums + ']+)', str(N)):
N += 1
else:
ans = True
print(N) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s221938174 | p04045 | Wrong Answer | import re
N, K = map(int, input().split())
unlike_list = list(map(str, input().split()))
unlike_nums = ''.join(unlike_list)
ans = False
while not ans:
if re.match(r'([' + unlike_nums + ']+)', str(N)):
N += 1
else:
ans = True
print(N) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s423903445 | p04045 | Wrong Answer | def check(n,l):
r=str(n)
for i in range(len(r)):
if int(r[i]) not in l:
return 0
return 1
n,k=map(int,input().split())
c=set(map(int,input().split()))
d=set(range(0,10))
l=list(d-c)
index=1
while check(n,l)==0:
n+=n
print(n)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s132072223 | p04045 | Wrong Answer | import sys
import logging
logging.basicConfig(level=logging.DEBUG)
N,K=list(map(int,input().split()))
num=list(input().split())
i=0
while True:
for j in str(N+i):
#logging.debug('j={}'.format(j))
if j in num:
i+=1
break
else:
print(N+i)
sys.exit()
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s874431632 | p04045 | Wrong Answer | # N, Kの入力受付
N, K = map(int, input().split())
# Dの入力受付
D = set(input().split())
# 0-9とDの差集合作成、リスト化してEに代入
E = list({"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} - D)
# Eの要素の組み合わせのリストF作成、整数化
F = list((i+j+k+l+n) for i in E for j in E for k in E for l in E for n in E)
F = list(map(int, F))
# Fの要素でN以上の最小値を出力
result = min([m for m in F if m >= N])
print(result)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s931999846 | p04045 | Wrong Answer | # N, Kの入力受付
N, K = map(int, input().split())
# Dの入力受付
D = set(input().split())
# 0-9とDの差集合作成、リスト化してEに代入
E = list({"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} - D)
# Eの要素の組み合わせのリストF作成、整数化
F = list((i+j+k+l) for i in E for j in E for k in E for l in E)
F = list(map(int, F))
# Fの最大値10000追加
F.append(10000)
# Fの要素でN以上の最小値を出力
result = min([n for n in F if n >= N])
print(result) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s087394025 | p04045 | Wrong Answer | n, k= input().split()
l = list(map(int,input().split()))
checkNum=[i for i in range(11)]
def find(x):
while x!=checkNum[x]:
checkNum[x]=checkNum[checkNum[x]]
x=checkNum[x]
return x
for i in l:
checkNum[find(i)]=checkNum[find(i+1)]
fin=""
for i in range(len(n)):
first=int(n[i])
k=find(first)
if k==first:
fin+=str(k)
else:
if k!=10:
fin+=str(k)
i+=1
else:
fin=str(find(1))+str(find(0))*len(n)
break
print(fin)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s062688471 | p04045 | Wrong Answer | n, k= input().split()
l = list(map(int,input().split()))
checkNum=[i for i in range(11)]
def find(x):
while x!=checkNum[x]:
checkNum[x]=checkNum[checkNum[x]]
x=checkNum[x]
return x
for i in l:
checkNum[find(i)]=checkNum[find(i+1)]
fin=""
for i in range(len(n)):
first=int(n[i])
k=find(first)
if k==first:
fin+=str(k)
else:
if k!=10:
fin+=str(k)
i+=1
else:fin+=str(find(1))
fin+=str(find(0))*(len(n)-i)
break
print(fin)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s720194157 | p04045 | Wrong Answer | n, k= map(int,input().split())
l = list(map(int,input().split()))
checkNum=[i for i in range(11)]
def find(x):
while x!=checkNum[x]:
checkNum[x]=checkNum[checkNum[x]]
x=checkNum[x]
return x
for i in l:
checkNum[find(i)]=checkNum[find(i+1)]
fin=""
remain=0
if n==0:
fin=str(find(0))
while n>0 or remain>0:
last=n%10
k=find(last+remain)
remain=0
if k!=10:
fin=str(k)+fin
else:
remain+=1
fin=str(find(0))+fin
n//=10
print(fin)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s234909620 | p04045 | Wrong Answer | n, k= map(int,input().split())
l = list(map(int,input().split()))
checkNum=[i for i in range(11)]
for i in l:
checkNum[i]=checkNum[i+1]
def find(x):
while x!=checkNum[x]:
checkNum[x]=checkNum[checkNum[x]]
x=checkNum[x]
return x
fin=""
remain=0
while n>0 or remain>0:
last=n%10
k=find(last+remain)
remain=0
if k!=10:
fin=str(k)+fin
else:
remain+=1
fin=str(find(0))+fin
n//=10
print(fin)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s655488894 | p04045 | Wrong Answer | n, k= map(int,input().split())
l = list(map(int,input().split()))
checkNum=[i for i in range(11)]
for i in l:
checkNum[i]=checkNum[i+1]
def find(x):
while x!=checkNum[x]:
checkNum[x]=checkNum[checkNum[x]]
x=checkNum[x]
return x
fin=""
remain=0
while n>0 or remain>0:
last=n%10
k=find(last+remain)
remain=0
if last!=10:
fin=str(k)+fin
else:
remain+=1
fin=str(find(0))+fin
n//=10
print(fin)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s964174645 | p04045 | Wrong Answer | n, k = map(int, input().split())
dl = list(map(int, input().split()))
for i in range(n, 10001):
money = list(map(int, str(i)))
for m in money:
if dl.count(m) != 0:
break
else:
print(i)
break
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s831205852 | p04045 | Wrong Answer | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも!!
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
return list(map(int,readline().split()))
def readTuples():
return tuple(map(int,readline().split()))
def I():
return int(readline())
#dic = defaultdict(int)
n,k = readInts()
D = Counter(readInts())
def ok(n):
while n:
v = n%10
if D[v]:
return False
n //= 10
return True
ans = n
for i in range(n, 10000):
if ok(i):
ans = i
break
print(ans)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s088494854 | p04045 | Wrong Answer | from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from bisect import bisect_left,bisect_right
from math import sqrt,gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode
import sys
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
def mycol(data,col):
return [ row[col] for row in data ]
def mysort(data,col,reverse=False):
data.sort(key=lambda x:x[col],reverse=revese)
return data
def mymax(data):
M = -1*float('inf')
for i in range(len(data)):
m = max(data[i])
M = max(M,m)
return M
def mymin(data):
m = float('inf')
for i in range(len(data)):
M = min(data[i])
m = min(m,M)
return m
def mycount(ls,x):
# lsはソート済みであること
l = bisect_left(ls,x)
r = bisect_right(ls,x)
return (r-l)
def mydictvaluesort(dictionary):
return sorted( dictionary.items(), key=lambda x:x[1] )
def mydictkeysort(dictionary):
return sorted( dictionary.items(), key=lambda x:x[0] )
def myoutput(ls,space=True):
if space:
if len(ls)==0:
print(' ')
elif type(ls[0])==str:
print(' '.join(ls))
elif type(ls[0])==int:
print(' '.join(map(str,ls)))
else:
print('Output Error')
else:
if len(ls)==0:
print('')
elif type(ls[0])==str:
print(''.join(ls))
elif type(ls[0])==int:
print(''.join(map(str,ls)))
else:
print('Output Error')
def I():
return int(input())
def MI():
return map(int,input().split())
def RI():
return list(map(int,input().split()))
def CI(n):
return [ int(input()) for _ in range(n) ]
def LI(n):
return [ list(map(int,input().split())) for _ in range(n) ]
def S():
return input()
def MS():
return input().split()
def RS():
return list(input())
def CS(n):
return [ input() for _ in range(n) ]
def LS(n):
return [ list(input()) for _ in range(n) ]
# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())
mod = 10**9 + 7
n,k = MI()
d = RI()
for i in range(n,10000):
a = str(i)
flag = True
for j in a:
if int(j) in d:
flag = False
break
if flag:
print(i)
exit() | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s541625448 | p04045 | Wrong Answer | import sys
input = sys.stdin.readline
import math
def INT(): return int(input())
def MAPINT(): return map(int, input().split())
def LMAPINT(): return list(map(int, input().split()))
def STR(): return input()
def MAPSTR(): return map(str, input().split())
def LMAPSTR(): return list(map(str, input().split()))
f_inf = float('inf')
def main():
N, K = MAPINT()
D = LMAPSTR()
str_n = str(N)
for i in range(N, 10001):
str_i = str(i)
for s in str_i:
if s in D:
break
else:
print(str_i)
exit()
if __name__ == "__main__":
main()
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s098860158 | p04045 | Wrong Answer | import sys
input = sys.stdin.readline
import math
def INT(): return int(input())
def MAPINT(): return map(int, input().split())
def LMAPINT(): return list(map(int, input().split()))
def STR(): return input()
def MAPSTR(): return map(str, input().split())
def LMAPSTR(): return list(map(str, input().split()))
f_inf = float('inf')
def main():
N, K = MAPINT()
D = LMAPSTR()
str_n = str(N)
for i in range(N, 10000):
str_i = str(i)
for s in str_i:
if s in D:
break
else:
print(str_i)
exit()
if __name__ == "__main__":
main()
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s501167089 | p04045 | Wrong Answer | # coding:UTF-8
import sys
def resultSur97(x):
return x % (10 ** 9 + 7)
if __name__ == '__main__':
# ------ 入力 ------#
nk = list(map(int, input().split())) # スペース区切り連続数字
x = nk[1]
dList = list(map(int, input().split())) # スペース区切り連続数字
# ------ 処理 ------#
f = 0
n = nk[0]
while f == 0:
nList = [int(c) for c in str(n)] # 数字→単数字リスト変換
b = 1
for i in nList:
for j in dList:
if i == j:
b = 0
break
if b == 1:
break
else:
n += n
# ------ 出力 ------#
print("{}".format(n))
# if flg == 0:
# print("YES")
# else:
# print("NO")
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s461584495 | p04045 | Wrong Answer | N, K = map(int, input().split())
D = list(map(int, input().split()))
def f(n, x):
if n==0:
if x >= N:
print(x)
exit()
return
for i in range(10):
if i in D:
continue
f(n-1, x*10+i)
f(len(str(N)), 0)
ans = ""
for i in range(1, 10):
if i not in D:
ans = str(i)
for i in range(10):
if i not in D:
ans += str(i)*len(str(N))
print(ans) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s401485137 | p04045 | Wrong Answer |
n, k = map(int, input().split())
d = list(input().split())
def validate(strNum):
for i in range(0, len(strNum)):
if strNum[i] in d:
return False
return True
for i in range(0, 10001):
tf = validate(str(n))
# print(tf)
if tf:
print(n)
exit()
n += 1
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s682315422 | p04045 | Wrong Answer |
n, k = map(int, input().split())
d = list(input().split())
def validate(strNum):
for i in range(0, len(strNum)):
if strNum[i] in d:
return False
return True
for i in range(0, 1001):
tf = validate(str(n))
# print(tf)
if tf:
print(n)
exit()
n += 1
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s115385419 | p04045 | Wrong Answer | n,k = map(int,input().split())
if k == 0:
print(n)
exit()
dislike = list(map(int,input().split()))
ref = [0,1,2,3,4,5,6,7,8,9,0]
for i in range(10):
while ref[i] in dislike:
ref[i] = (ref[i]+1)%10
ans = ''
for i in str(n):
ans += str(ref[int(i)])
if int(ans)<n:
ans = str(ref[1])+str(ref[0])*len(str(n))
print(ans)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s359306644 | p04045 | Wrong Answer | n,k = map(int,input().split())
if k == 0:
print(n)
exit()
dislike = list(map(int,input().split()))
ref = [0,1,2,3,4,5,6,7,8,9,0]
for i in range(10):
while ref[i] in dislike:
ref[i] = (ref[i]+1)%10
ans = ''
for i in str(n):
ans += str(ref[int(i)])
if int(ans)<n:
ans = str(ref[1])+ans
print(ans)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s632994702 | p04045 | Wrong Answer | n,k = map(int,input().split())
if k == 0:
print(n)
exit()
dislike = list(map(int,input().split()))
usable = []
for i in range(10):
if i not in dislike:
usable.append(i)
print(usable)
ans = ''
for i in str(n):
while int(i) not in usable:
i = str((int(i)+1)%10)
ans+=i
print(ans) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s359279438 | p04045 | Wrong Answer | n,k = [int(x) for x in input().split()]
ds = {int(x) for x in input().split()}
ns = {0,1,2,3,4,5,6,7,8,9} -ds
#print(ds)
#print(ns-ds)
temp=0
d ={}
a=1
b = {}
m = len(str(n)) +1
over=False
while(a<=m and not over ):
c = []
d = 10**(a-1)
for v in ns:
if a>1:
for bv in b[a-1]:
t = v*d + bv
c += [t]
if t >= n:
print(t)
over=True
break
if over:
break
else:
c += [v*d]
b[a] = c
a+=1
#for j in b:
# print(j,b[j])
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s240432792 | p04045 | Wrong Answer | n,k = [int(x) for x in input().split()]
ds = {int(x) for x in input().split()}
ns = {0,1,2,3,4,5,6,7,8,9} -ds
#print(ds)
#print(ns-ds)
temp=0
d ={}
a=1
b = {}
m = len(str(n)) +1
over=False
while(a<m and not over ):
c = []
d = 10**(a-1)
for v in ns:
if a>1:
for bv in b[a-1]:
t = v*d + bv
if t >= n:
print(t)
over=True
break
c += [t]
if over:
break
else:
c += [v*d]
b[a] = c
a+=1
#for k in b:
# print(k,b[k])
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s031365592 | p04045 | Wrong Answer | N,K=map(int,input().split())
D=list(map(int,input().split()))
while True:
S=str(N)
flag=True
for x in S:
if x in D:
flag=False
if flag==True:
break;
N+=1
print(N) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s864500787 | p04045 | Wrong Answer | def answer(n: str, k: str, d: []) -> int:
numbers = list({0, 1, 2, 3, 4, 5, 6, 7, 8, 9} ^ set(d))
payment = ''
if int(str(numbers[-1]) * len(n)) < int(n):
if numbers[0] == 0:
payment = str(numbers[1]) + str('0' * len(n))
else:
payment = str(numbers[0]) * (len(n) + 1)
return int(payment)
for i in n:
for num in numbers:
if int(i) <= num:
payment += str(num)
break
return int(payment)
def main():
n, k = input().split()
d = map(int, input().split())
print(answer(n, k, d))
if __name__ == '__main__':
main() | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s589471485 | p04045 | Wrong Answer | from sys import stdin, stdout
from time import perf_counter
import sys
sys.setrecursionlimit(10**9)
mod = 10**9+7
n,k = map(int,input().split())
d= list(map(int,input().split()))
test = [1,2,3,4,5,6,7,8,9]
for item in range(k):
if d[item]==0:
print(n)
exit()
result =[]
for item in test:
if item not in d:
result.append(item)
n= list(str(n))
# final_result =[]
for item in range(len(n)):
if int(n[item])>0:
if n[item] != result[0]:
n[item] = str(result[0])
ans = "".join(n)
print(ans)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s918752508 | p04045 | Wrong Answer | def price(N,K):
Kn = input().split()
Flag = False
for i in range(N,10001,1):
value = str(i)
for j in range(K):
if(Kn[j] not in value):
Flag = True
elif(Kn[j] in value):
Flag = False
break
if(Flag == True):
print(i)
break
N,K = (int(x) for x in input().split()) # N,K 入力
price(N,K) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s388577234 | p04045 | Wrong Answer | import sys
N , K = map(int,input().split())
D = list(map(int,input().split()))
L = [i for i in range(10)]
for i in D:
L.remove(i)
c = []
for i1 in L:
for i2 in L:
for i3 in L:
for i4 in L:
k = i1*1000 + i2*100 + i3*10 + i4
c.append(k)
c.sort()
for i in range(len(c)):
if c[i] >= N:
print(c[i])
sys.exit() | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s435241807 | p04045 | Wrong Answer | N, K = map(int, input().split())
Ds = list(map(int, input().split()))
N2 = ''
for d in str(N):
intd = int(d)
for i in range(intd, 10):
if not i in Ds:
N2 += str(i)
break
print(N2)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s500363690 | p04045 | Wrong Answer | n, k = map(int, input().split())
d = list(input().split())
n = 1000
flag = True
while flag:
flag2 = True
for si in str(n):
if si in d:
n += 1
flag2 = False
break
if flag2:
break
else:
flag = True
print(n) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s568531030 | p04045 | Wrong Answer | n, k = map(int, input().split())
d = list(input().split())
#n = 1000
flag1 = True
while flag1:
for si in str(n):
if si in d:
n += 1
break
flag1 = False
print(n)
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s742625047 | p04045 | Wrong Answer | n, k = map(int, input().split())
d = list(input().split())
#n = 1000
flag1 = True
while flag1:
for si in str(n):
if si in d:
n += 1
break
flag1 = False
print(n) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s508332621 | p04045 | Wrong Answer | n, k = map(int, input().split())
d = list(input().split())
num = [str(i) for i in range(10)]
for i in range(k):
num.remove(d[i])
import itertools, heapq
ans = []
heapq.heapify(ans)
for i in itertools.product(num, repeat=len(str(n))):
s = int(''.join(i))
if s >= n:
heapq.heappush(ans, -s)
if len(ans) == 0:
for i in itertools.product(num, repeat=len(str(n)) + 1):
s = int(''.join(i))
if s >= n:
heapq.heappush(ans, -s)
print(-heapq.heappop(ans))
else:
print(-heapq.heappop(ans)) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s117534367 | p04045 | Wrong Answer | n, k = map(int, input().split())
d = list(input().split())
num = [str(i) for i in range(10)]
for i in range(k):
num.remove(d[i])
import itertools, heapq
ans = []
heapq.heapify(ans)
for i in itertools.product(num, repeat=len(str(n))):
s = int(''.join(i))
if s >= n:
heapq.heappush(ans, -s)
if len(ans) == 0:
for i in itertools.product(num, repeat=len(str(n)) + 1):
s = int(''.join(i))
if s >= n:
heapq.heappush(ans, -s)
print(-heapq.heappop(ans))
else:
print(-heapq.heappop(ans))
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s411257000 | p04045 | Wrong Answer | import sys
from bisect import bisect_left
def input(): return sys.stdin.readline().strip()
def main():
N, K = map(int, input().split())
D = set(map(int, input().split()))
ok = [i for i in range(10) if i not in D]
N = str(N)
l = len(N)
if int(str(ok[-1]) * l) < int(N):
if ok[0] == 0:
ans = ok[1] * 10 ** l
print(ans)
else:
ans = str(ok[0]) * (l + 1)
print(ans)
else:
kuriagari = False
ans = 0
for i, c in enumerate(N):
ans *= 10
if kuriagari and ok[-1] < int(c):
ans += ok[0]
elif kuriagari:
idx = bisect_left(ok, int(c))
ans += ok[idx]
elif ok[-1] < int(c):
cnt = 0
ans //= 10
while ok[-1] <= ans % 10:
ans //= 10
cnt += 1
last = ans % 10
idx = bisect_left(ok, last + 1)
ans = (ans // 10) * 10 + ok[idx]
for _ in range(cnt):
ans = ans * 10 + ok[0]
kuriagari = True
else:
idx = bisect_left(ok, int(c))
ans += ok[idx]
print(ans)
if __name__ == "__main__":
main()
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s445735805 | p04045 | Wrong Answer | import sys
from bisect import bisect_left
def input(): return sys.stdin.readline().strip()
def main():
N, K = map(int, input().split())
D = set(map(int, input().split()))
ok = [i for i in range(10) if i not in D]
N = str(N)
l = len(N)
if int(str(ok[-1]) * l) < int(N):
if ok[0] == 0:
ans = ok[1] * 10 ** l
print(ans)
else:
ans = str(ok[0]) * (l + 1)
print(ans)
else:
kuriagari = False
ans = 0
for i, c in enumerate(N):
ans *= 10
if kuriagari and ok[-1] < c:
ans += ok[0]
elif kuriagari:
idx = bisect_left(ok, int(c))
ans += ok[idx]
elif ok[-1] < int(c):
cnt = 0
ans //= 10
while ok[-1] <= ans % 10:
ans //= 10
cnt += 1
last = ans % 10
idx = bisect_left(ok, last + 1)
ans = (ans // 10) * 10 + ok[idx]
for _ in range(cnt + 1):
ans = ans * 10 + ok[0]
kuriagari = True
else:
idx = bisect_left(ok, int(c))
ans += ok[idx]
print(ans)
if __name__ == "__main__":
main()
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s348119307 | p04045 | Wrong Answer | import sys
from bisect import bisect_left
def input(): return sys.stdin.readline().strip()
def main():
N, K = map(int, input().split())
D = set(map(int, input().split()))
ok = [i for i in range(10) if i not in D]
N = str(N)
l = len(N)
if int(str(ok[-1]) * l) < int(N):
if ok[0] == 0:
ans = ok[1] * 10 ** l
print(ans)
else:
ans = str(ok[0]) * (l + 1)
print(ans)
else:
kuriagari = False
ans = 0
for i, c in enumerate(N):
ans *= 10
if kuriagari and ok[-1] < c:
ans += ok[0]
elif kuriagari:
idx = bisect_left(ok, int(c))
ans += ok[idx]
elif ok[-1] < int(c):
cnt = 0
ans //= 10
while ok[-1] <= ans % 10:
ans //= 10
cnt += 1
last = ans % 10
idx = bisect_left(ok, last + 1)
ans = (ans // 10) * 10 + ok[idx]
for _ in range(cnt):
ans = ans * 10 + ok[0]
kuriagari = True
else:
idx = bisect_left(ok, int(c))
ans += ok[idx]
print(ans)
if __name__ == "__main__":
main()
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s552752155 | p04045 | Wrong Answer | N, K = [int(x) for x in input().split()]
dislikes = [False] * 10
dislike_nums = [int(x) for x in input().split()]
for n in dislike_nums:
dislikes[n] = True
# Add '0' in the beginning of N for carrying up
N = "0" + str(N)
# Create a list of numbers consists N
n_list = []
for n in N:
n_list.append(int(n))
# Create a list of carrying up numbers
c_list = [0] * len(n_list)
# Create the smallest payment
payment = ""
for i in range(len(n_list) - 1, -1, -1):
n = n_list[i] + c_list[i]
if i == 0 and n == 0:
break
# Find an equal or larger number than n and not in dislikes
x = -1
for m in range(n, 10):
if not dislikes[m]:
x = m
break
if x >= 0:
# found a number
payment = str(m) + payment
continue
# Carry a number to the previous (x10) digit
if i > 0:
c_list[i - 1] += 1
# Find a smaller number than n and not in dislikes
for m in range(0, n):
if not dislikes[m]:
payment = str(m) + payment
break
print(int(payment)) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s573768164 | p04045 | Wrong Answer | N, K = [int(x) for x in input().split()]
dislikes = [False] * 10
dislike_nums = [int(x) for x in input().split()]
for n in dislike_nums:
dislikes[n] = True
# Add '0' in the beginning of N for carrying up
N = "0" + str(N)
# Create a list of numbers consists N
n_list = []
for n in N:
n_list.append(int(n))
# Create a list of carrying up numbers
c_list = [0] * len(n_list)
# Create the smallest payment
payment = ""
for i in range(len(n_list) - 1, -1, -1):
n = n_list[i] + c_list[i]
if i == 0 & n == 0:
break
# Find an equal or larger number than n and not in dislikes
x = -1
for m in range(n, 10):
if not dislikes[m]:
x = m
break
if x >= 0:
# found a number
payment = str(m) + payment
continue
# Carry a number to the previous (x10) digit
if i > 0:
c_list[i - 1] += 1
# Find a smaller number than n and not in dislikes
for m in range(0, n):
if not dislikes[m]:
payment = str(m) + payment
break
print(int(payment)) | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s639377712 | p04045 | Wrong Answer | def minN(N:int, usable:list, restrict=True):
usable.sort()
if restrict:
for i in usable:
if i >= N:
return str(i)
# 桁が増えるとき
if usable[0] != 0:
return str(usable[0]) + str(usable[0])
else:
return str(usable[1]) + str(usable[0])
else:
return str(usable[0])
def main():
N, K = map(int, input().split())
D = set(map(int, input().split()))
numset = set(range(0,10))
d = list(numset.difference(D))
d.sort()
Nstr = list(str(N))
ans = ''
flag = True
for n in Nstr:
n = int(n)
if flag:
if n in D:
ans += minN(n, d)
flag = False
else:
ans += str(n)
else:
ans += str(min(d))
print(int(ans))
if __name__ == "__main__":
main()
| 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s621358068 | p04045 | Wrong Answer | n, k = map(int, input().split())
D = set(map(int, input().split()))
if k == 9:
print(n+1)
exit(0)
for ans in range(n,10000):
for c in str(ans):
if int(c) in D:
break
else:
print(ans)
break | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s383450057 | p04045 | Wrong Answer | n, k = map(int, input().split())
D = set(map(int, input().split()))
if k == 9:
print(n)
exit(0)
for ans in range(n,10000):
for c in str(ans):
if int(c) in D:
break
else:
print(ans)
break | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
s752563022 | p04045 | Wrong Answer | n, k = map(int, input().split())
D = set(map(int, input().split()))
if k == 0 or 9:
print(n)
exit(0)
for ans in range(n,10000):
for c in str(ans):
if int(c) in D:
break
else:
print(ans)
break | 1000 8
1 3 4 5 6 7 8 9
| 2000
| <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> yen (the currency of Japan), thus she has to hand at least <var>N</var> yen to the cashier (and possibly receive the change).</p>
<p>However, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.</p>
<p>Find the amount of money that she will hand to the cashier.</p>
</section>
</div>
<div class="part">
<section>
<h3>Constraints</h3><ul>
<li><var> 1 ≦ N < 10000</var></li>
<li><var> 1 ≦ K < 10</var></li>
<li><var> 0 ≦ D_1 < D_2 < … < D_K≦9</var></li>
<li><var>\{D_1,D_2,...,D_K\} ≠ \{1,2,3,4,5,6,7,8,9\}</var></li>
</ul>
</section>
</div>
<hr/>
<div class="io-style">
<div class="part">
<section>
<h3>Input</h3><p>The input is given from Standard Input in the following format:</p>
<pre><var>N</var> <var>K</var>
<var>D_1</var> <var>D_2</var> … <var>D_K</var>
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Output</h3><p>Print the amount of money that Iroha will hand to the cashier.</p>
</section>
</div>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 1</h3><pre>1000 8
1 3 4 5 6 7 8 9
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 1</h3><pre>2000
</pre>
<p>She dislikes all digits except <var>0</var> and <var>2</var>.</p>
<p>The smallest integer equal to or greater than <var>N=1000</var> whose decimal notation contains only <var>0</var> and <var>2</var>, is <var>2000</var>.</p>
</section>
</div>
<hr/>
<div class="part">
<section>
<h3>Sample Input 2</h3><pre>9999 1
0
</pre>
</section>
</div>
<div class="part">
<section>
<h3>Sample Output 2</h3><pre>9999
</pre></section>
</div>
</span> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.