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
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to ...
instruction
0
38,852
12
77,704
No
output
1
38,852
12
77,705
Provide tags and a correct Python 3 solution for this coding contest problem. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations. A permutation a_1, a_2, ..., a_n of 1, 2, .....
instruction
0
38,901
12
77,802
Tags: binary search, combinatorics, constructive algorithms, implementation Correct Solution: ``` import sys input = sys.stdin.readline t = int(input()) for _ in range(t): n, k = map(int, input().split()) k -= 1 p = [i + 1 for i in range(n)] x = 1 sw = [] for i in range(n - 2, -1, -1): ...
output
1
38,901
12
77,803
Provide tags and a correct Python 3 solution for this coding contest problem. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations. A permutation a_1, a_2, ..., a_n of 1, 2, .....
instruction
0
38,902
12
77,804
Tags: binary search, combinatorics, constructive algorithms, implementation Correct Solution: ``` t = int(input()) for _ in range(t): n, k = [int(x) for x in input().split()] if (k > 1 << (n-1)): print(-1) continue ans = [] i = 1 while (i <= n): l = 0 while i < n and ...
output
1
38,902
12
77,805
Provide tags and a correct Python 3 solution for this coding contest problem. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations. A permutation a_1, a_2, ..., a_n of 1, 2, .....
instruction
0
38,903
12
77,806
Tags: binary search, combinatorics, constructive algorithms, implementation Correct Solution: ``` import sys,io,os try:Z=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline except:Z=lambda:sys.stdin.readline().encode() O=[] for _ in range(int(Z())): n,k=map(int,Z().split());k-=1 if k.bit_length()>=n:O.append('-...
output
1
38,903
12
77,807
Provide tags and a correct Python 3 solution for this coding contest problem. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations. A permutation a_1, a_2, ..., a_n of 1, 2, .....
instruction
0
38,904
12
77,808
Tags: binary search, combinatorics, constructive algorithms, implementation Correct Solution: ``` import sys input = sys.stdin.readline t = int(input()) for _ in range(t): n, k = map(int, input().split()) k -= 1 out = [] curr = [1] todo = [] for i in range(n - 1): todo.append(k % 2) ...
output
1
38,904
12
77,809
Provide tags and a correct Python 3 solution for this coding contest problem. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations. A permutation a_1, a_2, ..., a_n of 1, 2, .....
instruction
0
38,905
12
77,810
Tags: binary search, combinatorics, constructive algorithms, implementation Correct Solution: ``` from bisect import * from collections import * from math import gcd,ceil,sqrt,floor,inf from heapq import * from itertools import * from operator import add,mul,sub,xor,truediv,floordiv from functools import * #--------...
output
1
38,905
12
77,811
Provide tags and a correct Python 3 solution for this coding contest problem. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations. A permutation a_1, a_2, ..., a_n of 1, 2, .....
instruction
0
38,906
12
77,812
Tags: binary search, combinatorics, constructive algorithms, implementation Correct Solution: ``` import sys input = sys.stdin.readline for f in range(int(input())): n,k=map(int,input().split()) b=bin(k-1)[2:] if k-1: b+="0" if len(b)>n: print(-1) else: b="0"*(n-len(b))+b ...
output
1
38,906
12
77,813
Provide tags and a correct Python 3 solution for this coding contest problem. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations. A permutation a_1, a_2, ..., a_n of 1, 2, .....
instruction
0
38,907
12
77,814
Tags: binary search, combinatorics, constructive algorithms, implementation Correct Solution: ``` it = int(input()) for _ in range(it): n, k = map(int, input().split()) if n < 64 and 2 ** (n-1) < k: print(-1) else: l = n c = 1 ans = [] while l > 0: z = 1 ...
output
1
38,907
12
77,815
Provide tags and a correct Python 3 solution for this coding contest problem. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations. A permutation a_1, a_2, ..., a_n of 1, 2, .....
instruction
0
38,908
12
77,816
Tags: binary search, combinatorics, constructive algorithms, implementation Correct Solution: ``` def divisors(M): d=[] i=1 while M>=i**2: if M%i==0: d.append(i) if i**2!=M: d.append(M//i) i=i+1 return d def popcount(x): x = x - ((x >> 1) & 0x...
output
1
38,908
12
77,817
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations...
instruction
0
38,909
12
77,818
Yes
output
1
38,909
12
77,819
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations...
instruction
0
38,910
12
77,820
Yes
output
1
38,910
12
77,821
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations...
instruction
0
38,911
12
77,822
Yes
output
1
38,911
12
77,823
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations...
instruction
0
38,912
12
77,824
Yes
output
1
38,912
12
77,825
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations...
instruction
0
38,913
12
77,826
No
output
1
38,913
12
77,827
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations...
instruction
0
38,914
12
77,828
No
output
1
38,914
12
77,829
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations...
instruction
0
38,915
12
77,830
No
output
1
38,915
12
77,831
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations...
instruction
0
38,916
12
77,832
No
output
1
38,916
12
77,833
Provide tags and a correct Python 3 solution for this coding contest problem. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row is a permutation of the numbers 1,2,3,…,n. The ...
instruction
0
38,917
12
77,834
Tags: combinatorics, dfs and similar, dp, dsu, graphs, math Correct Solution: ``` t=int(input()) mod = 10**9+7 vis=[] for _ in range(t): n=int(input()) a=[] a.append(list(map(int,input().split()))) a.append(list(map(int,input().split()))) vis = [0 for i in range(n+1)] e={} d=0 for ...
output
1
38,917
12
77,835
Provide tags and a correct Python 3 solution for this coding contest problem. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row is a permutation of the numbers 1,2,3,…,n. The ...
instruction
0
38,918
12
77,836
Tags: combinatorics, dfs and similar, dp, dsu, graphs, math Correct Solution: ``` from sys import stdin,stdout import math, bisect, heapq from collections import Counter, deque, defaultdict L = lambda: list(map(int, stdin.readline().strip().split())) I = lambda: int(stdin.readline().strip()) S = lambda: stdin.readline(...
output
1
38,918
12
77,837
Provide tags and a correct Python 3 solution for this coding contest problem. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row is a permutation of the numbers 1,2,3,…,n. The ...
instruction
0
38,919
12
77,838
Tags: combinatorics, dfs and similar, dp, dsu, graphs, math Correct Solution: ``` import math, sys from itertools import permutations from collections import defaultdict, Counter, deque from heapq import heapify, heappush, heappop MOD = int(1e9) + 7 INF = float('inf') def solve(): n = int(input()) a1 = list(map(in...
output
1
38,919
12
77,839
Provide tags and a correct Python 3 solution for this coding contest problem. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row is a permutation of the numbers 1,2,3,…,n. The ...
instruction
0
38,920
12
77,840
Tags: combinatorics, dfs and similar, dp, dsu, graphs, math Correct Solution: ``` #from math import * #from bisect import * #from collections import * #from random import * #from decimal import *""" #from heapq import * #from random import * import sys input=sys.stdin.readline sys.setrecursionlimit(3*(10**5)) def inp()...
output
1
38,920
12
77,841
Provide tags and a correct Python 3 solution for this coding contest problem. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row is a permutation of the numbers 1,2,3,…,n. The ...
instruction
0
38,921
12
77,842
Tags: combinatorics, dfs and similar, dp, dsu, graphs, math Correct Solution: ``` import collections import heapq from bisect import bisect_right import math t = int(input()) for w in range(t): n = int(input()) a = [int(x) for x in input().split()] b = [int(x) for x in input().split()] v = [] for...
output
1
38,921
12
77,843
Provide tags and a correct Python 3 solution for this coding contest problem. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row is a permutation of the numbers 1,2,3,…,n. The ...
instruction
0
38,922
12
77,844
Tags: combinatorics, dfs and similar, dp, dsu, graphs, math Correct Solution: ``` mod = 10**9+7 import sys input = sys.stdin.readline from collections import deque class Graph(object): """docstring for Graph""" def __init__(self,n,d): # Number of nodes and d is True if directed self.n = n self.graph = [[] for i ...
output
1
38,922
12
77,845
Provide tags and a correct Python 3 solution for this coding contest problem. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row is a permutation of the numbers 1,2,3,…,n. The ...
instruction
0
38,923
12
77,846
Tags: combinatorics, dfs and similar, dp, dsu, graphs, math Correct Solution: ``` from __future__ import division, print_function import math import sys import os from io import BytesIO, IOBase #from collections import deque, Counter, OrderedDict, defaultdict #import heapq #ceil,floor,log,sqrt,factorial,pow,pi,gcd #im...
output
1
38,923
12
77,847
Provide tags and a correct Python 3 solution for this coding contest problem. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row is a permutation of the numbers 1,2,3,…,n. The ...
instruction
0
38,924
12
77,848
Tags: combinatorics, dfs and similar, dp, dsu, graphs, math Correct Solution: ``` import collections import functools import math import random import sys import bisect import io, os # input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline # # input = sys.stdin.readline def In(): return map(int, input().s...
output
1
38,924
12
77,849
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row i...
instruction
0
38,925
12
77,850
Yes
output
1
38,925
12
77,851
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row i...
instruction
0
38,926
12
77,852
Yes
output
1
38,926
12
77,853
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row i...
instruction
0
38,927
12
77,854
Yes
output
1
38,927
12
77,855
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row i...
instruction
0
38,928
12
77,856
Yes
output
1
38,928
12
77,857
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row i...
instruction
0
38,929
12
77,858
No
output
1
38,929
12
77,859
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row i...
instruction
0
38,930
12
77,860
No
output
1
38,930
12
77,861
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row i...
instruction
0
38,931
12
77,862
No
output
1
38,931
12
77,863
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a 2 × n grid where each row i...
instruction
0
38,932
12
77,864
No
output
1
38,932
12
77,865
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consecutively, one after a...
instruction
0
39,074
12
78,148
Tags: greedy, implementation, sortings Correct Solution: ``` def find_min(i): min = 1000000001 index = 0 for j in range(i, n): if a[j] < min: min = a[j] index = j return index n = int(input()) a = input().split() for i in range(n): a[i] = int(a[i]) k = 0 ans = () f...
output
1
39,074
12
78,149
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consecutively, one after a...
instruction
0
39,075
12
78,150
Tags: greedy, implementation, sortings Correct Solution: ``` #maxn = 3100 #num = [0 for i in range(maxn)] #id = [maxn for i in range(maxn)] #cause problem if set to 0 #pp = [[0, 0] for i in range(100000)] #map = [0 for i in range(maxn)] #pos = [0 for i in range(maxn)] def key_function(num): def key(i): ret...
output
1
39,075
12
78,151
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consecutively, one after a...
instruction
0
39,076
12
78,152
Tags: greedy, implementation, sortings Correct Solution: ``` n = int(input()) a = list(map(int, input().split())) print(n - 1) for i in range(n - 1): j = a.index(min(a[i:]), i) print(i, j) a[i], a[j] = a[j], a[i] ```
output
1
39,076
12
78,153
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consecutively, one after a...
instruction
0
39,077
12
78,154
Tags: greedy, implementation, sortings Correct Solution: ``` n=int(input()) s=[int(i) for i in input().split()] j=list(s) j.sort() #print(j,s) if s==j: print(0) else: hh=0 x=[] for i in range(n): a=s[i] b=j[i] if a==b: s[i]=10**9 +1 continue else : if s==j: break ...
output
1
39,077
12
78,155
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consecutively, one after a...
instruction
0
39,078
12
78,156
Tags: greedy, implementation, sortings Correct Solution: ``` ''' Author : knight_byte File : A_SwapSort.py Created on : 2021-04-17 20:13:38 ''' def main(): n = int(input()) arr = list(map(int, input().split())) swap = 0 ind = 0 i_s = [] while ind < len(arr): mi = min(arr[ind:...
output
1
39,078
12
78,157
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consecutively, one after a...
instruction
0
39,079
12
78,158
Tags: greedy, implementation, sortings Correct Solution: ``` import sys import os.path if(os.path.exists('input_file.txt')): sys.stdin = open("input_file.txt", "r") sys.stdout = open("output_file.txt", "w") n=int(input()) a=list(map(int,input().split())) aa=sorted(a) i=0 # print(a,aa) f=1 l=[] while i<n: i...
output
1
39,079
12
78,159
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consecutively, one after a...
instruction
0
39,080
12
78,160
Tags: greedy, implementation, sortings Correct Solution: ``` n=int(input()) l=list(map(int,input().split())) swaps=0 ans=[] for i in range(n): t=i for j in range(i,n): if l[t]>l[j]: t=j if i!=t: ans.append([i,t]) l[i],l[t]=l[t],l[i] print(len(ans)) for i in ans: print(*i)...
output
1
39,080
12
78,161
Provide tags and a correct Python 3 solution for this coding contest problem. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consecutively, one after a...
instruction
0
39,081
12
78,162
Tags: greedy, implementation, sortings Correct Solution: ``` size=int(input()) array=list(map(int,input().split())) ans=[] for i in range(size): j=i for t in range(i,size): if(array[j]>array[t]): j=t if(i!=j): ans.append((i,j)) t=array[i] array[i]=array[j] array[j]=t print(len(ans)) for p in ans: print(p[...
output
1
39,081
12
78,163
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order....
instruction
0
39,082
12
78,164
Yes
output
1
39,082
12
78,165
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order....
instruction
0
39,083
12
78,166
Yes
output
1
39,083
12
78,167
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order....
instruction
0
39,084
12
78,168
Yes
output
1
39,084
12
78,169
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order....
instruction
0
39,085
12
78,170
Yes
output
1
39,085
12
78,171
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order....
instruction
0
39,086
12
78,172
No
output
1
39,086
12
78,173
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order....
instruction
0
39,087
12
78,174
No
output
1
39,087
12
78,175
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order....
instruction
0
39,088
12
78,176
No
output
1
39,088
12
78,177
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order....
instruction
0
39,089
12
78,178
No
output
1
39,089
12
78,179
Provide tags and a correct Python 3 solution for this coding contest problem. Leha like all kinds of strange things. Recently he liked the function F(n, k). Consider all possible k-element subsets of the set [1, 2, ..., n]. For subset find minimal element in it. F(n, k) — mathematical expectation of the minimal elemen...
instruction
0
39,259
12
78,518
Tags: combinatorics, greedy, math, number theory, sortings Correct Solution: ``` m = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) b_s = sorted(b) a_s = sorted(a, reverse = True) d = {} ans = [0 for i in range(m)] for i in range(m): d[b_s[i]] = d.get(b_s[i], []) d[b_s[i]]...
output
1
39,259
12
78,519