message
stringlengths
2
22.8k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
16
109k
cluster
float64
1
1
__index_level_0__
int64
32
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. All cities of Lineland are located on the Ox coordinate axis. Thus, each city is associated with its position xi — a coordinate on the Ox axis. No two cities are located at a single point. Line...
instruction
0
12,055
1
24,110
No
output
1
12,055
1
24,111
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. All cities of Lineland are located on the Ox coordinate axis. Thus, each city is associated with its position xi — a coordinate on the Ox axis. No two cities are located at a single point. Line...
instruction
0
12,056
1
24,112
No
output
1
12,056
1
24,113
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the outpu...
instruction
0
12,686
1
25,372
Tags: brute force, graphs, greedy, interactive, sortings Correct Solution: ``` import sys def guess(i, j): print(f"? {i} {j}") sys.stdout.flush() return input() def answer(i, j): print(f"! {i} {j}") sys.stdout.flush() def solve(n, k): pairs = [] for i in range(len(k)): for j in range(i+1, len(k)): pairs....
output
1
12,686
1
25,373
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the outpu...
instruction
0
12,687
1
25,374
Tags: brute force, graphs, greedy, interactive, sortings Correct Solution: ``` from sys import stdin, stdout input = stdin.readline def MyIter(n): for k in range(n-1, 0, -1): i = 0 while i + k < n: yield i, i + k i += 1 def solve(n, a): dct = [[] for i in range(n)] ...
output
1
12,687
1
25,375
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the outpu...
instruction
0
12,688
1
25,376
Tags: brute force, graphs, greedy, interactive, sortings Correct Solution: ``` n = int(input()) nums = list(map(int, input().split())) pairs = [] for i in range(len(nums)): for j in range(i+1, len(nums)): pairs.append((abs(nums[i]-nums[j]), (i+1, j+1))) pairs.sort(reverse=True) for _, (i, j) in pairs: ...
output
1
12,688
1
25,377
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the outpu...
instruction
0
12,689
1
25,378
Tags: brute force, graphs, greedy, interactive, sortings Correct Solution: ``` import time #start_time = time.time() #def TIME_(): print(time.time()-start_time) import os, sys from io import BytesIO, IOBase from types import GeneratorType from bisect import bisect_left, bisect_right from collections import defaultdic...
output
1
12,689
1
25,379
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the outpu...
instruction
0
12,690
1
25,380
Tags: brute force, graphs, greedy, interactive, sortings Correct Solution: ``` import time #start_time = time.time() #def TIME_(): print(time.time()-start_time) import os, sys from io import BytesIO, IOBase from types import GeneratorType from bisect import bisect_left, bisect_right from collections import defaultdic...
output
1
12,690
1
25,381
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the outpu...
instruction
0
12,691
1
25,382
Tags: brute force, graphs, greedy, interactive, sortings Correct Solution: ``` import os import sys from io import BytesIO, IOBase def main(): n=int(input()) k=list(map(int,input().split())) lens=[] for i in range(n+1): lens.append([]) for i in range(len(k)): lens[k[i]].append(i+1) ...
output
1
12,691
1
25,383
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the outpu...
instruction
0
12,692
1
25,384
Tags: brute force, graphs, greedy, interactive, sortings Correct Solution: ``` from itertools import permutations, product n = int(input()) nums = list(map(int, input().split())) indexed = sorted(zip(nums, range(1, len(nums)+1))) groups = [] prev_value = -1 for value, index in indexed: if prev_value != value: ...
output
1
12,692
1
25,385
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the outpu...
instruction
0
12,693
1
25,386
Tags: brute force, graphs, greedy, interactive, sortings Correct Solution: ``` from itertools import permutations, product n = int(input()) nums = list(map(int, input().split())) # print(nums) indexed = sorted(zip(nums, range(1, len(nums)+1))) removed = 0 while len(indexed) > 0 and indexed[0][0] <= removed: index...
output
1
12,693
1
25,387
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Pytho...
instruction
0
12,694
1
25,388
No
output
1
12,694
1
25,389
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Pytho...
instruction
0
12,695
1
25,390
No
output
1
12,695
1
25,391
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Pytho...
instruction
0
12,696
1
25,392
No
output
1
12,696
1
25,393
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Pytho...
instruction
0
12,697
1
25,394
No
output
1
12,697
1
25,395
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You must have heard all about the Foolland on your Geography lessons. Specifically, you must know that federal structure of this country has been the same for many centuries. The country consist...
instruction
0
12,792
1
25,584
No
output
1
12,792
1
25,585
Provide tags and a correct Python 3 solution for this coding contest problem. Two neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square. Once they went to the cinema, and the film impressed them so deeply, t...
instruction
0
13,051
1
26,102
Tags: binary search, geometry Correct Solution: ``` __author__ = 'Darren' def solve(): t1, t2 = map(int, input().split()) cinema = complex(*map(int, input().split())) house = complex(*map(int, input().split())) shop = complex(*map(int, input().split())) cinema_to_house = abs(house - cinema) ci...
output
1
13,051
1
26,103
Provide tags and a correct Python 3 solution for this coding contest problem. Two neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square. Once they went to the cinema, and the film impressed them so deeply, t...
instruction
0
13,052
1
26,104
Tags: binary search, geometry Correct Solution: ``` def a(): t1, t2 = map(int, input().split()) cinema = complex(*map(int, input().split())) house = complex(*map(int, input().split())) shop = complex(*map(int, input().split())) cinema_to_house = abs(house - cinema) cinema_to_shop = abs(shop - ci...
output
1
13,052
1
26,105
Provide tags and a correct Python 3 solution for this coding contest problem. Two neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square. Once they went to the cinema, and the film impressed them so deeply, t...
instruction
0
13,053
1
26,106
Tags: binary search, geometry Correct Solution: ``` __author__ = 'Darren' def solve(): t1, t2 = map(int, input().split()) cinema = complex(*map(int, input().split())) house = complex(*map(int, input().split())) shop = complex(*map(int, input().split())) cinema_to_house = abs(house - cinema...
output
1
13,053
1
26,107
Provide tags and a correct Python 3 solution for this coding contest problem. Two neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square. Once they went to the cinema, and the film impressed them so deeply, t...
instruction
0
13,054
1
26,108
Tags: binary search, geometry Correct Solution: ``` __author__ = 'Darren' def solve(): t1, t2 = map(int, input().split()) cinema = complex(*map(int, input().split())) house = complex(*map(int, input().split())) shop = complex(*map(int, input().split())) cinema_to_house = abs(house - cinema) ci...
output
1
13,054
1
26,109
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Two neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square. Once they went to the c...
instruction
0
13,058
1
26,116
No
output
1
13,058
1
26,117
Provide a correct Python 3 solution for this coding contest problem. Mr. A is planning to travel alone on a highway bus (hereinafter referred to as "bus") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his destination. Next, you have to decide the route to transfer...
instruction
0
13,219
1
26,438
"Correct Solution: ``` from heapq import heappush, heappop INF = 10 ** 20 while True: c, n, m, s, d = map(int, input().split()) s -= 1 d -= 1 if c == 0: break edges = [[] for _ in range(n * (c + 1))] for _ in range(m): a, b, f = map(int, input().split()) a -= 1 b -= 1 for i in range(c +...
output
1
13,219
1
26,439
Provide a correct Python 3 solution for this coding contest problem. Mr. A is planning to travel alone on a highway bus (hereinafter referred to as "bus") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his destination. Next, you have to decide the route to transfer...
instruction
0
13,220
1
26,440
"Correct Solution: ``` from sys import stdin from heapq import heappush,heappop while(True): c,n,m,s,d = map(int, stdin.readline().split()) if not c: break ma = [[] for _ in range(n)] s -= 1 d -= 1 for _ in range(m): a,b,f = map(int, stdin.readline().split()) a -= 1 b -=...
output
1
13,220
1
26,441
Provide a correct Python 3 solution for this coding contest problem. Mr. A is planning to travel alone on a highway bus (hereinafter referred to as "bus") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his destination. Next, you have to decide the route to transfer...
instruction
0
13,221
1
26,442
"Correct Solution: ``` def solve(): from heapq import heappush, heappop from sys import stdin f_i = stdin while True: c, n, m, s, d = map(int, f_i.readline().split()) if c == 0: break s -= 1 d -= 1 adj = [[] for i in range(n)] for...
output
1
13,221
1
26,443
Provide a correct Python 3 solution for this coding contest problem. Mr. A is planning to travel alone on a highway bus (hereinafter referred to as "bus") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his destination. Next, you have to decide the route to transfer...
instruction
0
13,222
1
26,444
"Correct Solution: ``` INF = 10000000 def bf(es, dist, c, s, d): dist[s][0] = 0 isUpdated = True while isUpdated: isUpdated = False for e in es: a, b, f = e for i in range(c+1): if dist[a][i] != INF and dist[a][i] + f < dist[b][i]: ...
output
1
13,222
1
26,445
Provide a correct Python 3 solution for this coding contest problem. Mr. A is planning to travel alone on a highway bus (hereinafter referred to as "bus") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his destination. Next, you have to decide the route to transfer...
instruction
0
13,223
1
26,446
"Correct Solution: ``` from sys import stdin readline = stdin.readline from collections import namedtuple Runner = namedtuple('Runner', 'd v') def main(): while True: ticket, vertex, edge, start, destination = map(int, readline().split()) if ticket == 0: break start -= 1 ...
output
1
13,223
1
26,447
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mr. A is planning to travel alone on a highway bus (hereinafter referred to as "bus") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his des...
instruction
0
13,224
1
26,448
No
output
1
13,224
1
26,449
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mr. A is planning to travel alone on a highway bus (hereinafter referred to as "bus") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his des...
instruction
0
13,225
1
26,450
No
output
1
13,225
1
26,451
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mr. A is planning to travel alone on a highway bus (hereinafter referred to as "bus") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his des...
instruction
0
13,226
1
26,452
No
output
1
13,226
1
26,453
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mr. A is planning to travel alone on a highway bus (hereinafter referred to as "bus") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his des...
instruction
0
13,227
1
26,454
No
output
1
13,227
1
26,455
Provide tags and a correct Python 3 solution for this coding contest problem. A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions ...
instruction
0
13,868
1
27,736
Tags: combinatorics, dsu, graphs Correct Solution: ``` import sys from array import array # noqa: F401 def input(): return sys.stdin.buffer.readline().decode('utf-8') class UnionFind(object): __slots__ = ['nodes'] def __init__(self, n: int): self.nodes = [-1] * n def find(self, x: int) ->...
output
1
13,868
1
27,737
Provide tags and a correct Python 3 solution for this coding contest problem. A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions ...
instruction
0
13,869
1
27,738
Tags: combinatorics, dsu, graphs Correct Solution: ``` n, m = map(int, input().split()) p, r = list(range(n + 1)), [0] * (n + 1) def find(x): if p[x] != x: p[x] = find(p[x]) return p[x] def union(x, y): x, y = find(x), find(y) if x == y: return 0 if r[x] < r[y]: x, y = y, x p[y] = x ...
output
1
13,869
1
27,739
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions,...
instruction
0
13,870
1
27,740
No
output
1
13,870
1
27,741
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions,...
instruction
0
13,871
1
27,742
No
output
1
13,871
1
27,743
Provide a correct Python 3 solution for this coding contest problem. The neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and people who enter the platform can use the chairs freely. The...
instruction
0
14,045
1
28,090
"Correct Solution: ``` INF = 10 ** 20 while True: n, m = map(int, input().split()) if not n: break chairs = list("#" * n) def sit(s): if s == "A": chairs[chairs.index("#")] = "A" elif s == "B": for i in range(n - 1, -1, -1): if chairs[i] == "#" and (i == 0 or chairs[i - 1...
output
1
14,045
1
28,091
Provide a correct Python 3 solution for this coding contest problem. The neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and people who enter the platform can use the chairs freely. The...
instruction
0
14,046
1
28,092
"Correct Solution: ``` def solve(): from sys import stdin f_i = stdin ans = '' while True: n, m = map(int, f_i.readline().split()) if n == 0 and m == 0: break chairs = '#' * n for i in range(m): a = f_i.readline...
output
1
14,046
1
28,093
Provide a correct Python 3 solution for this coding contest problem. The neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and people who enter the platform can use the chairs freely. The...
instruction
0
14,047
1
28,094
"Correct Solution: ``` while 1: N, M = map(int, input().split()) if N == M == 0: break ans = ["#"]*N for i in range(M): a = input() if a == 'A': for j in range(N): if ans[j] == '#': ans[j] = 'A' break eli...
output
1
14,047
1
28,095
Provide a correct Python 3 solution for this coding contest problem. The neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and people who enter the platform can use the chairs freely. The...
instruction
0
14,048
1
28,096
"Correct Solution: ``` INF = 10**10 while(True): N, M = [int(n) for n in input().split()] if N + M == 0: break chair = ["#" for _ in range(N)] for i in range(M): a = str(input()) if a == "A": for i in range(N): if chair[i] == "#": c...
output
1
14,048
1
28,097
Provide a correct Python 3 solution for this coding contest problem. The neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and people who enter the platform can use the chairs freely. The...
instruction
0
14,049
1
28,098
"Correct Solution: ``` INF = 10 ** 20 def main(): while True: n, m = map(int, input().split()) if not n: break chairs = list("#" * n) def sit(s): if s == "A": chairs[chairs.index("#")] = "A" elif s == "B": for i in range(n - 1, -1, -1): if chai...
output
1
14,049
1
28,099
Provide a correct Python 3 solution for this coding contest problem. The neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and people who enter the platform can use the chairs freely. The...
instruction
0
14,050
1
28,100
"Correct Solution: ``` def left_empty(bench): return bench.index('#') def a_sit(bench): bench[left_empty(bench)] = 'A' def right_empty(bench): for i in reversed(range(len(bench))): if bench[i] == '#': yield i def a_next(bench, i): if i + 1 < len(bench) and bench[i + 1] == 'A': ...
output
1
14,050
1
28,101
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and peopl...
instruction
0
14,051
1
28,102
No
output
1
14,051
1
28,103
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and peopl...
instruction
0
14,052
1
28,104
No
output
1
14,052
1
28,105
Provide a correct Python 3 solution for this coding contest problem. The JOI Railways is the only railway company in the Kingdom of JOI. There are $N$ stations numbered from $1$ to $N$ along a railway. Currently, two kinds of trains are operated; one is express and the other one is local. A local train stops at every...
instruction
0
14,067
1
28,134
"Correct Solution: ``` from heapq import heapify, heappop, heappush N, M, K = map(int, input().split()) A, B, C = map(int, input().split()) T = int(input()) S = [int(input())-1 for i in range(M)] def f(rt, rn): return min(rt // A, rn-1) ans = 0 que = [] for i in range(M-1): s0 = S[i]; s1 = S[i+1] if B*s0 ...
output
1
14,067
1
28,135
Provide tags and a correct Python 3 solution for this coding contest problem. Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day. Metropolis airport is the main transpo...
instruction
0
14,694
1
29,388
Tags: greedy Correct Solution: ``` # from debug import debug from heapq import heappush, heappop, heapify n, k = map(int, input().split()) c = list(map(int, input().split())) q = [(-c[i], i) for i in range(k)] heapify(q) ans = 0 lis = [0]*n for i in range(k, n): heappush(q, (-c[i], i)) a, p = heappop(q) ans += a...
output
1
14,694
1
29,389
Provide tags and a correct Python 3 solution for this coding contest problem. Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day. Metropolis airport is the main transpo...
instruction
0
14,695
1
29,390
Tags: greedy Correct Solution: ``` from heapq import heappush, heappop, heapify n, k = map(int, input().split()) a = list(map(int, input().split())) q = [(-a[i], i) for i in range(k)] heapify(q) res, s = [0] * n, 0 for i in range(k, n): heappush(q, (-a[i], i)) x, j = heappop(q) s -= x * (i-j) res[j] = i...
output
1
14,695
1
29,391
Provide tags and a correct Python 3 solution for this coding contest problem. Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day. Metropolis airport is the main transpo...
instruction
0
14,696
1
29,392
Tags: greedy Correct Solution: ``` from heapq import heappush,heappop,heapify n,k=map(int,input().split()) *l,=map(int,input().split()) q=[(-l[i],i)for i in range(k)];heapify(q) a=[0]*n s=0 for i in range(k,n): heappush(q,(-l[i],i)) x,j=heappop(q) s-=x*(i-j) a[j]=i+1 for i in range(n,n+k): x,j=heapp...
output
1
14,696
1
29,393
Provide tags and a correct Python 3 solution for this coding contest problem. Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day. Metropolis airport is the main transpo...
instruction
0
14,697
1
29,394
Tags: greedy Correct Solution: ``` import heapq n,k = map(int,input().split()) l = list(map(int,input().split())) ans = [0]*n h = [] for i in range(k): h.append((-1*l[i],i)) heapq.heapify(h) som = 0 for i in range(k,n+k): if i < n: heapq.heappush(h, (-1 * l[i], i)) x = heapq.heappop(h) s = -1*...
output
1
14,697
1
29,395
Provide tags and a correct Python 3 solution for this coding contest problem. Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day. Metropolis airport is the main transpo...
instruction
0
14,698
1
29,396
Tags: greedy Correct Solution: ``` """ Author - Satwik Tiwari . 15th Dec , 2020 - Tuesday """ #=============================================================================================== #importing some useful libraries. from __future__ import division, print_function from fractions import Fraction impor...
output
1
14,698
1
29,397
Provide tags and a correct Python 3 solution for this coding contest problem. Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day. Metropolis airport is the main transpo...
instruction
0
14,699
1
29,398
Tags: greedy Correct Solution: ``` # https://codeforces.com/problemset/problem/853/A from heapq import heappush, heappop n, k = list(map(int, input().rstrip().split())) c = list(map(int, input().rstrip().split())) li = [0] * n cost = 0 q = [] for i in range(k): heappush(q, (-c[i], i)) for i in range(k,n): heapp...
output
1
14,699
1
29,399
Provide tags and a correct Python 3 solution for this coding contest problem. Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day. Metropolis airport is the main transpo...
instruction
0
14,700
1
29,400
Tags: greedy Correct Solution: ``` from heapq import heappush,heappop,heapify n,k=map(int,input().split()) *l,=map(int,input().split()) q=[(-l[i],i)for i in range(k)] heapify(q) a=[0]*n s=0 for i in range(k,n) : heappush(q,(-l[i],i)) x,j=heappop(q) s-=x*(i-j) a[j]=i+1 for i in range(n,n+k) : x,j=hea...
output
1
14,700
1
29,401
Provide tags and a correct Python 3 solution for this coding contest problem. Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day. Metropolis airport is the main transpo...
instruction
0
14,701
1
29,402
Tags: greedy Correct Solution: ``` import sys input = sys.stdin.readline from heapq import * n, k = map(int, input().split()) c = list(map(int, input().split())) ic = [(-c[i], i+1) for i in range(n)] pq = [] idx = 0 ans_v = 0 ans_arr = [-1]*n for t in range(k+1, k+n+1): while idx<n: if ic[idx][1]<=t: ...
output
1
14,701
1
29,403