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 | 7f50457727cc64fdbeffc09a0bf21f9d | train_002.jsonl | 1587653100 | On February 14 Denis decided to give Valentine to Nastya and did not come up with anything better than to draw a huge red heart on the door of the length $$$k$$$ ($$$k \ge 3$$$). Nastya was very confused by this present, so she decided to break the door, throwing it on the mountains.Mountains are described by a sequenc... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution
{
static InputReader in=new InputReader(System.in);
static OutputWriter out=new OutputWriter(System.out);
static StringBuilder sb=new StringBuilder();
static long MOD = (long)(1e9+7);
// Main Class Starts Here
public static ... | Java | ["5\n8 6\n1 2 4 1 2 4 1 2\n5 3\n3 2 3 2 1\n10 4\n4 3 4 3 2 3 2 1 0 1\n15 7\n3 7 4 8 2 3 4 5 21 2 3 4 2 1 3\n7 5\n1 2 3 4 5 6 1"] | 1 second | ["3 2\n2 2\n2 1\n3 1\n2 3"] | NoteIn the first example, you need to select a segment of mountains from $$$2$$$ to $$$7$$$. In this segment, the indexes $$$3$$$ and $$$6$$$ are peaks, so the answer is $$$3$$$ (only $$$2$$$ peaks, so the door will break into $$$3$$$ parts). It is not difficult to notice that the mountain segments $$$[1, 6]$$$ and $$$... | Java 8 | standard input | [
"implementation",
"greedy"
] | 8e182e0acb621c86901fb94b56ff991e | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then the descriptions of the test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$3 \leq k \leq n \leq 2 \cdot 10^5$$$) — the number of mountains and the length of the door. T... | 1,300 | For each test case, output two integers $$$t$$$ and $$$l$$$ — the maximum number of parts that the door can split into, and the left border of the segment of length $$$k$$$ that the door should be reset to. | standard output | |
PASSED | 61cd016f44a91f3dcbaf885c7ae78aa3 | train_002.jsonl | 1587653100 | On February 14 Denis decided to give Valentine to Nastya and did not come up with anything better than to draw a huge red heart on the door of the length $$$k$$$ ($$$k \ge 3$$$). Nastya was very confused by this present, so she decided to break the door, throwing it on the mountains.Mountains are described by a sequenc... | 256 megabytes | /* package whatever; // don't place package name! */
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 Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new ... | Java | ["5\n8 6\n1 2 4 1 2 4 1 2\n5 3\n3 2 3 2 1\n10 4\n4 3 4 3 2 3 2 1 0 1\n15 7\n3 7 4 8 2 3 4 5 21 2 3 4 2 1 3\n7 5\n1 2 3 4 5 6 1"] | 1 second | ["3 2\n2 2\n2 1\n3 1\n2 3"] | NoteIn the first example, you need to select a segment of mountains from $$$2$$$ to $$$7$$$. In this segment, the indexes $$$3$$$ and $$$6$$$ are peaks, so the answer is $$$3$$$ (only $$$2$$$ peaks, so the door will break into $$$3$$$ parts). It is not difficult to notice that the mountain segments $$$[1, 6]$$$ and $$$... | Java 8 | standard input | [
"implementation",
"greedy"
] | 8e182e0acb621c86901fb94b56ff991e | The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then the descriptions of the test cases follow. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$3 \leq k \leq n \leq 2 \cdot 10^5$$$) — the number of mountains and the length of the door. T... | 1,300 | For each test case, output two integers $$$t$$$ and $$$l$$$ — the maximum number of parts that the door can split into, and the left border of the segment of length $$$k$$$ that the door should be reset to. | standard output | |
PASSED | 0354ef9cad3720489d16fb1f86d79172 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.*;
public class cf222a {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] v = new int[n];
for(int i=0; i<n; i++) v[i] = in.nextInt();
boolean ok = true;
for(int i=k; i<n; i++) if(v[i] != v[k-1]) ok = false;
... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 3f2e5ad58bdddd915d0f7301e65c5049 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
public static void main(String args[]) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int[] nk = t_int_a(br, 2);
int[] v = t_int_a(br, nk[0]);
int k = nk[1];... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | c7cf6c7d6c1d3e0793d833e55fa956b9 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
public class test{
//ArrayList<Integer> lis = new ArrayList<Integer>();
//ArrayList<String> lis = new ArrayList<String>();
//
// static long sum=0;
... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 212984a8b3c7b14fa7c6736d7bdd81af | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Stack;
public class Main {
public static void main(String[] args) throws IOException {
Scanner in=new Scanner(new InputStreamReader(System.in)... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | e5b7879d83a656a7ca17939e621db0a3 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args) throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s=br.readLine();
String s2[]=s.split(" ");
int n=Integer.pars... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 31fdf4af6f8223dbbaf90deb40f0e489 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.Scanner;
public class problemA {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] a = new int[n];
boolean flag = true;
int ind = 0;
a[0] = in.nextInt();
... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 0ca6de4e92eae502c498433b0c045835 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes |
import java.util.Scanner;
public class P222A {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int k = scanner.nextInt() - 1;
int[] firsts = new int[k];
for (int i = 0; i < k; i++) {
firsts[i] = scanner.nextInt();
}
int... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 631fb73fbe75efde12d2a07e87ab30f9 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | //Codeforces Round 137 (Div. 2 Only)
//10 Sep 2012
import java.util.*;
import java.lang.Math;
import java.io.*;
public class A
{
public static void main (String[] args)
{
InputStream inputStream = System.in;
InputReader in = new InputReader(inputStream);
int n = in.nextInt();
int k = in... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 43353e7755e9ec34c1262bdf1bd3df2b | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
public class ShooshunsAndSequence {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String[] sp = r.readLine().split("[ ]+"... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | bf02ff7cba5fc791525c6888c027d2dd | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
BufferedReader in;
StringTokenizer str = null;
private String next() throws Exception{
if(str == null || !str.hasMoreElements())
str = new StringTokenizer(in.readLine());
return str.nextToken();
}
private int nextInt() throws Exception... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | c1adb1f59c1c0233f0617f6d4c39af47 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;
public class A
{
BufferedReader in;
PrintStream out;
StringTokenizer tok;
public A() throws NumberFormatException, IOException
{
... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 3227651c322e5f747270483d1d862bcd | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.Scanner;
public class prog {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int k=scan.nextInt();
int numbers[]=new int[n];
for (int i = 0; i < n; i++) {
numbers[i]=scan.nextInt();
... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 14234d10cd61a41c1686069abd3cf1aa | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Reader kb = new Reader(System.in);
int n = kb.nextInt();
int ... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 2e6563673d90f0cf51f7fbf79d2d4b83 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
public class A {
static StreamTokenizer st;
public static void main(String[] args) throws IOException{
st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.i... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 126fa5d4fdf1ed18662279eba3b305c8 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.Scanner;
public class A_ShooshunsAndSequence {
public static int getA(int[] array) {
int count = array.length - 1;
for (int i = array.length - 1; i > 0; i--) {
if (array[i] != array[i - 1]) {
break;
} else
count = i - 1;
}
return count;
}
public static void main(String[] arg... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | e383ffc2de9f6519ce771782678d4695 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 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.Random;
import java.util.StringTokenizer;
public class A137 {
BufferedReader reader;
StringTokenizer tokenizer;
PrintWriter out;
public void so... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | f220cabd645eb878dba247933232dd8f | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.util.*;
/**
*
* @author Rohan
*/
public class Main {
/**
* @param args the command line arguments
*/
static int[] arr=new int[100010];
public static void main(Str... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 30c02ba66ecdd660832ce6c7cd03ae9b | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes |
import java.io.BufferedInputStream;
import java.util.Arrays;
public class C222A {
public void solve() throws Exception {
int n = nextInt();
int k = nextInt() - 1;
int[] arr = new int[n];
for (int i = 0; i < arr.length; i++) {
arr[i] = nextInt();
}
for (int i = k; i < arr.length - 1; i++) {
if (ar... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 1c835986c0b819d3f0f199f68123e06e | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class hari {
public int temp(int [] a,int k){
int x=a[k-1];
for(int i=k;i<a.length;i++){
if(x!=a[i])
{
retu... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | a4783fae2a89017f86016eb2867749a8 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tokenizer = new StringToken... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 2e6dc97c19bbfd1cc563c29dfd9d825b | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class A {
static Scanner in; static int next() throws Exception {return in.nextInt();};
// static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
// static BufferedReader in;
sta... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | b15568a40e6857771645b41e88d0ae97 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
Scanner in;
PrintWriter out;
void solve() {
int n = in.nextInt();
int k = in.nextInt();
int sequence[] = new int[n];
for (int i = 0; i < n; i++) {
sequence[i] = in.nextInt();
}
for (int i... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 5f9029b355c59a76a9bb340541e1626e | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
InputReader r = new InputReader(System.in);
int d = -1;
int N = r.nextInt();
int K = r.nex... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | adcfd30affb5da3ae7c6b1483c3453ec | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.*;
import java.util.*;
public class pr137A implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer str;
public void solve() throws IOException {
int n = nextInt();
int k = nextInt();
int a[] = new int[n];
for (int i = 0; i < a.length; i++) {
a[i] = nextInt();
}
whi... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | e31a6ef63333d46ecff3ebd9279d680d | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes |
public class ABC
{
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
java.util.Scanner sc=new java.util.Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
int[] a=new int[n] ;
Boolean flag=... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | d049af8e92511a6a0dcd587b666f767f | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.*;
public class A222 {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int a[] = new int[n + 1];
for (int i = 1; i <= n; i++)
a[i] = in.nextInt();
if (n == 1) {
... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 96b42b54e739763633fe7116c6c98508 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
public class CF {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N =sc.nextInt();
int K = sc.nextInt()-1;
int[] array = new int[N];
for(int a=0;a<N;a++)array[a]=sc.nextInt();
HashSet... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 4e0d321043bba32b0cc10063e9ea7b31 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import static java.lang.Math.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class a implements Runnable {
public void run() {
int n = nextInt(), k = nextInt();
int arr[] = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
int a = arr[k - 1];
for (int i = k;... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | ead4186f6298ac43a9b8aa03432789dd | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;
public class A222
{
int[]num;
public static void main(String[]arg)
{
new A222().solve();
}
public void solve(){
Scanner in = new Scanner(new Buf... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 83c02ee7c9f0a93752f82c448c915f9d | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while (scan.hasNext()) {
int n = scan.nextInt();
int k = scan.nextInt();
int[] array = new int[n];
for (int i = 0; i < array.length; i++) {
array[i] = scan.nextInt();
}
... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | fbe55ffde99bcf8231610ae14eb75453 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.*;
import java.awt.geom.*;
public class Main{
private void doit(){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int n = sc.nextInt();
int k = sc.nextInt();
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | c4df4e4a552a23ce6581655bb356f36e | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.util.ArrayDeque;
import java.io.PrintWriter;
import java.util.Deque;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution ... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 178d60c78385b8ebdcd31c89ac2ff2c7 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class shoo
{
public static void main(String args[]) throws IOException
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
int k=sc.nextInt();
k--;
int a[]=new int[t];
for(int i=0;i<t;i++)
... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | 36ef53ff81abf76413cfe9f7f935e94a | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes |
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class A137 {
public void solve() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int i = 0, j = 0;
int a[] = new int[n];
int test[] = new int[n];
... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | ea6af137d54ee54c5af721009a761a50 | train_002.jsonl | 1347291900 | One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. T... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
int p=0,ans=0;
int a[] = new int [2*n];
for (int i = 1; i <= n; i++) {
a[i]=sc.nex... | Java | ["3 2\n3 1 1", "3 1\n3 1 1"] | 2 seconds | ["1", "-1"] | NoteIn the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.In the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and ... | Java 6 | standard input | [
"implementation",
"brute force"
] | bcee233ddb1509a14f2bd9fd5ec58798 | The first line contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 105). The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 105) — the sequence that the shooshuns found. | 1,200 | Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1. | standard output | |
PASSED | c8cf078da2ab0824ef380b56f54080e1 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class CF_237E {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String t = scan.next();
int n = scan.nextInt();
int[][] charFreq = new int[n+1][26];
int[] cap = new int[n];
for(int i=0;i<=n;i++) {
String line = i ... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 639446c3236026da53d5580fb4aacb19 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | //package practice.E;
import java.io.*;
import java.util.*;
public class CF237E {
static ArrayList<Edge>[] adj;
public static void main(String[] args) throws IOException{
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
char[] t = sc.next().toCharArr... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 5943ccf599b64d5d19b8f93bf32f411e | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | //package practice.E;
import java.io.*;
import java.util.*;
public class CF237E {
static ArrayList<Edge>[] adj;
public static void main(String[] args) throws IOException{
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
char[] t = sc.next().toCharArr... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | cc992a2b2a224b91875c0084e3ad13ab | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
/*
* Heart beats fast
* Colors and promises
* How to be brave
* How can I love when I am afraid...
*/
//read the question correctly (is y a vowel? what are the exact constraints?)
//look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
//always declare multidime... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | a66f73f347007c18b5e961bd7117f405 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
/*
* Heart beats fast
* Colors and promises
* How to be brave
* How can I love when I am afraid...
*/
//read the question correctly (is y a vowel? what are the exact constraints?)
//look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
//always declare multidime... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | dcb01d3080a92a294911782595a22698 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
/*
* Heart beats fast
* Colors and promises
* How to be brave
* How can I love when I am afraid...
*/
//read the question correctly (is y a vowel? what are the exact constraints?)
//look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
//always declare multidime... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 3860acb84345acdc740a3fd841bc39b5 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class Main {
public static void main(String[] args) throws IOException {
new Main().run();
}
BufferedReader in;
PrintWriter out;
StringTokenizer st = new StringTokenizer("");
private void run() thr... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | e7513002d614a985070915075e44d747 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | // practice with rainboy
import java.io.*;
import java.util.*;
public class CF237E extends PrintWriter {
CF237E() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF237E o = new CF237E(); o.main(); o.flush();
}
static final int A = 26, INF = 0x3f3f3f3f;
i... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 2f4692bb34acbfe49bd4c3f8927ff827 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
public class E237 implements Runnable {
final static int INF = Integer.MAX_VALUE;
class Edge {
int from, to, capacity, cost, flow;
Edge(int from, int to, int capacity, int cost) {
this.from = from;
this.to = to;
this.capacity = capacity;
this.cost = cost;... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | ce7d06062e10da019a9abbff0ba56b81 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.awt.FlowLayout;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Set;
import java.util.StringTokenizer;
... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 0463ae5c4bacfd2ee32f0c1e90c05bc0 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.awt.FlowLayout;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Set;
import java.util.StringTokenizer;
... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 35079870bc201d3f2cdf97edecd3b463 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.util.*;
import java.io.*;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = 1000000007;
static int inf = (int) 1e15;
static ArrayList<Integer>[] ad;
static int n, cost, flow, s, t;
static int[][] cap, val;
static int[] dist, p;
public static void main(String[] ... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 8d1fdc1a7c8bb6ee26a6f748658a9452 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.util.*;
import java.io.*;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = 1000000007;
static int inf = (int) 1e15;
static ArrayList<Integer>[] ad;
static int n, cost, flow, s, t;
static int[][] cap, val;
static int[] dist, p;
public static void main(String[] ... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | d409b7365cef6662e8bbc77e3d76fdcb | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.List;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Iterator;
import java.io.IOExc... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | c35fe0c2bdd63bf6413d0fccce990cfe | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitS... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 3c4b0f35571591d9df018c87b415beac | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitS... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | f8c13c15be1a7b9d1440763bb436064c | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.AbstractQueue;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 336e3cb9503899c034a8ea46a8c783b4 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.*;
import java.util.function.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.IntStream.*;
import static java.util.stream.Collectors.*;
public class Main {
public static void main(String[] args... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 1d86830c5fab57c2848b6cc57a2c8d31 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.*;
import java.util.function.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.IntStream.*;
import static java.util.stream.Collectors.*;
public class Main {
public static void main(String[] args... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | b88378cd068ae88633de61e55c19867e | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.*;
import java.util.function.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.IntStream.*;
import static java.util.stream.Collectors.*;
public class Main {
public static void main(String[] args... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | f2cb556805b4b55ce82d60da5a4c4ceb | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.*;
import java.util.function.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.IntStream.*;
import static java.util.stream.Collectors.*;
public class Main {
public static void main(String[] args... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 8166f73fda12c8a90f59c000250f1006 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.*;
import java.util.function.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.IntStream.*;
import static java.util.stream.Collectors.*;
public class Main {
public static void main(String[] args... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 040f4f6f7c4dbc48719d16a8ebd0ee7f | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.*;
import java.util.function.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.IntStream.*;
import static java.util.stream.Collectors.*;
public class Main {
public static void main(String[] args... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 577e37b568d38cbdc578e439aad9e5a2 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class Abood2D {
stat... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 8 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 4e75d99dac7f3e126cc6f4141112e207 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.ut... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | b3692a3de19ef716a9efa622bfa69650 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class BuildString {
public static void main(String[] args) {
InputReader r = new InputReader(System.in);
String ... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 6e06205cbffbb571ab9ce822d5d4db7e | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.util.*;
//import java.io.*;
public class E {
int n;
int sink, source;
int [][]cap, cost, f;
boolean debug = true;
public void run() throws Exception{
//Scanner in = new Scanner(new File("input.txt"));
Scanner in = new Scanner(System.in);
String s = in.next();
int k = in.nextInt();
String... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | b60a3b89291d0843791a541594139ccf | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 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 E147 {
BufferedReader reader;
StringTokenizer tokenizer;
PrintWriter out;
static final int INF = Integer.MAX_VA... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | ab2237a74f8bb86c16ad965bf4905afb | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
public class E237 implements Runnable {
final int INF = Integer.MAX_VALUE;
int n, ans, total;
int[] d, p;
int[][] cap, flow, cost;
ArrayList<Integer>[] g;
private void Solution() throws IOException {
String t = nextToken();
n = nextInt();
String[] s = new String[n];... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 7b66c1d8b436d39eced695e968510593 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
public class E237 implements Runnable {
final int INF = Integer.MAX_VALUE;
Deque q;
int n, ans, total;
int[] id, d, p;
int[][] cap, flow, cost;
ArrayList<Integer>[] g;
private void Solution() throws IOException {
String t = nextToken();
n = nextInt();
String[] s = ... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 821fd6c8810edce792e39b9f87ffe81b | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.*;
import java.util.*;
public class E237 implements Runnable {
final int INF = Integer.MAX_VALUE;
Deque q;
int n, ans, total;
int[] id, d, p;
int[][] cap, flow, cost;
ArrayList<Integer>[] g;
private void Solution() throws IOException {
String t = nextToken();
n = nextInt();
String[] s = ... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 7d8a1dd38f98ea01c931819178662a48 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
/**
* @param args
*/
static char[] t;
static char[][] s;
static int[] a;
static int[][] cap, cost;
static i... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 820cdb96785549227c5639d9acbcae53 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class Main {
/**
* @param args
*/
static char[] t;
static char[][] s;
static int[] a;
sta... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | d6cba54fc06ad3a49c8746cb82125eec | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
/**
* @param args
*/
static char[] t;
static char[][] s;
static int[] a;
static int[][] cap, cost;
static i... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 488a206151e365e9c2409ef9b2506c4b | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class Main {
/**
* @param args
*/
static char[] t;
static char[][] s;
static int[] a;
sta... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 1c568fa0326e477b17b6af8738493337 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class Main {
/**
* @param args
*/
static char[] t;
static char[][] s;
static int[] a;
sta... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | da085ee40a46c3e29c921d8b78082df4 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
/**
* @param args
*/
static char[] t;
static char[][] s;
static int[] a;
static int[][] cap, cost;
static i... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | ee0422de68b1e671c4ef602d03198c66 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class Main {
/**
* @param args
*/
static char[] t;
static char[][] s;
static int[] a;
sta... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | f1bc9ab80b792b8b3ced2a001e0ec40e | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.Scanner;
public class e {
int maxn = 510, maxm = 10100, inf = 1 << 28;
class ... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 6275a9a0eaae838f91e995e9a76fa9ff | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.Scanner;
public class e {
int maxn = 510, maxm = 10100, inf = 1 << 28;
class ... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | cf2fa804645aba30a91d0ab38926b98e | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.util.*;
public class E {
Scanner sc = new Scanner(System.in);
void doIt()
{
int vnum = 0;
Graph g = new Graph(20000);
String line = sc.next();
int [] cnt = new int[256];
for(int i = 0; i < line.length(); i++) cnt[(int)line.charAt(i)]++;
// 0をソース
// 1をシンク
// 2-27 第1層 a-z
for(int i = 0; ... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | e1b958765e76e68a9da77c7c7297df01 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class MinCostMax
{
static class Scanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
public String... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 0c747cf66b102af6576c7e06ed25e328 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class Main
{
public static void main(String args[]) throws IOException
{
BufferedReader c=new BufferedReader(new InputStreamReader(System.in));
String s=c.readLine();
int N=Integer.parseInt(c.readLine());
int cap[][]=new int[N+26+2][N+26+2];
... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | a514bd365b26f01532dd9dfa8bfaa51d | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
public class Probl... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 9952924f6cc5e3b810986af794b6ff6f | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | //package round147;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;
public class E {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
char[... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 1056c3e2c8d20fc2399b587f4aa29d9b | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
try {
String packageName = new Main().getClass().getPackage().getName();
System.setIn(new FileInputStream("src/" + packageName + "/input.txt"));
... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | 957bc1b916ab4b4e7e0cb969ccdce206 | train_002.jsonl | 1351179000 | You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each operation looks like that: choose any non-empty string from strings s1, s2, ..., sn; choose an ar... | 256 megabytes | import static java.lang.Math.*;
import java.io.*;
import java.util.*;
public class Template {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String next() {
while (st==null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine());
} catch (Exception e) {}
}
return st.... | Java | ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1"] | 2 seconds | ["8", "18", "-1"] | NoteNotes to the samples:In the first sample from the first string you should take characters "b" and "z" with price 1 ruble, from the second string characters "a", "e" и "b" with price 2 rubles. The price of the string t in this case is 2·1 + 3·2 = 8.In the second sample from the first string you should take two chara... | Java 6 | standard input | [
"flows",
"graphs"
] | adc23c13988fc955f4589c88829ef0e7 | The first line of the input contains string t — the string that you need to build. The second line contains a single integer n (1 ≤ n ≤ 100) — the number of strings to which you are allowed to apply the described operation. Each of the next n lines contains a string and an integer. The i-th line contains space-separate... | 2,000 | Print a single number — the minimum money (in rubles) you need in order to build string t. If there is no solution, print -1. | standard output | |
PASSED | e1121ff1a3899d94687a32fd786f9829 | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class rtain {
public static void main(String[] args) throws IOException {
InputReader input = new InputReader(System.in)... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | 1d7da0a444595605973ff2857a042c81 | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
FastScanner in;
PrintWriter out;
void solve() {
//This is the main logic code
int x = in.nextInt();
long y = in.nextInt();
int cnt = 1;
int f = in.nextInt();
while(x-->1) {
int f1 = in.nextInt();
if(f1... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | fb77f621e26e1c62f8012089650518bd | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes |
import java.util.Scanner;
public class CrazyComputer {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n= sc.nextInt();
int t= sc.nextInt();
int a[]=new int[n];
for (int i = 0; i < n; i++) {
a[i]=sc.nextInt();
}
i... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | 6c7c11954049800615e3ef988e165b28 | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | import java.util.Scanner;
public class Main{
private static int count = 1;
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int num = in.nextInt();
int c = in.nextInt();
int[] arr = new int[num];
for(int i =... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | 3bb8c30f4aabe250ccb5795484518b50 | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
/**
*
* @author scilab5
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
F... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | e9f7477ef2d8ad4b1c592385a788a287 | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | import java.util.Scanner;
/**
*
* @author scilab5
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner console = new Scanner (System.in) ;
int n = console.nextInt() ;
int c = console.nextInt() ;
int []x = ... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | fa9dd30880a81b7438b2e6eadee1ba1e | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | import java.util.Scanner ;
public class A716_CrazyComputer {
public static void main(String[] args) {
Scanner ss =new Scanner (System.in) ;
int n = ss.nextInt() ;
int c = ss.nextInt() ;
int w = 0 ;
long f = ss.nextLong() ;
long tan = 0 ;
for (int i = 1 ; i < n ; i ++ ) {
tan = ss.nextLon... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | 174b3f594597a9e83b2767f1d9d0085f | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | /**
* @(#)CrazyComputer.java
*
*
* @author
* @version 1.00 2016/10/19
*/
import java.util.*;
public class CrazyComputer {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
int y = in.nextInt();
int total = 0;
int prev = 0;
... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | 1e1996cbeb40fca4daf36c7bd3577f01 | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | /**
* @(#)CrazyComputer.java
*
*
* @author
* @version 1.00 2016/10/19
*/
import java.util.*;
public class CrazyComputer {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int first = in.nextInt();
int second = in.nextInt();
int total = 0;
int a = 0;
for (int i=0;... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | 6679ad0f21fcfb87b325d0ddcafda610 | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | /**
* @(#)CrazyComputer.java
*
*
* @author
* @version 1.00 2016/10/19
*/
import java.util.*;
public class CrazyComputer {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
int y = in.nextInt();
int total = 0;
int prev = 0;
for (int i=0; i<x; ... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | 0ed1d59b429a48191dd4666cb021dba8 | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 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 Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int c =... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | f0140dfc11aea2508aad5aa4c6241a9e | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | /* package whatever; // don't place package name! */
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 Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new ... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | d08fd120010f5072da725664a9e8c1ae | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | //package com.company;
import java.util.Scanner;
public class Crazy_Computer {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
long k = input.nextLong();
String[] s = new String[n];
for(int i=0;i<n;i++)
... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | 532d65345316b2db06cf29d1114da2ed | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | import java.util.*;
public class Problem_716A
{
public static void main(String[] args)
{
Scanner sc= new Scanner(System.in);
int n=sc.nextInt();
int c=sc.nextInt();
int[]a=new int[n];
for(int i=0;i<n;i++)
a[i]=sc.nextInt();
int w=1;
for(int i=0;i<n-1;i++)
{
if(a[i+1]-a[i] <= c)
w++;
else
... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | 277b99eed9a9e17fb8bf838bf8914fe1 | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | /**
* Created by mo on 9/23/16.
*/
import java.util.*;
import java.io.*;
public class Problem716A {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt(), c = sc.nextInt();
int count = 0;
int in[] = new int[n];
for (int i = 0; i... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output | |
PASSED | aab1384b57167c1ad1fe6a40bf9b0645 | train_002.jsonl | 1474119900 | ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then eve... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String args[]) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Scanner in = new Scanner(inputStream);
PrintWriter out = new PrintWri... | Java | ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10"] | 2 seconds | ["3", "2"] | NoteThe first sample is already explained in the problem statement.For the second sample, after typing the first word at the second 1, it disappears because the next word is typed at the second 3 and 3 - 1 > 1. Similarly, only 1 word will remain at the second 9. Then, a word is typed at the second 10, so there will ... | Java 8 | standard input | [
"implementation"
] | fb58bc3be4a7a78bdc001298d35c6b21 | The first line contains two integers n and c (1 ≤ n ≤ 100 000, 1 ≤ c ≤ 109) — the number of words ZS the Coder typed and the crazy computer delay respectively. The next line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... < tn ≤ 109), where ti denotes the second when ZS the Coder typed the i-th word. | 800 | Print a single positive integer, the number of words that remain on the screen after all n words was typed, in other words, at the second tn. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.