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 | e8a4cc4a0c35e72ff388d2d5aae1b21a | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes |
//cd ~/BAU/ACM-ICPC/Teams/A++/BlackBurn95
//sudo apt-get Accepted
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
p... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | a8c3f0985cadb017cb7fe7a669f717d7 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes |
//cd ~/BAU/ACM-ICPC/Teams/A++/BlackBurn95
//sudo apt-get Accepted
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
p... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | e1d27a3e118fe17ac7153fdf019778ea | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.PrintWriter;
import java.util.*;
public class c
{
public static void main(String[] arg)
{
new c();
}
public c()
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int m = in.nextInt();
int[][] adj = new int[n][n];
int[][] graph ... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | c11d16bdabd371d0717a9a9f08b82c50 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
public class A {
public static Scanner scn=new Scanner(System.in);
public static void main(String[] args) {
int n= scn.nextInt();
int m=scn.nextInt();
//Graph
boolean g[][]=new boolean[405][405];
boolean visited[]=new boolean[405];
int distance[]=new int[405];
//input edge... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 4eac07e54c29b130793949f9f491fbad | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Queue;
import java.util.ArrayDeque;
im... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | e1fd93bf5719047fb11fdfedb88cddb5 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;
/**
*
* @author harera
*/
public class Main {
static i... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | d5761ace64a3dbbc08515374e24b44a4 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 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.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class TwoRoutes {
int n;
void solve() {
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 743da20da15884d0ca303b7abe7225dc | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
//System.setIn(new FileInputStream("input.txt"));
Scanner scanner = new Scanner(System.... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 6c54aa1d458b3eec02e4598de1b82810 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF602C {
static class Pair {
int v, d;
Pair(int v, int d) {
this.v = v;
this.d = d;
}
@Override public int hashCode() {
return v;
}
@Override public boolean equals(Object o) {
Pair p = (Pair) o;
return v == p.v;
}
}
public static void m... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | cabfcdc1f7b62a5fca5ee2f11d0c2ab2 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class Main {
static boolean[][] g;
static int n;
static boolean [] vis1;
static boolean [] vis2;
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
n = input.nextInt();
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | d84d3b93e72cf20c172d45c4df82a89b | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import static java.lang.Math.*;
public class Main {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
Pr... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 5926c9ae0fbf910cb237d57dfb3205e5 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
public class C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int numrw = in.nextInt();
int[][] rw = new int[n][n];
for (int i = 0; i < numrw; i++) {
int a = in.nextInt();
int b = in.nextInt();
rw[a-1][b-1] = 1;
rw[b-... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | fe31118fb8a7d07e06ed6ea5285b68dd | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class ThetwoRoutes {
static ArrayList<Integer> rai... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | d0e10bfd50e68249df67fbcea09b4f6a | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String[] firstLine = s.nextLine().split(" ");
int N = Integer.parseInt(firstLine[0]);
int M = Integer.parseInt(firstLine[1]);
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 36bbf94145aa8acdd35d294e5b84334d | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
import java.util.StringTokenizer;
public class C {
public static void main(String[] args) {
Scanner2 sc = new Sca... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 62d63da39cdac4d62ad0d27835d1e2e8 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
static private BufferedReader in;
static private PrintWriter out;
static {
try {
in = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter(new FileWriter("output.txt"));
} catch (Exception ex) ... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 7df708c565729c4deacff05a52660884 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public final class Solution
{
static int target;
static boolean[][] visited , railways , roads;
public static void main(String[] args)
{
Reader input = new Reader();
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | d0d99d8a406ee53eb562fbba854edb8b | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes |
import java.io.*;
import java.lang.reflect.AnnotatedArrayType;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Random;
import java.util.StringTokenizer;
public class Main {
long b = 31;
String fileName = "";
////////////////////// SOLUTION SOLUTION SOLUTION //////////////... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 4731fb243ad0a597ff3de7e924a6e29d | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Scanner;
public class CFProbC {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int towns = input.nextInt();
int railroads = input.nextInt();
boolean[][]... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 5aa5ff56e11fb5ab9f5bc68b423d241e | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes |
import java.util.Scanner;
public class Main {
public static class Node{
int index;
int level;
public Node(int index,int level){
this.index = index;
this.level = level;
}
}
public static int bfs(int[][] graph,int edge){
Node source = new Node(0,0);
Node [] queue = new Node[graph.length];
int st... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 22ffdcf735ac77ce0219c32a2dfccf72 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
static List<Integer>[] rails, roads;
static int n;
public static void main(String... thegame) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
n = Integer.... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 45cd27476b61cf16a819a9d8a5d48924 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
import java.io.*;
public class Hue {
static class Solution {
InputReader in;
PrintWriter out;
public void bfs(int[] ans,ArrayList<Integer>[] adj) {
Queue<Integer> q = new ArrayDeque<Integer>();
ans[1] = 0;
q.offer(1);
... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | a2052df89a76a9791ef4d34f0ad4752b | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
public class TwoRoutes
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int m = input.nextInt();
int[][] matrix = new int[n][n];
Node[] nodes = new Node[n];
for (int k = 0; k < n; k++)... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 950a0a761cef780ed5614486425bfae8 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 5171668ec52d99a60c325a0b3f626ee5 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.*;
import java.util.*;
public class C602 {
public static void main(String[] args) throws IOException {
input.init(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = input.nextInt(), m = input.nextInt();
int[][] rail = new int[n][n], bus = new int[n][n];
for(int i = 0; ... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 325c537079892b84efb96f66e95d2796 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.LinkedList;
import java.util.HashSet;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Collection;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Queue;
import java.io.IOException;
import java.util.Set;
import java.... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 4612f2b3b888e992ee30cf4673f36eca | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
public static void main(String args[]) {
InputReader in=new InputReader(System.in);
int n = in.nextInt(),m=in.nextInt();
boolean train[][]=new boolean[n+1][n+1];
boolean bus[][]=new boolean[n+1][n+1];
boolean visited[][]=new boolean[n+1][n+1];
int m... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 5c8a08aaec59fb467ac3a81494c758f4 | train_002.jsonl | 1448382900 | In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Queue;
import java.util.LinkedList;
im... | Java | ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"] | 2 seconds | ["2", "-1", "3"] | NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4. | Java 8 | standard input | [
"graphs"
] | fbfc333ad4b0a750f654a00be84aea67 | The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra... | 1,600 | Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output - 1. | standard output | |
PASSED | 6acebaf3a725259413b39dcad498e22c | train_002.jsonl | 1535387700 | This problem is interactive.You should guess hidden number $$$x$$$ which is between $$$1$$$ and $$$M = 10004205361450474$$$, inclusive.You could use up to $$$5$$$ queries.In each query, you can output an increasing sequence of $$$k \leq x$$$ integers, each between $$$1$$$ and $$$M$$$, inclusive, and you will obtain one... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class G {
static PrintWriter out = new PrintWriter(System.out);
static FS in = new FS();
static long dp[][];
static int MAXK = 10000;
static final boolean... | Java | ["2\n\n0\n\n-1"] | 2 seconds | ["2 2 3\n\n2 20 30\n\n3 5 7 9"] | NoteIn the first example the number $$$5$$$ is hidden. | Java 8 | standard input | [
"dp",
"interactive"
] | fff0deb3f5f2df8935684abfe07c31bf | null | 3,000 | null | standard output | |
PASSED | 434ff89d3ce7f40ca64001878fa313ea | train_002.jsonl | 1535387700 | This problem is interactive.You should guess hidden number $$$x$$$ which is between $$$1$$$ and $$$M = 10004205361450474$$$, inclusive.You could use up to $$$5$$$ queries.In each query, you can output an increasing sequence of $$$k \leq x$$$ integers, each between $$$1$$$ and $$$M$$$, inclusive, and you will obtain one... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces1028G {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//StringTokenizer st = new StringTokenizer(br.readLine());
//Make sure size equals M - in fact it equals ... | Java | ["2\n\n0\n\n-1"] | 2 seconds | ["2 2 3\n\n2 20 30\n\n3 5 7 9"] | NoteIn the first example the number $$$5$$$ is hidden. | Java 8 | standard input | [
"dp",
"interactive"
] | fff0deb3f5f2df8935684abfe07c31bf | null | 3,000 | null | standard output | |
PASSED | b0a9cf83962ca19bd8e0ceaef287697a | train_002.jsonl | 1535387700 | This problem is interactive.You should guess hidden number $$$x$$$ which is between $$$1$$$ and $$$M = 10004205361450474$$$, inclusive.You could use up to $$$5$$$ queries.In each query, you can output an increasing sequence of $$$k \leq x$$$ integers, each between $$$1$$$ and $$$M$$$, inclusive, and you will obtain one... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOExcept... | Java | ["2\n\n0\n\n-1"] | 2 seconds | ["2 2 3\n\n2 20 30\n\n3 5 7 9"] | NoteIn the first example the number $$$5$$$ is hidden. | Java 8 | standard input | [
"dp",
"interactive"
] | fff0deb3f5f2df8935684abfe07c31bf | null | 3,000 | null | standard output | |
PASSED | e3fb180458d3a637c7688b7815cbdf79 | train_002.jsonl | 1535387700 | This problem is interactive.You should guess hidden number $$$x$$$ which is between $$$1$$$ and $$$M = 10004205361450474$$$, inclusive.You could use up to $$$5$$$ queries.In each query, you can output an increasing sequence of $$$k \leq x$$$ integers, each between $$$1$$$ and $$$M$$$, inclusive, and you will obtain one... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
impo... | Java | ["2\n\n0\n\n-1"] | 2 seconds | ["2 2 3\n\n2 20 30\n\n3 5 7 9"] | NoteIn the first example the number $$$5$$$ is hidden. | Java 8 | standard input | [
"dp",
"interactive"
] | fff0deb3f5f2df8935684abfe07c31bf | null | 3,000 | null | standard output | |
PASSED | 6a2b6a1c5f1f58e8a5e5bc5f3fb909ab | train_002.jsonl | 1535387700 | This problem is interactive.You should guess hidden number $$$x$$$ which is between $$$1$$$ and $$$M = 10004205361450474$$$, inclusive.You could use up to $$$5$$$ queries.In each query, you can output an increasing sequence of $$$k \leq x$$$ integers, each between $$$1$$$ and $$$M$$$, inclusive, and you will obtain one... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["2\n\n0\n\n-1"] | 2 seconds | ["2 2 3\n\n2 20 30\n\n3 5 7 9"] | NoteIn the first example the number $$$5$$$ is hidden. | Java 8 | standard input | [
"dp",
"interactive"
] | fff0deb3f5f2df8935684abfe07c31bf | null | 3,000 | null | standard output | |
PASSED | dfe8d7bdbf35102edd57e8f89007e8a9 | train_002.jsonl | 1535387700 | This problem is interactive.You should guess hidden number $$$x$$$ which is between $$$1$$$ and $$$M = 10004205361450474$$$, inclusive.You could use up to $$$5$$$ queries.In each query, you can output an increasing sequence of $$$k \leq x$$$ integers, each between $$$1$$$ and $$$M$$$, inclusive, and you will obtain one... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
public class G {
static final int K = 10000;
static final int Q = 5;
static final long M = 10004205361450475L;
long[][] dp = new long[Q + 1][K + 1];
{
for (long[] row : dp) {
Arrays.fill(row, -1);
}
}
long go(long ... | Java | ["2\n\n0\n\n-1"] | 2 seconds | ["2 2 3\n\n2 20 30\n\n3 5 7 9"] | NoteIn the first example the number $$$5$$$ is hidden. | Java 8 | standard input | [
"dp",
"interactive"
] | fff0deb3f5f2df8935684abfe07c31bf | null | 3,000 | null | standard output | |
PASSED | a3da1f4c3465bbdb14a561c5e71e32e7 | train_002.jsonl | 1535387700 | This problem is interactive.You should guess hidden number $$$x$$$ which is between $$$1$$$ and $$$M = 10004205361450474$$$, inclusive.You could use up to $$$5$$$ queries.In each query, you can output an increasing sequence of $$$k \leq x$$$ integers, each between $$$1$$$ and $$$M$$$, inclusive, and you will obtain one... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
public class AIM_5F {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new... | Java | ["2\n\n0\n\n-1"] | 2 seconds | ["2 2 3\n\n2 20 30\n\n3 5 7 9"] | NoteIn the first example the number $$$5$$$ is hidden. | Java 8 | standard input | [
"dp",
"interactive"
] | fff0deb3f5f2df8935684abfe07c31bf | null | 3,000 | null | standard output | |
PASSED | dd24b4bf9db423d38e523f29a6a1dbac | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes |
import java.io.*;
import java.util.HashSet;
import java.util.StringTokenizer;
public class A778 {
public static void main(String args[]) throws Exception {
Reader reader = new Reader();
reader.initConsoleReading();
String a = reader.next();
String b = reader.next();
int n =... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 09935ae276e915615353cc820b104378 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class icpc
{
public static void main(String[] args) throws IOException
{
// Reader in = new Reader();
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String s = in.readLine();
String p = in... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | a319a91dc53ceea79dfcecffee3b187c | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class StringGame implements Closeable {
private InputReader in = new InputReader(System.in);
p... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 9c85ce5321c14a339a76215156397779 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.HashSet;
import java.util.Scanner;
public class cf_778a {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s1 = in.nextLine();
String s2 = in.nextLine();
int len = s1.length();
int[] p = new int[len];
for (int i = 0; i < len; i++)
p[i] = in.nextInt()... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | fa1be29f5726feba9827ed9b7396dca4 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.awt.*;
import java.io.*;
import java.util.*;
public class Abc {
public static void main(String[] args) throws Exception {
// Scanner sc = new Scanner(System.in);
FastReader sc=new FastReader();
String t=sc.next(),p=sc.next();
int ind[]=new int[t.length()];
for (in... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 04fee3d046b7088fb5ed24567f4fdfaf | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.Scanner;
/**
* Created by nikr0716 on 2/28/2017.
*/
public class BinarySearchMain {
static StringBuffer S;
static StringBuffer t;
static int len;
static int[] numbers;
static int[] prioritiesToDelete;
public static void main(String[] args) {
Scanner in = new Scanner(S... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 6629d90f4f93c394517448c15651706f | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.Scanner;
public class _4_str {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
String s = scn.next();
String s2 = scn.next();
int[] arr = new int[s.length()];
int[] time = new int[s.length()];
for (int i = 0; i < s.length(); i++) {
arr[i] = scn.nextIn... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | ac6a4c5284640906aff77f9bba2a58bc | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes |
import java.io.*;
import java.util.*;
public class StringGame {
static String s , x;
static int arr[];
static boolean check(int r){
char[]c= s.toCharArray();
for (int i = 0; i < r; i++) {
c[arr[i]]='A';
}
int y=0;
for (int i = 0; i < c.length; i++) {
... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 7b75dbc1e622f517a9c7a9743438cd80 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.Scanner;
public class A778 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char[] S = in.next().toCharArray();
char[] T = in.next().toCharArray();
int[] A = new int[S.length];
for (int n=1; n<=S.length; n++) {
A[i... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | e825bbd422ece0a742e38f733211dc73 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFi... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 6726c63ed3e41b0cda9e612535aba9c6 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.util.*;
public class Main {
//////
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 5f0666d51871730ead66537b00f2b5ec | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.*;
import java.util.*;
public class Solution {
static int ssearch(StringBuffer a,String b){
int n1=a.length();
int n2=b.length();
int i=0;
for( int j=0;i<n2&&j<n1;j++){
if(b.charAt(i)==a.charAt(j))
i++;
}if(i==n2)
return 1;
else return 0;}
static ... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 294f053f7f0ef0600c5962380d7ad54c | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.*;
public class buying {
public static String p;
public static String t;
public static int pp;
public static int tt;
public static int[] n = new int[200000];
public static int find(int left, int right){
if(left==right){
return left;
}
int middle=(left+right)/2+1;
int i,j;
i=0;
f... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 9c0026f29ee34d5843d495c9dee0ae43 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;
public class C {
static boolean isSubSequence(char[] str1, char[] str2, int m, int n){
int j = 0;
for (int i = 0; i < n && j < m; i++)
if (str1[j] == str2[i])
j++;
return (j == m);
}
publi... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 1b8fe5fed4ece379392884f70aec7ab7 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class StringGame {
static final int N = 100000+10;
static int n , m... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 98b0f3d8c20b0e92d9d31247d133d9b9 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Books {
static int [] arr;
static String s,sub;
public static void main(String[] args) {
FastReader sc=new FastReader();
s=sc.next();
sub=sc.... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | a0dbe8552ca2a4ed430012eeeae3f8b2 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author crodoc
*/
public class Main {
public static void main(String[] args) {
InputStream in... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | e904556288a8fa9ad9cee43a169d02e3 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author crodoc
*/
public class Main {
public static v... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | d97fe284f94b55534c8091a6ca9531c4 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class Sample {
private static final Scanner sc = new Scanner(System.in);
private static final PrintWriter pw = new PrintWriter(System.out);
private static StringBuffer ans = new StringBuffer();
private static char[] p;
private static int[] ... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 4986244829d04c46f057f4f032636cc1 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.*;
import java.util.*;
/**
* Created by noureldin on 2/20/17.
*/
public class main {
private static String A,B;
private static int n,m;
private static int [] T;
private static boolean can(int end){
boolean [] dont = new boolean[n];
for(int i = 0;i <= end;i++) dont[T[i]] = ... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | ee0c5d1ffe5da7f81a54885998beb8ac | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.*;
import java.util.*;
public class ready {
public static class FastReaderFile
{
BufferedReader br;
StringTokenizer st;
public FastReaderFile(InputStream in)
{
br = new BufferedReader(new
InputStreamReader(in));
}
... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 84711ca2b136f08a0557dc2c06ad9f89 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
4 1
1011
0000
0010
1000
*/
public class MYpro {
static ArrayList<Integer> adj[];
static boolean used[];
static int dovjunu[];
public static void main(String[] args) throws IOExcepti... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | f1ab8698174d2395cfc82ce80d457974 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* Created by akash.bansal on 03/03/17.
*/
public class CodeF778A {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String abc = new String(scan.next());
String def = new Strin... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 8073620f32721f0f5fbbe8b33a859c85 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class StG {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
char[] a = scan.next().toCharArray(), b = scan.next().toCharArray();
int n = a.length;
int[] arr = new int[n];
for (int i = 0; i < arr.length; i++) {
arr... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | eeabbad8eb568c9bc280458573de6be4 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
import static java.lang.Short.parseShort;
import static java.lang.Byte.parseByte;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Contest ... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 4cc9d3e783f4ec0acb06ba50921a2654 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.*;
import java.util.*;
public class c{
static int mod=1000000007;
static PrintWriter out = new PrintWriter(System.out);
static boolean ok(char t[],char p[],int a[],int mid){
boolean v[] = new boolean[a.length];
for(int i=0;i<mid;i++)
... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 05d39260c0aa1a7d73c05b6b6faef8bb | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | /*
Keep solving problems.
*/
import java.util.*;
import java.io.*;
public class CFA {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
final long MOD = 1000L * 1000L * 1000L + 7;
int[] dx = {0, -1, 0, 1};
int[] dy = {1, 0, -1, 0};
void solve() throws IOException {... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 6a9c3fd1e7e06e50d7154ff3aa2121d7 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.*;
import java.util.StringTokenizer;
/**
* 778A
* O(n*log(n)) time
* θ(n) space
*
* @author artyom
*/
public class _778A implements Runnable {
private BufferedReader in;
private StringTokenizer tok;
private int solve() throws IOException {
String t = nextToken(), p = nextToken... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 5ab8dc6839ffb9c8dd7a9652ab61ff1c | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main7{
static public void main(String args[])throws IOException{
int tt=1;
StringBuilder sb=new StringBuilder();
for(int ttt=1;ttt<=tt;ttt++){
String s=s();
Strin... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | d21a4af8781299eed64f91fd27a2e408 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.*;
import java.io.*;
public class cf
{
static int n;
static int k;
static String s1;
static String s2;
static int arr[];
public static boolean check(int num)
{
Set<Integer> hs=new HashSet<Integer>();
for(int i = 0 ;i<num;i++)
{
hs.add(arr[... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 2bc28dc2df0871fcfc73b330156b9129 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class CF778A {
static char[] src;
static char[] target;
static int[] p;
// static char[][] states;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
src = sc.next().toCharArray();
target = sc.next().toCharArray();
p = n... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 32a0f74a82d3ab4041c50aff2ba9c257 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
*
* @author Ala Abid
*/
public class JavaApplication98 {
/**
* @param args the command line arguments
*
*/
static String s;
stati... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 5515cbf6c302fc69ad9f7a0b926d1125 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.*;
public class PlayOnTheLine {
public void run() {
Scanner in = new Scanner(System.in);
String t = in.next();
String p = in.next();
int[] A = new int[t.length()];
for (int i = 0; i < t.length(); i++) {
A[i] = in.nextInt();
}
in... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | a40e99732b465a677561d5264fd23206 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.awt.Point;
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.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.uti... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 8c4f351347002f86b1d43b9272f54f2a | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;
public class A {
public static void main(String[] args) throws Exception {
new A().run();
}
public void run() throws Exception {
FastScanner f = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
char[] s = f.n... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | c0db9063b67befd6f0f3f9ef43a54eaf | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.util.*;
import java.util.Arrays;
public class stringgame {
/*public static boolean stableState(String cur, String key){
int i;
int j = 0;
int found = 0;
for(i = 0; i< cur.length(); i++){
if(cur.charAt(i)== key.c... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 0aaad068ee07fdc7d987364ebfb3b117 | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes |
import java.util.*;
import java.io.*;
import java.net.*;
import java.sql.*;
import java.awt.*;
import java.text.*;
import java.math.*;
import java.time.*;
import javax.swing.*;
public class Main {
//http://codeforces.com/problemset/problem/778/A(����)
private static char[] string_t,string_p;
private static boolean[]... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | d1656e8f63e3267a803cac956d1b667a | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | /* DHUOJ solution #356081 @ 2018-07-26 19:11:12.450 */
import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]) {
Solution solution = new Solution();
solution.compute();
}
}
class Solution {
String t;
String p;
int[] a;
boolean[] moved;
void compute() {
Scanner ... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 6968a05564e421ce95fd5cee1057562f | train_002.jsonl | 1488096300 | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain or... | 512 megabytes | import java.io.*;
import java.util.*;
public class MyClass {
public static void main(String args[]) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) ;
String t=br.readLine();
String p=br.readLine();
String[] Str = br.readLine().split(" "... | Java | ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5"] | 2 seconds | ["3", "4"] | NoteIn the first sample test sequence of removing made by Nastya looks like this:"ababcba" "ababcba" "ababcba" "ababcba" Nastya can not continue, because it is impossible to get word "abb" from word "ababcba".So, Nastya will remove only three letters. | Java 8 | standard input | [
"binary search",
"greedy",
"strings"
] | 0aed14262c135d1624df9814078031ae | The first and second lines of the input contain the words t and p, respectively. Words are composed of lowercase letters of the Latin alphabet (1 ≤ |p| < |t| ≤ 200 000). It is guaranteed that the word p can be obtained by removing the letters from word t. Next line contains a permutation a1, a2, ..., a|t| of letter ... | 1,700 | Print a single integer number, the maximum number of letters that Nastya can remove. | standard output | |
PASSED | 49f7f45ae02e70f699e6f73d48c5e529 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
/**
*
* @author Saju
*
*/
public class Main {
private static int dx[] = { 1, 0, -1, 0 };
private static int dy[] = { 0, -1, 0, 1 };
private static final long INF = (long) Math.pow(10, 16);
private static final int INT_INF = Integer.MAX_VA... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | f3a6e3859529b1094be72ffaaf782224 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static BufferedReader in;
static PrintWriter out;
static StringTokenizer buffer;
public static void solve() {
int n=ni(), m=ni();
... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 14a09981dd62fbd69fc6bc9ff92b52f6 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Problem3 {
static int ptr;
public static void main(String[] args) throws InterruptedExce... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 0fa6eeb178836e85a4ba6249fd380ec2 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | //package contest702;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
ArrayList<Integer> a = new ArrayList<Integer>();
for(int i = 0; i < n; i++){
int temp... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 8fdc0e34d6f1fe488b18c472b953488b | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes |
/*
* Author- Priyam Vora
* BTech 2nd Year DAIICT
*/
import java.io.*;
import java.math.*;
import java.util.*;
import javax.print.attribute.SetOfIntegerSyntax;
public class Graph1 {
private static InputStre... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 8f3d0968adfd0f8c68ae4ae6fcca3115 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.*;
import java.util.*;
public class Ultimo {
public static void main(String[] args) throws FileNotFoundException {
Scanner in = new Scanner(System.in);
int n = Integer.parseInt(in.next());
int m = Integer.parseInt(in.next());
int v1[] = new int[n];
int v2[] =... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 6a5e1ed88757ac52aea4e0701c226df4 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.util.List;
import java.util.Scanner;
public class problemF {
public static int runBinarySearchIteratively(long[] sortedArray, long key, int low, int high) {
while (low < high) {
int mid = (low + high + 1) / 2;
if (mid >= sortedArray.length) {
break;
... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | c21dc5ba2b8e9805ea05ba16f3087637 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.util.*;
public class Towers {
static long Max(long a, long b){
if(a>b) return a;
return b;
}
static long Min(long a, long b){
if(a>b) return b;
return a;
}
static long Abs(long a){
if (a<0) return -a;
return a;
}
//COMMENT
/* static int FindNext(ArrayList<Long> Cities, ArrayLis... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 796f5544c50fc2afced75c89fce72b74 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Stack;
import java.util.Vector;
impo... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 26adc13a46ab973abe48d89f95afc568 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
* Created by Valeriy Belaventsev on 30.07.2016.
*/
public class ProblemC {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 0f5a31ee631f19b4a1af23bf69b36116 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static InputReader in;
public static PrintWriter pw;
public static void main(String args[]) {
new Thread(null, new Runnable() {
public void run() {
try{
solv... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | f287f7b351b0f426d96275b51b11b3c6 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.util.*;
import java.io.*;
/**
*
* @author Umang Upadhyay
*/
public class C702 {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n = in.nextInt();
int m = in.... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 9ce909865c1ce8f765ff2d8ef40929cd | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes |
/**
*
* @author sarthak
*/
import java.util.*;
import java.math.*;
import java.io.*;
public class edurnd15_C {
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner(InputStream is) {
br = new BufferedReader(new InputStreamReader(is));
... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 64cf8779bae1883b0a93bea5f2187780 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (Scanner in = new Scanner(System.in)) {
int N = in.nextInt();
int M = in.nextInt();
int[] cities = new int[N];
int[] towers = new int[M];
for (int i = 0;... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | a4f0d70a296fe5764e961acc96cee85b | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Arrays;
public class TaskC{
public static void main(String[] args) {
TaskC tC = new TaskC();
PrintWriter pw = new PrintWriter(System.out);
tC.solve(new Scanner(System.in), pw);
pw.close();
}
public void solve(Scanner input, P... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 968f14a79cd1d204a62379604f40a070 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;
public class C {
static boolean bs1(int[] b, int sz, int target, int x, int status) {
int lo = 0;
int hi = sz - 1;
while (lo <= h... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | ba4eccdd430627e4a0bc7bd7ded1cb75 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class CellularNetwork {
public static int binary_search(int b[], int key) {
int lo = 0;
int hi = b.length - 1;
int nearest = Integer.MAX_VALUE;
while (lo <= hi) {
// Key is in a[lo..hi] or not present.
int mid... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | f71ee1b3e4edb0323b2f878f4ee1b11a | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
public class C {
public static void main(String[]args)throws IOException,NumberFormatException{
BufferedReader bf =new BufferedReader(new InputStreamReader(System.in));
String s=bf.readLine();
String[]sa=s.split(" ");
... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 0e22d809e39679f3ec9e19b3d2f80f2e | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | dcc3afb7e832bce959f9952b05f6b3fc | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.util.*;
public class TaskC {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int[] houses = new int[n];
int[] towers = new int[m];
for (int i = 0; i < n; i++) {
houses[... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 9dbf11755a9d07e23093793fea655431 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String [] args) {
final int N = 100000 + 10;
int[] a = new int[N];
int[] b = new int[N];
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
for(int i = 0; i < n; ++i)
a[i] = in.nextInt();
for(int i = 0; i ... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 7fe02a740b2a17fd78abf8f85fdf4082 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.util.*;
public class Solution702C {
public static void main(String[] args) {
Solution702C ss = new Solution702C();
ss.run();
}
void run() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), m = sc.nextInt();
int[] city = new int[n], net = new int[m];
for (int i = 0; i < n; i++)
... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | a0ec55f6df81efd152c19a3dd653d8f8 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class BasicJava
{
public BasicJava()
{
}
public InputReader in = new InputReader(System.in);
public PrintWriter out = new PrintWriter(System.out);
public int n = in.nextInt();
public int m = in.nextInt();
public int[] ... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 2788f1bce2593f868474e3af92c8c3a5 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class C {
static TreeSet<Long> post;
static final long INF = Long.MAX_VALUE / 2L;
static long lower(l... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 699da5e6a8125771977d1dfe272f9e1f | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 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.Comparator;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeMap;
im... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output | |
PASSED | 06320210136123b3f57edc48647ff261 | train_002.jsonl | 1469804400 | You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than r from t... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class C702 {
public static boolean valid(int[] country, int[] tower, long mid){
boolean[] covered = new boolean[country.length];
for (int i = 0, j = 0; i < covered.length && j<tower.length;) {
int t = tower[j];
int c = country[i];
Circle tow ... | Java | ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15"] | 3 seconds | ["4", "3"] | null | Java 8 | standard input | [
"two pointers",
"binary search",
"implementation"
] | 9fd8e75cb441dc809b1b2c48c4012c76 | The first line contains two positive integers n and m (1 ≤ n, m ≤ 105) — the number of cities and the number of cellular towers. The second line contains a sequence of n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coo... | 1,500 | Print minimal r so that each city will be covered by cellular network. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.