exec_outcome
stringclasses
1 value
code_uid
stringlengths
32
32
file_name
stringclasses
111 values
prob_desc_created_at
stringlengths
10
10
prob_desc_description
stringlengths
63
3.8k
prob_desc_memory_limit
stringclasses
18 values
source_code
stringlengths
117
65.5k
lang_cluster
stringclasses
1 value
prob_desc_sample_inputs
stringlengths
2
802
prob_desc_time_limit
stringclasses
27 values
prob_desc_sample_outputs
stringlengths
2
796
prob_desc_notes
stringlengths
4
3k
βŒ€
lang
stringclasses
5 values
prob_desc_input_from
stringclasses
3 values
tags
listlengths
0
11
src_uid
stringlengths
32
32
prob_desc_input_spec
stringlengths
28
2.37k
βŒ€
difficulty
int64
-1
3.5k
βŒ€
prob_desc_output_spec
stringlengths
17
1.47k
βŒ€
prob_desc_output_to
stringclasses
3 values
hidden_unit_tests
stringclasses
1 value
PASSED
7741441a304ded11eb413bd30665c1e9
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.PrintStream; import java.util.ArrayDeque; import java.util.HashMap; import java.util.Map; import...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
def8262889390ab1bc8b6a391c30204b
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.PrintStream; import java.util.ArrayDeque; import java.util.HashMap; import java.util.Map; import...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
a470b479b4fc1b4fc254215a179ef554
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.PrintStream; import java.util.ArrayDeque; import java.util.HashMap; import java.util.Map; import...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
7d335544fae0ee93c90c17cd33c5cc6f
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.util.*; public class Main { static int[][] min, max; public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int s = scanner.nextInt(); int l = scanner.nextInt(); int mp = (int) Math.ce...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
2440e10f34f3300c6dd6f34ce4108517
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.util.*; public class Main { static int[][] min, max; public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int s = scanner.nextInt(); int l = scanner.nextInt(); int mp = (int) Math.ce...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
4033f4f5a056569ee89981d89496e1bc
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
//package round278; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class B { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), s = n...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
7dc04885951b1f7d505f9cff9e59f581
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.util.*; public class Main { static int[][] min, max; public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int s = scanner.nextInt(); int l = scanner.nextInt(); int mp = (int) Math.ce...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
74d7eeb5972be447f0bf48b8eb532afb
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import sun.reflect.generics.tree.Tree; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; //@SuppressWarnings("unused") public class Solution { public static void main(String[] args) throws IOException { boolean isDebugMode = Arrays.asList(args).contains("DE...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
07f8488d32fe78baf595dfcaaff6b57b
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.Deque; import java.util.LinkedList; import java.util.Collection; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author thnkndblv */ publi...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
f9e5d8bddf2a26cea721fc01610233c5
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.*; import java.util.*; public class strip { private static Reader in; private static PrintWriter out; static class SegmentTree { public SegmentTree left, right; public int start, end, max; public SegmentTree(int start, int end) { this.start = start; this.end = en...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
98be92e500234b28d6a4a1c034dde153
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import ...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
5a568cd6927fab6ae22207f5d3a5d8c2
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import ...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
2bdd0fb5ee8dc4cdeaeb65ecffe32f94
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import ...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
2a899b19a1b2e71d61a90c2dde8f80c5
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.*; import java.util.*; public final class strip { static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc=new FastScanner(br); static PrintWriter out=new PrintWriter(System.out); static int[][] st,st2; static int[] log,a,first; static long[] dp; s...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
eb181dbdab32ba50dcbc9c80add518a6
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.*; import java.util.*; public class cf278D { static int[][] min, max; public static void main(String[] args) throws Exception { // BufferedReader in = new BufferedReader(new FileReader("cf278D.in")); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String ...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
68b99143ea6fd61206c2b036db39ba0a
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.*; import java.util.*; public class cf278D { static int[][] min; static int[][] max; public static void main(String[] args) throws Exception { // BufferedReader in = new BufferedReader(new FileReader("cf278D.in")); BufferedReader in = new BufferedReader(new InputStreamReader(System.in));...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
49438ad8904e1260465a7431b040497a
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.*; import java.util.*; public class cf278D { static int[][] min; static int[][] max; public static void main(String[] args) throws Exception { // BufferedReader in = new BufferedReader(new FileReader("cf278D.in")); BufferedReader in = new BufferedReader(new InputStreamReader(System.in));...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
ae34c121349f41a40fe484151cbac314
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
import java.io.*; import java.util.Random; import java.util.StringTokenizer; import java.util.TreeMap; public class B { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); Random rg = new Random(3...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
58b1ac3dd532274f9c4c25d2b1743028
train_003.jsonl
1416590400
Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The difference between the maximal and the minimal number on the piece should be ...
256 megabytes
//package codeforces; import java.util.Arrays; import java.util.Scanner; import java.util.TreeMap; /** * Created by nitin.s on 25/03/16. */ public class Strip { public static void main(String[] args) { Scanner in = new Scanner(System.in); TreeMap<Integer, Integer> map = new TreeMap<Integer, Inte...
Java
["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1"]
1 second
["3", "-1"]
NoteFor the first sample, we can split the strip into 3 pieces: [1, 3, 1], [2, 4], [1, 2].For the second sample, we can't let 1 and 100 be on the same piece, so no solution exists.
Java 7
standard input
[ "dp", "two pointers", "binary search", "data structures" ]
3d670528c82a7d8dcd187b7304d36f96
The first line contains three space-separated integers n, s, l (1 ≀ n ≀ 105, 0 ≀ s ≀ 109, 1 ≀ l ≀ 105). The second line contains n integers ai separated by spaces ( - 109 ≀ ai ≀ 109).
2,000
Output the minimal number of strip pieces. If there are no ways to split the strip, output -1.
standard output
PASSED
b5896820a9bca65b1a2ca735a906fe0b
train_003.jsonl
1335614400
The Smart Beaver from ABBYY has a long history of cooperating with the "Institute of Cytology and Genetics". Recently, the Institute staff challenged the Beaver with a new problem. The problem is as follows.There is a collection of n proteins (not necessarily distinct). Each protein is a string consisting of lowercase ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class F implements Runnable { private MyScanner in; private PrintWriter out; final int ALPH = 26; int[][] trie; ...
Java
["3 2\naba\nbzd\nabq", "4 3\neee\nrrr\nttt\nqqq", "4 3\naaa\nabba\nabbc\nabbd"]
2 seconds
["2", "0", "9"]
null
Java 6
standard input
[ "dp", "sortings", "strings" ]
637ba13f9d567f5bac92853e3ee1824c
The first input line contains two integers n and k (1 ≀ k ≀ n), separated by a single space. The following n lines contain the descriptions of proteins, one per line. Each protein is a non-empty string of no more than 500 characters consisting of only lowercase Latin letters (a...z). Some of the strings may be equal. T...
2,200
Print a single number denoting the largest possible value of representativity that a subcollection of size k of the given collection of proteins can have.
standard output
PASSED
a050cddd873ad02e1e21212aca3540a7
train_003.jsonl
1335614400
The Smart Beaver from ABBYY has a long history of cooperating with the "Institute of Cytology and Genetics". Recently, the Institute staff challenged the Beaver with a new problem. The problem is as follows.There is a collection of n proteins (not necessarily distinct). Each protein is a string consisting of lowercase ...
256 megabytes
import java.io.*; import java.util.*; public class Solution { private StringTokenizer st; private BufferedReader in; private PrintWriter out; static int k; static class Node { int count; List<Node> nodes = new ArrayList<Node>(); int[] din() { int[] ret = new int[Math.min(k, count) + 1]; int c ...
Java
["3 2\naba\nbzd\nabq", "4 3\neee\nrrr\nttt\nqqq", "4 3\naaa\nabba\nabbc\nabbd"]
2 seconds
["2", "0", "9"]
null
Java 6
standard input
[ "dp", "sortings", "strings" ]
637ba13f9d567f5bac92853e3ee1824c
The first input line contains two integers n and k (1 ≀ k ≀ n), separated by a single space. The following n lines contain the descriptions of proteins, one per line. Each protein is a non-empty string of no more than 500 characters consisting of only lowercase Latin letters (a...z). Some of the strings may be equal. T...
2,200
Print a single number denoting the largest possible value of representativity that a subcollection of size k of the given collection of proteins can have.
standard output
PASSED
dbc13bb0f7f369008915116009d93379
train_003.jsonl
1335614400
The Smart Beaver from ABBYY has a long history of cooperating with the "Institute of Cytology and Genetics". Recently, the Institute staff challenged the Beaver with a new problem. The problem is as follows.There is a collection of n proteins (not necessarily distinct). Each protein is a string consisting of lowercase ...
256 megabytes
import java.io.*; import java.util.*; public class F { final String filename = new String("F").toLowerCase(); final int MAX = 100 * 500 + 1; final int ALPHA = 26; int[][] next = new int[MAX][ALPHA]; int[] depth = new int[MAX]; int[] count = new int[MAX]; int countV ; void init() { countV = 1; for (in...
Java
["3 2\naba\nbzd\nabq", "4 3\neee\nrrr\nttt\nqqq", "4 3\naaa\nabba\nabbc\nabbd"]
2 seconds
["2", "0", "9"]
null
Java 6
standard input
[ "dp", "sortings", "strings" ]
637ba13f9d567f5bac92853e3ee1824c
The first input line contains two integers n and k (1 ≀ k ≀ n), separated by a single space. The following n lines contain the descriptions of proteins, one per line. Each protein is a non-empty string of no more than 500 characters consisting of only lowercase Latin letters (a...z). Some of the strings may be equal. T...
2,200
Print a single number denoting the largest possible value of representativity that a subcollection of size k of the given collection of proteins can have.
standard output
PASSED
3e2efa7172caea46b4b1c7a5e21f8e22
train_003.jsonl
1335614400
The Smart Beaver from ABBYY has a long history of cooperating with the "Institute of Cytology and Genetics". Recently, the Institute staff challenged the Beaver with a new problem. The problem is as follows.There is a collection of n proteins (not necessarily distinct). Each protein is a string consisting of lowercase ...
256 megabytes
//package abbyy2.hard; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; public class FM2 { InputStream is; PrintWriter out; // String INPUT = "17 8 ab baa aaba aaaab a bbbba abb b b aa baa ab aaaab abb aa bba ba"; Strin...
Java
["3 2\naba\nbzd\nabq", "4 3\neee\nrrr\nttt\nqqq", "4 3\naaa\nabba\nabbc\nabbd"]
2 seconds
["2", "0", "9"]
null
Java 6
standard input
[ "dp", "sortings", "strings" ]
637ba13f9d567f5bac92853e3ee1824c
The first input line contains two integers n and k (1 ≀ k ≀ n), separated by a single space. The following n lines contain the descriptions of proteins, one per line. Each protein is a non-empty string of no more than 500 characters consisting of only lowercase Latin letters (a...z). Some of the strings may be equal. T...
2,200
Print a single number denoting the largest possible value of representativity that a subcollection of size k of the given collection of proteins can have.
standard output
PASSED
52d9fb2b412c5458759b30a27002924e
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.*; public class J { public static void main(String[] args) { Scanner sc=new Scanner(System.in); long t=sc.nextInt(),a,b,k,c;//a,b,m,x,u;//,x=0,n,j,v=2,g,m; long y; for(int r=0;r<t;r++) { a=sc.nextInt(); b=sc.nextInt(); c=sc.nextInt(); if(a>c) { Syste...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
82bc2c597fabf66335d9c0ab0efb2d0b
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out)); int t=Integer.parseInt(...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
5aea3ad308e1e432c272efd9f3eb3716
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.*; public class Helloworld { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(); System.out.println((a >= c ? -1 : 1) + " " + ((l...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
7e24853f492865200a62be498b56bc08
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.util.*; public class practicee{ public static void main(String args[]) { Scanner s=new Scanner(System.in); int t=s.nextInt(); ...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
bde9444cd00c40511cef899056033800
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class A_90 { public static void main(String[] args) { try { FastScanner fs=new FastScanner(); int test=fs.nextInt(); while(test-->0) { long a=fs.nextLong(); long b=fs.nextLong(); long c=fs.nextLong(); long ans1=-1,an...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
1fc9fb8558a591d204fa48b04ede507f
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter out = new PrintWriter(System.out); static v...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
b408c3403caa1d975fe01ac3a796b4cc
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter out = new PrintWriter(System.out); static v...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
80b12feb2ccd278d5ec4dde50c5a6abb
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter out = new PrintWriter(System.out); static ...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
e62560a9aac2ab511ae5d98c039014b3
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.*; public class dougnuts { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int k=0;k<t;k++) { int count=0,r=0; long a=sc.nextLong(); long b=sc.nextLong(); long c=sc.nextLong(); long c1=0;...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
61467cc6a9b3feb01c2e9d7063d3cd3b
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
// package com.company; import java.util.*; import java.lang.*; import java.io.*; //****Use Integer Wrapper Class for Arrays.sort()**** public class DP1 { static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] Args)throws Exception{ FastReader scan=n...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
9abc01afadb73c6021122517d5029f41
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.*; // System.out.println(); public class Main{ public static void main(String [] args) { Scanner sc= new Scanner(System.in); int t = sc.nextInt(); while(t>0){ long a = sc.nextLong(); long b = sc.nextLong(); ...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
36bdabac6deeae5b355b0ada4c2f9943
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import javax.print.DocFlavor; import javax.print.attribute.HashAttributeSet; import java.awt.event.MouseAdapter; import java.io.*; import java.math.BigInteger; import java.nio.channels.FileChannel; import java.util.*; import java.util.ArrayList; import java.util.Scanner; public class adaking { static class pa...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
34665d830c345dddce3f0dfe505315a8
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class d{ public static void main (String[] args) { PrintWriter pw=new PrintWriter(System.out); Scanner sc=new Scanner(System.in); int t=1; t=sc.nextInt(); ...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
5b9274bdd3fab9d5ea42027e829262b9
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Test { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
9aca5cff076c11d4cce330a2ad2e3125
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class DonutShops_1000 { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); for(int i = 0; i < t; i++) { dou...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
3cf5d5c3c7db46726d596a7f7ce6df75
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.Scanner; public class DonutShops { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long numTestcases = scanner.nextLong(); while(numTestcases-- > 0) { long a = scanner.nextLong(); long b = scanner.nextLong(); ...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
cc2c2e929e91f99615057665ce4ba174
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
a1b0e0cab9e256dd3fb23776d03cbe75
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
8e72a7a6c411755041fbba0223849494
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.Scanner; public class donut{ public static void main(String args[]){ int test; Scanner scan = new Scanner(System.in); test = scan.nextInt(); for(int i=0;i<test;i++){ long a,b,c; long y=-1; long z=-1; a = scan.nextLong(); b = scan.nextLong(); c = scan.nextLong(); //shop 1 is ch...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
df44cd16b6d10d5944db70524fe7db20
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.Scanner; public class Donuts { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i =0; i<t; i++) { long a = sc.nextInt(); long b = sc.nextInt(); long c = sc.nextInt(); if(a<c) { System.out.print("1"+" "); } ...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
1553bcd792ec0f74bd9b702c9cebb3a9
train_003.jsonl
1593095700
There are two rival donut shops.The first shop sells donuts at retail: each donut costs $$$a$$$ dollars.The second shop sells donuts only in bulk: box of $$$b$$$ donuts costs $$$c$$$ dollars. So if you want to buy $$$x$$$ donuts from this shop, then you have to buy the smallest number of boxes such that the total numbe...
256 megabytes
import java.util.*; import java.io.*; import java.io.BufferedReader; public class Z_A{ public static long mod= 1000000007; public static Debug db; public static boolean w=true; public static void main(String[] args) throws IOException { InputReader in = new InputReader(System.in); PrintWriter out = new PrintW...
Java
["4\n5 10 4\n4 5 20\n2 2 3\n1000000000 1000000000 1000000000"]
2 seconds
["-1 20\n8 -1\n1 2\n-1 1000000000"]
NoteIn the first testcase buying any number of donuts will be cheaper in the second shop. For example, for $$$3$$$ or $$$5$$$ donuts you'll have to buy a box of $$$10$$$ donuts for $$$4$$$ dollars. $$$3$$$ or $$$5$$$ donuts in the first shop would cost you $$$15$$$ or $$$25$$$ dollars, respectively, however. For $$$20$...
Java 8
standard input
[ "implementation", "greedy", "math" ]
002801f26568a1b3524d8754207d32c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a \le 10^9$$$, $$$2 \le b \le 10^9$$$, $$$1 \le c \le 10^9$$$).
1,000
For each testcase print two positive integers. For both shops print such $$$x$$$ that buying $$$x$$$ donuts in this shop is strictly cheaper than buying $$$x$$$ donuts in the other shop. $$$x$$$ should be greater than $$$0$$$ and less or equal to $$$10^9$$$. If there is no such $$$x$$$, then print $$$-1$$$. If there ar...
standard output
PASSED
952f8c16b5a8c2f7deb963fb29e57bba
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); sc.nextInt(); int height = sc.nextInt(); int width = 0; while (sc.hasNextInt()){ if (sc.nextInt() > height){ width+=2; }...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
f02aca83e2c33555a135d87a947bfc80
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; import java.io.*; public class TestClass { public static void main(String args[] ) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int h = s.nextInt(); int a=0; for(int i=0;i<n;i++){ ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
9bf3340e4ec0bcecf9c5566ee24d691b
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; /** * * @author MOHAMED */ public class ProblemSolving2 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner s = new Scanner(System.in); //=================================== Vanya and Fence ===========...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
c8e2bceaafde5f12a16ff222ad31b080
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; import java.util.stream.IntStream; public class ProblemSolving { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here //=================================== Vanya and Fence ==============...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
1b99d5ca9c130cf7470bb114c24b670a
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class VanyaAndFence { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); // System.out.println("enter the number of friends ... "); int numberOfFriends = scanner.nextInt(); // System.out.println("enter the height ... ")...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
b3673ca4b4f3cdcec19e7c797ee91acb
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Main { public static void main (String [] args) { Scanner key = new Scanner(System.in); int n = key.nextInt(); int h = key.nextInt(); int width = 0, temp; for (int i = 0; i < n; i++) { temp = key.nextInt(); if (te...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
5d3d5858de1a2f03a7ff4dbe6d9cbae7
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
//import Codeforces.CodeforcesLibrary; // it will be error - add methods to this class as static methods import java.util.*; public class TestCodeforces { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); solve(scanner); scanner.close(); } public...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
4f2e21a22cef94f5609df6f5d0a9d8f7
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
//import Codeforces.CodeforcesLibrary; // it will be error - add methods to this class as static methods import java.util.*; public class TestCodeforces { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); solve(scanner); scanner.close(); } public ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
309134d5f726c7fa689dcc1bfcb3e28d
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; public class TestCodeforces { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int x = scanner.nextInt(), h = scanner.nextInt(); int res = 0; for (int i = 0; i < x; i++) { int n = scanner.nextInt(); if (...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
d99f755c6b5a36af8a69f40702eb9940
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; public class TestCodeforces { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int x = scanner.nextInt(), h = scanner.nextInt(); int res = 0; for (int i = 0; i < x; i++) { int n = scanner.nextInt(); ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
e16df938cdb9557d1aac953c5b6a5e90
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; public class TestCodeforces { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(), h = scanner.nextInt(); int res = 0; for (int i = 0; i < n; i++) { if (scanner.nextInt() > h) res += 2; ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
14e03e1871893c2d9cfb07020660ba10
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; public class TestCodeforces { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); /* n people, h hieght, person standing - 1 width, person bending - 2 width, count the minimum length of them */ int n = scanner.nextInt(), h...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
bd8579741f37119cbe48a713801c38c2
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; public class VanyaAndFence { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int h = s.nextInt(); int sum = 0; while(n-->=1) { if(Math.ceil(s.nextInt()/(h+.0)) <= 1.0) { sum++; continue; } sum+=2; } System.out.pr...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
e59bd57f9a2dddf4b733c18356a07957
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class p1 { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int h = scan.nextInt(); int a; int sum=0; for(int i=0; i<n;i++){ a = scan.n...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
8df8616826f85110a875a9d60faf63cb
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class VanyaAndFence { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int n,h,sum=0,a; n=scan.nextInt(); h=scan.nextInt(); for(int i=0;i<n;i++){ a=scan.nextInt(); if(a<=h){ ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
882a7a16d2891631e0ed495707ae0b3d
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class problem1 { public static void main(String[] args) { int width = 0; Scanner read = new Scanner(System.in); int n = read.nextInt(); int h = read.nextInt(); int Array[] = new int[n]; for (int i = 0; i <= Array.length - 1; i++) { Array[i...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
22807bd907dccd9313bb05d40f939e1d
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class First { public static void main(String[] args) { // TODO Auto-generated method stub Scanner reader = new Scanner(System.in); // Reading from System.in //System.out.println("number of friends: "); int n = reader.nextInt(); // Scans the next token of the input as an i...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
478e90414a7ed5400980f0ccffdbe46d
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=in.nextInt() , h=in.nextInt(),per,sum=0; for(int i=0;i<n;i++) { per=in.nextInt(); if(per>h) sum+=2; else ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
3e3598ac81b7868876f9696bdf88e3da
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Vanya { public static void main(String[] args) { Scanner s=new Scanner(System.in); int f=s.nextInt(),h=s.nextInt(),count=0,x; for (int i=0;i<f;i++){ x=s.nextInt(); if (x>h) count+=2; else ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
97314ef5dfc3c369be11e6fed2fd890a
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { try { Scanner sc = new Scanner(System.in); int sum=0; //System.out.System.out.p...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
5af1bba8be023cc4d83e2e052619a0a3
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { try { Scanner sc = new Scanner(System.in); int sum=0; //System.out.System.out.p...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
7b41d8c177ade91ecb17ed48722ba8bc
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; public class VanyaAndFence { static int caculate() { Scanner scanner = new Scanner(System.in); Scanner lineScanner; String line; int numberOfFriends = 0; int heightOfFrence = 0; int minValidWidth = 0; for (int i = 0; i < 2 && scanner.hasN...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
ab2e7545c4abc75dcacd0fc8fb3d28fc
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
/* https://codeforces.com/contest/677/problem/A idea: compare the height of each person with the height of fence. */ import java.util.Scanner; public class VanyaAndFence { static int caculate() { Scanner scanner = new Scanner(System.in); int numberOfFriends = scanner.nextInt(); int he...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
9f77b0103ad904c2c6ade8ca3771af2b
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author Mohamed Thulfkar */ public class Main { /** * @param args the command line arg...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
eb37617f0ba07302323df8d1d8059f6e
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
public class App { public static void main (String[] args) { java.util.Scanner input=new java.util.Scanner(System.in); int n =input.nextInt(); int h =input.nextInt(); int min=0; for (int i = 0; i < n; i++) { int a=input.nextInt(); if (a>h) { min +=2; } else { min ++; } } Syst...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
09315194667185d86e6f31f579b88ab9
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class VanyaAndFence { public static void main(String[] args)throws java.lang.Exception { int i; String s; BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); try {s = br.readLine();} catch...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
80213fa0bb912ca8954c8b49abf59640
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { FastReader in = new FastReader(); int n = in.nextInt(); int h = in.nextInt(); int[] persons =...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
bba14780d288b90064bc4cb757038180
train_003.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) { solve(); } private static void solve(){ int n = sc.nextInt(); int h = sc.nextInt(); int[] array = rea...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≀ n ≀ 1000, 1 ≀ h ≀ 1000)Β β€” the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≀ ai ≀ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integerΒ β€” the minimum possible valid width of the road.
standard output
PASSED
ec658a81427c1a98ce70c1c84c987560
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; import java.util.AbstractMap.SimpleEntry; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n, k; n = sc.nextInt(); ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
ae76d759a94ab39367baa3aea62e1050
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class rankListA { static class pairsrank implements Comparable<pairsrank> { int prob; int pen; public pairsrank(int x, int y) { prob = x; pen = y;...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
aea9fb7510a523684d0921e4d3ec7ec6
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Scanner; public class problemI { void sorting(int arr[][],int n){ boolean swapped = true; int j = 0; int temp1; int temp2; while (swapped) { swapped = false; j++; for (int i = 0; i < n - j; i++) { if (arr[i][0] < arr[i + 1][0]) { ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
9d289235c20ef431e50278ae35b46cb9
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; public class j { public static void main(String a[])throws IOException { BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int d[]; int e[]; int i=0,j=0,n=0,p=0,k=0,w=0,t=0,u=0,z=0; String s; String r[]; s=b.readLine(); StringTokenizer c=new StringTokenizer(s);...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
dff73c9e76c6fc99b681b5fb671aef02
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.LinkedList; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; import java.util.Vector; public class Solution { class...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
263c309cf124f874554bf599bb5e59b3
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class RankList { static short[] prob;static short[] penalty; static short last=0; static short []result; public static void main(String[] args) throws IOException { BufferedReade...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
596d6663bc2ed9bfeddb15ed8a6bd752
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Task166A { public static void main(String... args) throws NumberFormatException, IOException { Solutio...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
503c587db2a2f34c119aba068a29439f
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class practice { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); rank[] ranks = new rank[n]; ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
ce8d513578b0481046157751045151a5
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReade...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
1d26223002786aded2b4ae5b1a3f84a4
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Main p = new Main(); p.solve(); } public void solve(){ int n, k; Scanner in = new Scanner(System.in); n = in.nextInt(); k = in.nextInt(); Team[] m = new Team[n]; for(int i = 0; i < n; i++){ m[i] = new Team(in.nextInt...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
61f69d7860b8c83b248b2b5938a3a60c
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Task166A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] pt = new int[n]; for (int i = 0; i < n; i++) { pt[i] = sc.nextInt() * 100 + 50 - sc.nextInt(); } ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
7a9af164897fa26cc93176edb853d9e6
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { static int[ ] readInts( String a ) { String cad[] = a.split( " " ); int arr[] = new int[ cad.length ]; for ( int i = 0; i < arr.length; i++ ) { arr[ i ] = Integer.parseIn...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
dae8d40e5f474253925a97071009e8cc
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; public class Rank { public static void main(String[] args) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(out...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
a7343edbd77ac43b2a6a0ad93715e2ea
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class A { public static void main(String[] args){ new A().go(); } private void go() { Scanner in = new Scanner(System.in); int n=in.nextInt(),k=in.nextInt(); int[] list = new int[n]; for(int i=0;i<n;i++){ list[i] = ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
e3915ec68a356c083d2d7f07044f7fa0
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class RankList { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] l1 = br.readLine().split("\\s+"); ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
6106e6a1ac34c18261470b8fa319d0e7
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; public class CF113A { private static BufferedReader br; private static StringTokenizer st; private static PrintWriter pw; // private static Timer t = new Timer(); public CF113A() throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); pw = new P...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
c5e0ad13bc61cbb947890f1b19064c7f
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; public class CF113A { private static BufferedReader br; private static StringTokenizer st; private static PrintWriter pw; // private static Timer t = new Timer(); public CF113A() throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); pw = new P...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
afe3742a58673213081c44e8d7659c23
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; public class Solution { private static void solve(InputReader in, OutputWriter out) { int n, k; n = in.nextInt(); k = in.nextInt(); int[][] a = new int[n][2]; for (int i = 0; i < n; i++) { a[i][0] = in.nextInt(); ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
fabcae9f15f9ac5b23e37bb834fea9fc
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; public class P166A { class Team implements Comparable<Team> { int probs, time; Team(int p, int t) { probs = p; time = t; } public int compareTo(Team that) { ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
7778f262cab5719d00e2b189d910d7f1
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class RankList { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int[][]a=new int[n][2]; for(int i=0;i<n;i++) { a[i][0]=sc.ne...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
3d147916030bc54c183b6af3f1c9d076
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Scanner; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author KHALED */ public class RankList { public static void main(String[] args) { S...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
7d9825eea10462d372912151f41b0035
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; // 4/26/12 2:30 PM // by Abrackadabra public class A { public static void main(String[] args) throws IOException { if (args.length > 0 && args[0].equals("Abra")) debugMode = true; new A().run(); /*new Thread(null, new Runnable() { ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
5c1788b781df37098bca53566be474e4
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class RankList { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] p = new int[n]; int[] t = new int[n]; int k = sc.nextInt(); for (int i = 0; i < t.len...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
9982ceb960120de5c13e7f3b4af98a80
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException, NumberFormatException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st =...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
15c789956a07b48715f3aa5817ca082a
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.IOException; import java.util.Scanner; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Computragy */ public class RankList { public static void main(String[] args) throws IOException { Scanner cs = new Scanner(System....
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
465612e39e97e8c8fb35a3dd15f879bc
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; public class Rank { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=in.nextInt(); int k=in.nextInt(); ArrayList<Integer> a = new ArrayList<Integer>(); for(int i=0;i<n;i++) { a.add(in.nextInt()*100+51-in.nextInt()); } Collections.sort(a, Collections.reverseOr...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
7bdfb2b61c7312f6d7f5fe65fd65cd60
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Scanner; public class RankList { public static void main(String asd[])throws Exception { Scanner in=new Scanner(System.in); int n=in.nextInt(); int k=in.nextInt(); int a[]=new int[n]; int b[]=new int[n]; for(int i=0;i<n;i++) { ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
fd7ca465502a752e0df926cee8a4ed93
train_003.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Rank { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] arg = in.readLine().split(" ")...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places β€” 4 solved problems, the penalty time equals 10 4 place β€” 3 solved problems, the penalty time equals 20 5-6 places β€” 2 solved problems, the penalty time equals 1 7 place β€” 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 7
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≀ k ≀ n ≀ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≀ pi, ti ≀ 50) β€” the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output