message stringlengths 2 433k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 113 108k | cluster float64 12 12 | __index_level_0__ int64 226 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of which is calculated as follows: ci = bi - ai.
... | instruction | 0 | 84,679 | 12 | 169,358 |
Tags: binary search, brute force, constructive algorithms, greedy, sortings
Correct Solution:
```
from operator import itemgetter
n, l, r = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
A = sorted([[a[i], p[i], i, 0] for i in range(n)], key = itemgetter(1... | output | 1 | 84,679 | 12 | 169,359 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of which is calculated as follows: ci = bi - ai.
... | instruction | 0 | 84,680 | 12 | 169,360 |
Tags: binary search, brute force, constructive algorithms, greedy, sortings
Correct Solution:
```
n, l, r = map(int, input().split())
a = list(map(int, input().split()))
p = list(map(int, input().split()))
seg = [0] * n
for i in range(n):
seg[i] = [l - a[i], r - a[i]]
segments = [0] * n
for i in range(n):
... | output | 1 | 84,680 | 12 | 169,361 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of which is calculated as follows: ci = bi - ai.
... | instruction | 0 | 84,681 | 12 | 169,362 |
Tags: binary search, brute force, constructive algorithms, greedy, sortings
Correct Solution:
```
f = lambda: map(int, input().split())
n, l, r = f()
b = [x + y for x, y in zip(f(), f())]
u, v = l - min(b), r - max(b)
print(-1 if u > v else ' '.join(str(q + u) for q in b))
``` | output | 1 | 84,681 | 12 | 169,363 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of which is calculated as follows: ci = bi - ai.
... | instruction | 0 | 84,682 | 12 | 169,364 |
Tags: binary search, brute force, constructive algorithms, greedy, sortings
Correct Solution:
```
n,l,r=map(int,input().split())
a=[int(i) for i in input().split()]
p=[int(i) for i in input().split()]
#p is compressed form of c
b=[a[i]+p[i] for i in range(n)]
m1=min(b)
m2=max(b)
if r-l+1<m2-m1+1:
print(-1)
exi... | output | 1 | 84,682 | 12 | 169,365 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of which is calculated as follows: ci = bi - ai.
... | instruction | 0 | 84,683 | 12 | 169,366 |
Tags: binary search, brute force, constructive algorithms, greedy, sortings
Correct Solution:
```
n, l, r = map(int, input().split())
a = map(int, input().split())
p = map(int, input().split())
b = list(map(lambda x: sum(x), zip(a,p)))
minb = min(b)
maxb = max(b)
if maxb - minb > r - l:
print(-1)
else:
print(... | output | 1 | 84,683 | 12 | 169,367 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of which is calculated as follows: ci = bi - ai.
... | instruction | 0 | 84,684 | 12 | 169,368 |
Tags: binary search, brute force, constructive algorithms, greedy, sortings
Correct Solution:
```
import sys
N, L, R = map(int, input().split())
a = list(map(int, input().split()))
b = [0] * N
c = list(map(int, input().split()))
d = [i for i in range(N)]
z = [list(t) for t in zip(c, a, b, d)]
z = sorted(z)
z[0][2] =... | output | 1 | 84,684 | 12 | 169,369 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of which is calculated as follows: ci = bi - ai.
... | instruction | 0 | 84,685 | 12 | 169,370 |
Tags: binary search, brute force, constructive algorithms, greedy, sortings
Correct Solution:
```
import math, re, itertools as it;prime = lambda n: len([i for i in range(2, int(math.sqrt(n) + 1)) if n % i == 0]) == 0;gcd = lambda a, b: gcd(b, a % b) if b else a;fact = lambda x: x * fact(x - 1) if x else 1;bino = lambd... | output | 1 | 84,685 | 12 | 169,371 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of which is calculated as follows: ci = bi - ai.
... | instruction | 0 | 84,686 | 12 | 169,372 |
Tags: binary search, brute force, constructive algorithms, greedy, sortings
Correct Solution:
```
n, l, r = list(map(int, input().split()))
a = list(map(int, input().split()))
p = list(map(int, input().split()))
s = set()
x = []
for i in range(len(a)):
x.append([p[i], i])
x.sort()
mx = -1000000000000
for i in range(... | output | 1 | 84,686 | 12 | 169,373 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of... | instruction | 0 | 84,687 | 12 | 169,374 |
Yes | output | 1 | 84,687 | 12 | 169,375 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of... | instruction | 0 | 84,688 | 12 | 169,376 |
Yes | output | 1 | 84,688 | 12 | 169,377 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of... | instruction | 0 | 84,689 | 12 | 169,378 |
Yes | output | 1 | 84,689 | 12 | 169,379 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of... | instruction | 0 | 84,690 | 12 | 169,380 |
Yes | output | 1 | 84,690 | 12 | 169,381 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of... | instruction | 0 | 84,691 | 12 | 169,382 |
No | output | 1 | 84,691 | 12 | 169,383 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of... | instruction | 0 | 84,692 | 12 | 169,384 |
No | output | 1 | 84,692 | 12 | 169,385 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of... | instruction | 0 | 84,693 | 12 | 169,386 |
No | output | 1 | 84,693 | 12 | 169,387 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dasha logged into the system and began to solve problems. One of them is as follows:
Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of... | instruction | 0 | 84,694 | 12 | 169,388 |
No | output | 1 | 84,694 | 12 | 169,389 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step to be done...
You are given an array of integer... | instruction | 0 | 84,695 | 12 | 169,390 |
Tags: *special, implementation
Correct Solution:
```
a=123**511211
print(*sorted(list(map(int,input().split()))[1:]))
``` | output | 1 | 84,695 | 12 | 169,391 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step to be done...
You are given an array of integer... | instruction | 0 | 84,696 | 12 | 169,392 |
Tags: *special, implementation
Correct Solution:
```
import time
a=input().split()
n=int(a[0])
del(a[0])
a=map(int,a)
a=sorted(a)
b=[10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30,10,30]
for i in range(250... | output | 1 | 84,696 | 12 | 169,393 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step to be done...
You are given an array of integer... | instruction | 0 | 84,697 | 12 | 169,394 |
Tags: *special, implementation
Correct Solution:
```
cnt=1234**456789
print(*sorted([*map(int,input().split())][1:]))
``` | output | 1 | 84,697 | 12 | 169,395 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step to be done...
You are given an array of integer... | instruction | 0 | 84,698 | 12 | 169,396 |
Tags: *special, implementation
Correct Solution:
```
# coding: utf-8
from time import time
initial = time()
while time() - initial < 1:
continue
a = sorted(list(map(int, input().split()))[1:])
print(*a, sep = ' ')
``` | output | 1 | 84,698 | 12 | 169,397 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step to be done...
You are given an array of integer... | instruction | 0 | 84,699 | 12 | 169,398 |
Tags: *special, implementation
Correct Solution:
```
import time
kal = list(map(int,input().split()))
p = kal[1:]
kaleee = []
for i in range(6300):
kaleee.append(i)
kaleee.count(i)
p.sort()
for i in p:
print(i,end=' ')
``` | output | 1 | 84,699 | 12 | 169,399 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step to be done...
You are given an array of integer... | instruction | 0 | 84,700 | 12 | 169,400 |
Tags: *special, implementation
Correct Solution:
```
a = [int(x) for x in input().split()]
del a[0]
k = 7777777 ** 66666
k = 7777777 ** 66666
k = 7777777 ** 66666
k = 7777777 ** 66666
k = 7777777 ** 66666
print(*sorted(a))
``` | output | 1 | 84,700 | 12 | 169,401 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step to be done...
You are given an array of integer... | instruction | 0 | 84,701 | 12 | 169,402 |
Tags: *special, implementation
Correct Solution:
```
import time
now=time.time()
a=list(map(int,input().split()))
len=a[0]
a=a[1:]
a.sort()
while time.time()<(now+0.987):
pass
for i in range(len):
print(a[i],end=" ")
``` | output | 1 | 84,701 | 12 | 169,403 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step to be done...
You are given an array of integer... | instruction | 0 | 84,702 | 12 | 169,404 |
Tags: *special, implementation
Correct Solution:
```
import time
t0=time.time()
while time.time()-t0<1:
continue
print(*sorted(list(map(int,input().split()))[1:]))
``` | output | 1 | 84,702 | 12 | 169,405 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step t... | instruction | 0 | 84,703 | 12 | 169,406 |
Yes | output | 1 | 84,703 | 12 | 169,407 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step t... | instruction | 0 | 84,704 | 12 | 169,408 |
Yes | output | 1 | 84,704 | 12 | 169,409 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step t... | instruction | 0 | 84,705 | 12 | 169,410 |
Yes | output | 1 | 84,705 | 12 | 169,411 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step t... | instruction | 0 | 84,706 | 12 | 169,412 |
No | output | 1 | 84,706 | 12 | 169,413 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step t... | instruction | 0 | 84,707 | 12 | 169,414 |
No | output | 1 | 84,707 | 12 | 169,415 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step t... | instruction | 0 | 84,708 | 12 | 169,416 |
No | output | 1 | 84,708 | 12 | 169,417 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are developing a new feature for the website which sells airline tickets: being able to sort tickets by price! You have already extracted the tickets' prices, so there's just the last step t... | instruction | 0 | 84,709 | 12 | 169,418 |
No | output | 1 | 84,709 | 12 | 169,419 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be e... | instruction | 0 | 84,782 | 12 | 169,564 |
Tags: dp
Correct Solution:
```
n = int(input())
s = list(map(int,input().split()))
rl = {}
best_range = range(0)
for x in s:
run = rl[x] = rl.get(x-1, 0) + 1
r = range(x-run+1, x+1)
if len(r) > len(best_range):
best_range = r
res = list(best_range)
size = len(res)
output = []
pointer = 0
for i,c in ... | output | 1 | 84,782 | 12 | 169,565 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be e... | instruction | 0 | 84,783 | 12 | 169,566 |
Tags: dp
Correct Solution:
```
n=int(input())
d={}
l=list(map(int,input().split()))
val=0
ma=0
for i in range(n) :
d[l[i]]=1+d.get(l[i]-1,0)
if d[l[i]]>ma :
ma=d[l[i]]
val=l[i]
print(ma)
ans=[]
for i in range(n-1,-1,-1) :
if l[i]==val :
ans.append(i+1)
val-=1
ans=ans[::... | output | 1 | 84,783 | 12 | 169,567 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be e... | instruction | 0 | 84,784 | 12 | 169,568 |
Tags: dp
Correct Solution:
```
import sys, math
input = lambda :sys.stdin.readline().rstrip()
I=lambda:[*map(int,input().split())]
n,=I() ; lis=I()
from collections import defaultdict
dp = defaultdict(int) ; mx = None ; mxcnt = -1 << 64
ind = defaultdict(int)
for i in range(n):
dp[lis[i]] = dp[lis[i] - 1] + 1
i... | output | 1 | 84,784 | 12 | 169,569 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be e... | instruction | 0 | 84,785 | 12 | 169,570 |
Tags: dp
Correct Solution:
```
n = int(input())
a = [int(x) for x in input().split()]
dic={}
f=[]
for i in range(n):
if a[i]-1 in dic:
f.append(dic[a[i]-1]+1)
else:
f.append(1)
if a[i] in dic:
dic[a[i]] = max(dic[a[i]],f[i])
else:
dic[a[i]] = f[i]
ans = max(f)
print(ans)
... | output | 1 | 84,785 | 12 | 169,571 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be e... | instruction | 0 | 84,786 | 12 | 169,572 |
Tags: dp
Correct Solution:
```
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
from sys import stdin, stdout
import math
#T = int(input())
N = int(input())
#s = input()
#N,M = [int(x) for x in stdin.readline().split()]
arr = [int(x) for x in stdin.re... | output | 1 | 84,786 | 12 | 169,573 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be e... | instruction | 0 | 84,787 | 12 | 169,574 |
Tags: dp
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
dp = dict()
for ai in a:
if ai not in dp:
dp[ai] = 0
if ai - 1 in dp:
dp[ai] = max(dp[ai], 1 + dp[ai - 1])
k = max(dp.values())
print(k + 1)
pos = -1
for ai in a:
if dp[ai] == k:
pos = ai
idx = []
fo... | output | 1 | 84,787 | 12 | 169,575 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be e... | instruction | 0 | 84,788 | 12 | 169,576 |
Tags: dp
Correct Solution:
```
n = int(input())
G = list(map(int,input().split()))
D = {}
M = 0
for i in G:
if i-1 in D:
D[i] = D[i-1] + 1
else:
D[i] = 1
if D[i]>M:
M = D[i]
Mi = i
#print(M,Mi)
R = []
A = Mi
for i in range(len(G)-1,-1,-1):
if G[i] == A:
R.append(i... | output | 1 | 84,788 | 12 | 169,577 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be e... | instruction | 0 | 84,789 | 12 | 169,578 |
Tags: dp
Correct Solution:
```
import sys
from collections import defaultdict
def solve(io):
N = io.readInt()
A = io.readIntArray(N)
prev = [-1] * N
size = [1] * N
last = defaultdict(lambda: -1)
for i in range(0, N):
idx = last[A[i] - 1]
if idx >= 0:
prev[i] = idx
size[i] = 1 + size[idx]
last[A[i... | output | 1 | 84,789 | 12 | 169,579 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. I... | instruction | 0 | 84,790 | 12 | 169,580 |
Yes | output | 1 | 84,790 | 12 | 169,581 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. I... | instruction | 0 | 84,791 | 12 | 169,582 |
Yes | output | 1 | 84,791 | 12 | 169,583 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. I... | instruction | 0 | 84,792 | 12 | 169,584 |
Yes | output | 1 | 84,792 | 12 | 169,585 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. I... | instruction | 0 | 84,793 | 12 | 169,586 |
Yes | output | 1 | 84,793 | 12 | 169,587 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. I... | instruction | 0 | 84,794 | 12 | 169,588 |
No | output | 1 | 84,794 | 12 | 169,589 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. I... | instruction | 0 | 84,795 | 12 | 169,590 |
No | output | 1 | 84,795 | 12 | 169,591 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. I... | instruction | 0 | 84,796 | 12 | 169,592 |
No | output | 1 | 84,796 | 12 | 169,593 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer array of length n.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. I... | instruction | 0 | 84,797 | 12 | 169,594 |
No | output | 1 | 84,797 | 12 | 169,595 |
Provide a correct Python 3 solution for this coding contest problem.
For given a sequence $A = \\{a_0, a_1, ..., a_{n-1}\\}$, print the previous permutation and the next permutation in lexicographic order.
Constraints
* $1 \leq n \leq 9$
* $a_i$ consist of $1, 2, ..., n$
Input
A sequence is given in the following ... | instruction | 0 | 84,996 | 12 | 169,992 |
"Correct Solution:
```
from itertools import permutations
n = int(input())
arr = tuple(map(int, input().split()))
p = list(permutations(sorted(arr)))
idx = p.index(arr)
for i in range(max(0, idx - 1), min(len(p), idx + 2), 1):
print(*p[i])
``` | output | 1 | 84,996 | 12 | 169,993 |
Provide a correct Python 3 solution for this coding contest problem.
For given a sequence $A = \\{a_0, a_1, ..., a_{n-1}\\}$, print the previous permutation and the next permutation in lexicographic order.
Constraints
* $1 \leq n \leq 9$
* $a_i$ consist of $1, 2, ..., n$
Input
A sequence is given in the following ... | instruction | 0 | 84,997 | 12 | 169,994 |
"Correct Solution:
```
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
N = int(input())
table = [None] * N
check = [False] * (N+1)
MAP = {}
rev_MAP = {}
perm_index = 0
def recursive... | output | 1 | 84,997 | 12 | 169,995 |
Provide a correct Python 3 solution for this coding contest problem.
For given a sequence $A = \\{a_0, a_1, ..., a_{n-1}\\}$, print the previous permutation and the next permutation in lexicographic order.
Constraints
* $1 \leq n \leq 9$
* $a_i$ consist of $1, 2, ..., n$
Input
A sequence is given in the following ... | instruction | 0 | 84,998 | 12 | 169,996 |
"Correct Solution:
```
import itertools
n = int(input())
num = list(map(int, input().split()))
per = list(itertools.permutations(num))
per.sort()
index = per.index(tuple(num))
if index != 0:
print(' '.join(str(n) for n in per[index-1]))
print(' '.join(str(n) for n in per[index]))
if index != len(per)-1:
prin... | output | 1 | 84,998 | 12 | 169,997 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.