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 | 89b6e114edf9635b88571de7a42df89c | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF1313B extends PrintWriter {
CF1313B() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1313B o = new CF1313B(); o.main(); o.flush();
}
void main() {
int t = sc.nextInt();
wh... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 206bfb7ae74d2f509633fec385e6c114 | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner in=new Scanner(System.in);
int t=in.nextInt();
while(t-->0)
{
int n=in.nextInt();
int min=in.nextInt();
int max=in.nextInt(); int sum=max+min;
int f=0;
... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | c0dc1dd1077d041f47830da177d7d2cf | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.io.*;
import java.util.*;
public class gym{
public static void main(String[] args) throws Exception{
MScanner sc=new MScanner(System.in);
PrintWriter pw=new PrintWriter(System.out);
int tc=sc.nextInt();
while(tc-->0) {
long n=sc.nextLong(),x=sc.nextLong(),y=sc.nextLong();
long max=x+y-n;
... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 1853914f3f053c28ffc8e78a7ccc6493 | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes |
import java.io.*;
import java.lang.*;
import java.math.*;
import java.util.*;
public class B2 {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws Exception {
int n = in.nextInt();
int par, first, secon... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 38356ed22ea89f1d34b0f646e902e79f | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf1313b {
public static void main(String[] args) throws IOException {
int t = ri();
while(t --> 0) {
int n = rni(), x = ni(), y = ni();
prln(max(1, x + y + ... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 639fceb90889284a7d208d4430b69cf4 | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.function.*;
import java.u... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 82d250c5d63d070f2680b290728fc057 | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.function.*;
import java.u... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 14cbc7ebbad0eeba97a7ecbb23c7d3ca | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.sql.PseudoColumnUsage;
import java.util.*;
public class D {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int cases = sc.nextInt();
for(int i=0;i<cases;i++)
{
//int arr[] =new int[3];
int n =sc.nextInt();
... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | a5262e8aa19cd099086c255cff553ccc | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.util.*;
import java.io.*;
public class B622
{
public static void main(String [] args)
{
MyScanner sc = new MyScanner();
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int t = sc.nextInt();
while (t > 0) {
int n = sc.nextInt(); int... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 69b8a1f6629ddf6333000b00b44f4883 | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Class2 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 66a58df3e87ea428e3432d6cf6c8ff9d | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
for(int i=0;i<t;i++) {
... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 5d66fe429333c36d3ab81582a793be6c | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.io.*;
import java.util.*;
//import javafx.util.*;
import java.math.*;
//import java.lang.*;
public class Main
{
// static int n;
static HashSet<Integer> adj[];
static boolean vis[];
// static long ans[];
// static int arr[];
static long mod=1000000007;
static final ... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 33eb6f7f1e834810dfa406d487350f0a | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 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.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.Input... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 34804d30d1f24210a2e859591d7dd976 | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int t = in.nextInt();
while (t > 0) {
int n, x, y;
n = in.next... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | e057c341d78c2c984f4feec09fa9783a | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.util.*;import java.io.*;import java.math.*;
public class temp
{
public static void process()throws IOException
{
long n=nl();
long a=nl();
long b=nl();
long best=0,worst=0;
if(a+b<=n)
{
best=1;
worst=a+b-1;
}
els... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 41a00c8c84416c41cdcf3e77c560d847 | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | // package com.company;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.sql.SQLOutput;
import java.util.*;
public class Main {
public static void main(Str... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | e0e15684bb8c613996fffc27f73fc2f6 | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
while (t-- > 0) {
int a = input.nextInt();
int b = input.nextInt();
int c = input.nextInt();
int ... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 1d3b19118314ee1c737a4b742de2f145 | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 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;
import java.math.BigInteger;
import java.net.StandardSocketOptions;
import java.security.cert.CollectionCertStoreParameters;
import... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | 9095a1c6ba6db4179427fee5f3bd70cd | train_002.jsonl | 1582448700 | Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
// FCApplicationManager applicationManager = new FCApplicationManager();
//applicationManager.init();
Scanner sc = new Scanner(System.in);
Integer testcases = sc.nextInt();
... | Java | ["1\n5 1 3", "1\n6 3 4"] | 1 second | ["1 3", "2 6"] | NoteExplanation for the first example:Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows: However, the results of the Olympiad could also look like this: In the first case Nikolay would have taken first place, and in the second — third pl... | Java 11 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | 58c887568002d947706c448e6faa0f77 | The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases to solve. Each of the following $$$t$$$ lines contains integers $$$n$$$, $$$x$$$, $$$y$$$ ($$$1 \leq n \leq 10^9$$$, $$$1 \le x, y \le n$$$) — the number of participants in the olympiad, the place that Nikolay took in the firs... | 1,700 | Print two integers — the minimum and maximum possible overall place Nikolay could take. | standard output | |
PASSED | c2bf1759be04293528149446d17a3044 | train_002.jsonl | 1605796500 | Alice and Bob are playing a game. They have a tree consisting of $$$n$$$ vertices. Initially, Bob has $$$k$$$ chips, the $$$i$$$-th chip is located in the vertex $$$a_i$$$ (all these vertices are unique). Before the game starts, Alice will place a chip into one of the vertices of the tree.The game consists of turns. Ea... | 512 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf1452g_3 {
public static void main(String[] args) throws IOException {
int n = ri(), dist[] = new int[n], ans[], t[] = new int[n];
fill(dist, -1);
Graph g = tree(n);
... | Java | ["5\n2 4\n3 1\n3 4\n3 5\n2\n4 5", "8\n4 1\n8 4\n4 5\n6 4\n2 5\n4 3\n1 7\n3\n2 8 3", "10\n2 5\n4 3\n7 3\n7 2\n5 8\n3 6\n8 10\n7 9\n7 1\n4\n10 6 9 1"] | 3 seconds | ["2 1 2 0 0", "3 0 0 3 1 2 3 0", "0 2 2 2 2 0 2 2 0 0"] | null | Java 11 | standard input | [
"data structures",
"dfs and similar",
"greedy",
"trees"
] | 7c64045ad4b9ec35467a6f6536b76323 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of vertices in the tree. Then $$$n - 1$$$ lines follow, each line contains two integers $$$u_i$$$, $$$v_i$$$ ($$$1 \le u_i, v_i \le n$$$; $$$u_i \ne v_i$$$) that denote the endpoints of an edge. These edges form a tree. The next l... | 2,700 | Print $$$n$$$ integers. The $$$i$$$-th of them should be equal to the number of turns the game will last if Alice initially places her chip in the vertex $$$i$$$. If one of Bob's chips is already placed in vertex $$$i$$$, then the answer for vertex $$$i$$$ is $$$0$$$. | standard output | |
PASSED | 0e22a7a9a3f97d7eb0eb943a636c0f02 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Suptee
*/
public class Arrays_572A {
/**
* @param args the command line arguments
*/
publ... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 91246a48ad4f03abeb571c2845399804 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Strings {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int na=sc.nextInt();int nb=sc.nextInt();
int k = sc.nextInt();int m=sc.nextInt();
int[]a=new int[na];int[]b=new int[nb];
for (int i = 0; i < na; i++) {
a... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | c4837544d8590df1ff41edb0fc4e36e3 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.*;
public class mom {
public static void main (String [] args){
Scanner sc = new Scanner (System.in);
int arr[] = new int [2];
arr[0]= sc.nextInt();
arr[1]= sc.nextInt();
int arr2[] = new int [2];
arr2 [0]=sc.nextInt();
arr2 [1]=sc.nextInt();
int arr3[]= new in... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 83439656a2a521d750341ee4500e1b0f | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Arrays {
public static void main(String[] args) {
int nA, nB;
int k, m;
ArrayList<Integer> A = new ArrayList<Integer>(); ArrayList<Integer> B = new ArrayList<Integer>();
Scanner sc = new Scanner(System.in);
nA = sc.nextInt();
n... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | d97ba9e8e79266e0dbf5a91f5348b1b3 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Lecture1 {
public static void main (String[] args) {
Scanner scanner = new Scanner (System.in);
int numberOfArraysA = scanner.nextInt();
int numberOfArraysB = scanner.nextInt();
scanner.nextLine();
int nu... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 94331a2727027c5d6effb373b1734272 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | f446d45e2056bd4b50f4342398282a8e | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes |
import java.io.*;
import java.util.*;
public class NewClass {
public static void main(String[] args) throws IOException {
InputReader in = new InputReader(System.in);
OutputWriter out = new OutputWriter(System.out);
int na = in.nextInt(),nb=in.nextInt(),k=in.nextInt(),m=in.nextInt();
... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | c3cf3f6ad8bb9e8827d8d01935ad3754 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.Scanner;
public class Arrays {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int na = scan.nextInt();
int nb = scan.nextInt();
int n = scan.nextInt();
int m = scan.nextInt();
int[] a = new int[na];
int[] b =... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | f74f1003aaabcc16121791a5602595c6 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | //package Contests;
import java.util.*;
import java.io.*;
public class ArraysCF {
public static void disp(int[] arr){
for(Integer x: arr)
System.out.print(x+" ");
}
public static void main(String[] args) {
MyScanner sc=new MyScanner();
PrintWriter out=new PrintWriter(System.... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 2ffe9629f3ec8a7563e327fb5812e325 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes |
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class array {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStre... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 76ec96d8d7a5dafd41397027776b49f3 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;
import java.io.BufferedWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.IOExc... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | a6461bb98603d7e0ca1d30cc5931e9d1 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//package arrays;
import java.util.Scanner;
/**
*
* @author hacnguyen12
*/
public class Arrays {
/**
* @param args the c... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | a2ef3df1e6faecd7477be3c20fc2b94e | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
long [] a, b;
int na = in.nextInt();
int nb = in.nextInt();
a = new long[na];
b ... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | a00e516151b2444f4d22a403dd2f2c72 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import javax.lang.model.util.ElementScanner6;
public class Main {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
int m=scan.nextInt();
int a=scan.nextInt();
int b=scan.nextInt();
int x[]=new int[n];
for(int... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 6bdfebaf47dc3de188cb2ee28d31568b | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.Scanner;
public class Array {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int na = s.nextInt();
int nb = s.nextInt();
int k = s.nextInt();
int m = s.nextInt();
long[] a = new long[na];
long[] b = new long[nb];
for (int i = 0; i < na; i++) a[i] = s.... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | e3e39b44b0248aff86f2b37c2cc79fcd | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import org.omg.PortableInterceptor.INACTIVE;
import java.io.*;
import java.util.*;
/**
* Created by Алексей on 06/26/2016.
*/
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.random;
import static java.lang.Math.*;
public class TriangleEasy {
public static void... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 5101137e07e5e88a542a25153a57d2b4 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import org.omg.PortableInterceptor.INACTIVE;
import java.io.*;
import java.util.*;
/**
* Created by Алексей on 06/26/2016.
*/
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.random;
import static java.lang.Math.*;
public class TriangleEasy {
public static void... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 2246093e6c63f8e8861f6156b44ce070 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
int sizeOfA, sizeOfB;
int numChosenA, numChosenB;
ArrayList<Integer> Array_A = new ArrayList<Integer>();
ArrayList<Integer> Array_B = new ArrayList<Integer>();
@SuppressWarnings("resour... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 5c71032358b54eb8605b13763b44ebc6 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
int sizeOfA, sizeOfB;
int numChosenA, numChosenB;
ArrayList<Integer> Array_A = new ArrayList<Integer>();
ArrayList<Integer> Array_B = new ArrayList<Integer>();
@SuppressWarnings("resour... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | db31cc2d05d922eae56c16515fe078bf | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
int sizeOfA, sizeOfB;
int numChosenA, numChosenB;
ArrayList<Integer> Array_A = new ArrayList<Integer>();
ArrayList<Integer> Array_B = new ArrayList<Integer>();
@SuppressWarnings("resour... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 0bb93d93feee51653e18d0c2dd1ad6cb | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.Scanner;
public class Problem {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n_A = scanner.nextInt();
int n_B = scanner.nextInt();
scanner.nextLine();
int k = scanner.nextInt();
int m = scanner.nextInt();
... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | f8b4eb746fa505adc1ea15edb6405cf8 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Scanner;
import java.util.function.IntBinaryOperator;
public class ArraysTask {
public static int[] getArray(int size) {
int[] array = new int[size];
for (int i = 0; i < size; i++) {
... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | f8781e88789345c47c79a7604a62db26 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes |
import java.util.Scanner;
public class Arrays {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int a = input.nextInt();
int b = input.nextInt();
int n = input.nextInt();
int k = input.nextInt();
... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 681a0550700dd13102255e52cb742649 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | //package codeforces;
import java.util.Scanner;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.TreeMap;
import java.util.TreeSet;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Stack;
im... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 13e4705b99c7b19177db89a9316b3881 | train_002.jsonl | 1440261000 | You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array. | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Sample implements Runnable
{
static int n,m;
static int max=1000005;
static int[] s=new int[max];
static int[] a=new int[max];
public static void solve()
{
n=i();
... | Java | ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2"] | 2 seconds | ["YES", "NO", "YES"] | NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers c... | Java 8 | standard input | [
"sortings"
] | 8e0581cce19d6bf5eba30a0aebee9a08 | The first line contains two integers nA, nB (1 ≤ nA, nB ≤ 105), separated by a space — the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1 ≤ k ≤ nA, 1 ≤ m ≤ nB), separated by a space. The third line contains nA numbers a1, a2, ... anA ( - 109 ≤ a1 ≤ a2 ≤ ... ≤ anA ≤ 109), sepa... | 900 | Print "YES" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 8f2a4a312427a8386a9921c52ff16fb2 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
// import java.util.StringTokenizer;
import java.util.*;
public class Starter {
public void Run() throws IOException {
int n = in.nextInt();
int m = in.nextInt();
int q =... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 6e06b8baf6f35c08760aa233c6a9e6cc | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
// import java.util.StringTokenizer;
import java.util.*;
public class Starter {
public void Run() throws IOException {
int n = in.nextInt();
int m = in.nextInt();
int q =... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 7f288f596c97c55097813da45b00633f | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.*;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
public cl... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | bc198c29ed13772d76f87fd71e036d04 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.*;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
public c... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 0360cf5c42bbe8c4fa871e9bf4f9cc44 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.*;
import java.util.*;
import java.io.*;
import java.util.*;
public class D
{
public static int up[][];
public static int maxe;
public static void main(String[] args) throws Exception {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 4994af2d8278e1936cb06b96a8e451d4 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does 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.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOExcept... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | fd4e4d4b81d3a6eec22dc2e40e8ab3ea | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
/**... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | fb6acc07a873a751e91063765551c6e6 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class B {
static byte[] buf = new byte[1<<26];
static int bp = -1;
public static void main(String[] args) throws IOException {
/**/
DataInputStream in = new DataInputStream(System.in);
/*/
DataInputStream in = new DataInputStream(new Fi... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | af765343ef30964d76d2262bd75c5a47 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class B {
static int N,M,Q;
static int[] perm, ar, answers;
static ArrayList<Query> qsHere[];
static int[][] lift;
static in... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 1b5ebe144ec22520dc15beb432a34e3b | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does 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.util.Iterator;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
imp... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 665fd957268f846acf7bf2c98726e315 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 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.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
impo... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | d320906b00ced37bb99ec8e7d92747c7 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.function.LongBinaryOperator;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | c24e4f78ee37179bb2f85e731cc48bea | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String... args) { new Main().work(); }
void work() { WORK(); out.close(); }
class InputReader {
BufferedReader br;
StringTokenizer st;
InputReader(InputStream stream) {
br = new Buffered... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | b3e40cd343028d0d4ae7d670a03c685c | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String... args) { new Main().work(); }
void work() { WORK(); out.close(); }
class InputReader {
BufferedReader br;
StringTokenizer st;
InputReader(InputStream stream) {
br = new Buffered... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | cb31a5833f4aeefbbb7c8e13fbb28ec4 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String... args) { new Main().work(); }
void work() { WORK(); out.close(); }
class InputReader {
BufferedReader br;
StringTokenizer st;
InputReader(InputStream stream) {
br = new Buffered... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 620d736436d235b5a2b281f857765ae4 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.util.*;
import java.io.*;
public class answer{
static class SparseTree{
int n;
int root;
int[][] dp;
int[] depth;
SparseTree(int n,int m,LinkedList<Integer>[] al){
this.n = n;
root = m;
dp = new int[20][n];
de... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | b7ae2081fbe5504a7aa1fd8e0a1127b5 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.util.*;
import java.io.*;
public class issam{
public static int n,m,q;
public static int[] a,b;
public static int[] dp;
public static int[] aft;
public static LinkedList<Integer>[] al;
public static class SparseTree{
int n;
int root;
int[][] dp;
int[] ... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | f3dc385efc3972fbc18a2575bcbcaa04 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class B {
public static void main(String[] args) {
FastScanner fs=new FastScanner();
int permLen=fs.nextInt(), arrLen=fs.nextI... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 210eca437f06225004bdc6dc57bea994 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | /*
ID: tommatt1
LANG: JAVA
TASK:
*/
import java.util.*;
import java.io.*;
public class cf1142b{
public static void main(String[] args)throws IOException {
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 58e23371f9cebacb81c59c42cbc3afff | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | //package com.company;
// Always comment out package when submitting.
import java.io.*;
import java.util.*;
public class Main {
public static class Task {
public void solve(Scanner sc, PrintWriter pw) throws IOException {
int n = sc.nextInt();
int m = sc.nextInt();
int... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | c2fcb5db4416f8ae99669659ac73079a | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | /*Author: Satyajeet Singh, Delhi Technological University*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
import java.math.*;
public class Main{
/*********************************************Constants******************************************/
static PrintWriter ... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 2c8fb4b1a4d3dc605b21b07d68f25ce3 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 6810d4376185c0e97f5ef58973386bf2 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 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 numCh... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 54ff9ed7a09a0f4401c18e7e74480430 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
new Main().go();
}
PrintWriter out;
Reader in;
BufferedReader br;
Main() throws IOException {
try {
//br = new BufferedReader( new FileReader("in... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 626fc5725f5aec1fec1b4f666322304f | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
// import java.util.StringTokenizer;
import java.util.*;
public class Starter {
public void Run() throws IOException {
int n = in.nextInt();
int m = in.nextInt();
int q =... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | c471e886233a33d7a30126092a89463f | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does 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.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOExcept... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | a1dd0ec2282c63e84507f9ac1004db50 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 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.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* @author khokharnikunj8
*/
public class Main {
public static void main(... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | be4d650bb2c5b6b8d90b20a0d8c0e8e6 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.awt.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.List;
import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;
public class ArchiveSolving implements Runnable{
// SOLUTION AT THE TOP ... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | 876fb1949f87f3e97868645a0d4d0ec5 | train_002.jsonl | 1553965800 | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t... | 256 megabytes | import java.io.FileInputStream;
import java.util.*;
import static java.lang.Math.max;
import static java.lang.Math.min;
public class TaskB {
int INF = 1000100;
int n, m, q;
int[] ps, as;
int[] dp;
int[][] aft;
Map<Integer, Integer> mp = new HashMap<>();
Map<Integer, ArrayList<Integer>> ids... | Java | ["3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5", "2 4 3\n2 1\n1 1 2 2\n1 2\n2 3\n3 4"] | 2 seconds | ["110", "010"] | NoteIn the first example the segment from the $$$1$$$-st to the $$$5$$$-th positions is $$$1, 2, 3, 1, 2$$$. There is a subsequence $$$1, 3, 2$$$ that is a cyclic shift of the permutation. The subsegment from the $$$2$$$-nd to the $$$6$$$-th positions also contains a subsequence $$$2, 1, 3$$$ that is equal to the permu... | Java 8 | standard input | [
"dp",
"math",
"data structures",
"dfs and similar",
"trees"
] | 4aaeff1b38d501daf9a877667e075d49 | The first line contains three integers $$$n$$$, $$$m$$$, $$$q$$$ ($$$1 \le n, m, q \le 2 \cdot 10^5$$$) — the length of the permutation $$$p$$$, the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers from $$$1$$$ to $$$n$$$, where the $$$i$$$-th of them is the $$$i$$$-th elem... | 2,000 | Print a single string of length $$$q$$$, consisting of $$$0$$$ and $$$1$$$, the digit on the $$$i$$$-th positions should be $$$1$$$, if the subsegment of array $$$a$$$ from the $$$l_i$$$-th to the $$$r_i$$$-th positions, inclusive, contains a subsequence that is a cyclic shift of $$$p$$$, and $$$0$$$ otherwise. | standard output | |
PASSED | e7c95e540af8000f5e6495ba878cad72 | train_002.jsonl | 1386493200 | Berland is going through tough times — the dirt price has dropped and that is a blow to the country's economy. Everybody knows that Berland is the top world dirt exporter!The President of Berland was forced to leave only k of the currently existing n subway stations.The subway stations are located on a straight line on... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class E_218 {
static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st = new StringTokenizer("");
stati... | Java | ["3\n1 100 101\n2"] | 2 seconds | ["2 3"] | NoteIn the sample testcase the optimal answer is to destroy the first station (with x = 1). The average commute time will be equal to 1 in this way. | Java 7 | standard input | [
"two pointers",
"greedy",
"math"
] | 321dfe3005c81bf00458e475202a83a8 | The first line of the input contains integer n (3 ≤ n ≤ 3·105) — the number of the stations before the innovation. The second line contains the coordinates of the stations x1, x2, ..., xn ( - 108 ≤ xi ≤ 108). The third line contains integer k (2 ≤ k ≤ n - 1) — the number of stations after the innovation. The station co... | 2,000 | Print a sequence of k distinct integers t1, t2, ..., tk (1 ≤ tj ≤ n) — the numbers of the stations that should be left after the innovation in arbitrary order. Assume that the stations are numbered 1 through n in the order they are given in the input. The number of stations you print must have the minimum possible aver... | standard output | |
PASSED | 6a9166fa796e29670b1173c0fc85d1d7 | train_002.jsonl | 1386493200 | Berland is going through tough times — the dirt price has dropped and that is a blow to the country's economy. Everybody knows that Berland is the top world dirt exporter!The President of Berland was forced to leave only k of the currently existing n subway stations.The subway stations are located on a straight line on... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class E_21... | Java | ["3\n1 100 101\n2"] | 2 seconds | ["2 3"] | NoteIn the sample testcase the optimal answer is to destroy the first station (with x = 1). The average commute time will be equal to 1 in this way. | Java 7 | standard input | [
"two pointers",
"greedy",
"math"
] | 321dfe3005c81bf00458e475202a83a8 | The first line of the input contains integer n (3 ≤ n ≤ 3·105) — the number of the stations before the innovation. The second line contains the coordinates of the stations x1, x2, ..., xn ( - 108 ≤ xi ≤ 108). The third line contains integer k (2 ≤ k ≤ n - 1) — the number of stations after the innovation. The station co... | 2,000 | Print a sequence of k distinct integers t1, t2, ..., tk (1 ≤ tj ≤ n) — the numbers of the stations that should be left after the innovation in arbitrary order. Assume that the stations are numbered 1 through n in the order they are given in the input. The number of stations you print must have the minimum possible aver... | standard output | |
PASSED | 95c5ea80c115bcb3461688468eb126af | train_002.jsonl | 1386493200 | Berland is going through tough times — the dirt price has dropped and that is a blow to the country's economy. Everybody knows that Berland is the top world dirt exporter!The President of Berland was forced to leave only k of the currently existing n subway stations.The subway stations are located on a straight line on... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
public class E_218 {
static BufferedReader stdin = new BufferedReader(new... | Java | ["3\n1 100 101\n2"] | 2 seconds | ["2 3"] | NoteIn the sample testcase the optimal answer is to destroy the first station (with x = 1). The average commute time will be equal to 1 in this way. | Java 7 | standard input | [
"two pointers",
"greedy",
"math"
] | 321dfe3005c81bf00458e475202a83a8 | The first line of the input contains integer n (3 ≤ n ≤ 3·105) — the number of the stations before the innovation. The second line contains the coordinates of the stations x1, x2, ..., xn ( - 108 ≤ xi ≤ 108). The third line contains integer k (2 ≤ k ≤ n - 1) — the number of stations after the innovation. The station co... | 2,000 | Print a sequence of k distinct integers t1, t2, ..., tk (1 ≤ tj ≤ n) — the numbers of the stations that should be left after the innovation in arbitrary order. Assume that the stations are numbered 1 through n in the order they are given in the input. The number of stations you print must have the minimum possible aver... | standard output | |
PASSED | fef15d534bf35a56e5d28b9433651b84 | train_002.jsonl | 1386493200 | Berland is going through tough times — the dirt price has dropped and that is a blow to the country's economy. Everybody knows that Berland is the top world dirt exporter!The President of Berland was forced to leave only k of the currently existing n subway stations.The subway stations are located on a straight line on... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
public class E_218 {
static BufferedReader stdin = new BufferedReader(new... | Java | ["3\n1 100 101\n2"] | 2 seconds | ["2 3"] | NoteIn the sample testcase the optimal answer is to destroy the first station (with x = 1). The average commute time will be equal to 1 in this way. | Java 7 | standard input | [
"two pointers",
"greedy",
"math"
] | 321dfe3005c81bf00458e475202a83a8 | The first line of the input contains integer n (3 ≤ n ≤ 3·105) — the number of the stations before the innovation. The second line contains the coordinates of the stations x1, x2, ..., xn ( - 108 ≤ xi ≤ 108). The third line contains integer k (2 ≤ k ≤ n - 1) — the number of stations after the innovation. The station co... | 2,000 | Print a sequence of k distinct integers t1, t2, ..., tk (1 ≤ tj ≤ n) — the numbers of the stations that should be left after the innovation in arbitrary order. Assume that the stations are numbered 1 through n in the order they are given in the input. The number of stations you print must have the minimum possible aver... | standard output | |
PASSED | f3b355af791274bcff79c8b01efd88b1 | train_002.jsonl | 1386493200 | Berland is going through tough times — the dirt price has dropped and that is a blow to the country's economy. Everybody knows that Berland is the top world dirt exporter!The President of Berland was forced to leave only k of the currently existing n subway stations.The subway stations are located on a straight line on... | 256 megabytes | /* CodeForces Template v0.20 by Sergey Esipenko */
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;
public class Main implements Runnable {
/* START OF SOLUTION */
void ... | Java | ["3\n1 100 101\n2"] | 2 seconds | ["2 3"] | NoteIn the sample testcase the optimal answer is to destroy the first station (with x = 1). The average commute time will be equal to 1 in this way. | Java 7 | standard input | [
"two pointers",
"greedy",
"math"
] | 321dfe3005c81bf00458e475202a83a8 | The first line of the input contains integer n (3 ≤ n ≤ 3·105) — the number of the stations before the innovation. The second line contains the coordinates of the stations x1, x2, ..., xn ( - 108 ≤ xi ≤ 108). The third line contains integer k (2 ≤ k ≤ n - 1) — the number of stations after the innovation. The station co... | 2,000 | Print a sequence of k distinct integers t1, t2, ..., tk (1 ≤ tj ≤ n) — the numbers of the stations that should be left after the innovation in arbitrary order. Assume that the stations are numbered 1 through n in the order they are given in the input. The number of stations you print must have the minimum possible aver... | standard output | |
PASSED | 3c2fab6256e6efa7997466870bf8e0c8 | 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.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.math.BigInteger;
public cla... | 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 | 3ff88b926638b87598a33b3d2ac64ac7 | 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 C
{
static ArrayList<Integer> g[];
static int[] vis,dist;
public static void main(String[] args)throws IOException
{
FastReader f=new FastReader();
StringBuffer sb = new StringBuffer();
int n=f.nextInt();
int m=f.nextInt();
g=new ArrayList[n... | 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 | 523bc7d58f5815c138bef72a3bfd94af | 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.ArrayList;
import java.util.StringTokenizer;
import java.util.Queue;
import java.io.BufferedReader;
imp... | 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 | ade5af2d78ba7659bf85f9efc2a71533 | 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 static java.util.Arrays.fill;
public class Main {
private static int n,m,s = 0;
private static boolean[] used;
private static int[] d,p;
private static List<Integer>[] graphTrain;
private static List<Integer>[] graphCar;
private static final int INF = Integer.MAX_VA... | 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 | b7e5beae3324600c0b5cc7a79fa7b1f8 | 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.ArrayDeque;
public class C {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(Syst... | 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 | 52406cc42eb0e555bc3e3142d0b6de55 | 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.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class TheTwoRoutes {
static ArrayList<Integer> [] adjList1;
static ArrayList<Integer> [] adjList2;
static boolean [][] adjMatrix1;
static boolean [][] adjMatrix2;... | 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 | 4f43c7efc8eae7f0bceabc5bc8948b23 | 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 ProblemC {
public static void main(String[] args) throws Exception{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(f.readLine());
int towns = Integer.parseInt(st.nextToken());
int rails = 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 | 3d6a971d0f937d1d0b7022d59bbf9311 | 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.FileReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class C {
public static void main(String[] args) throws Exception {
Scanner sc = System.getProperty("ONLINE_JUDGE") == null ? new Scanner(
new Buff... | 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 | 2a0ee9410332216634f7cfba4464eef5 | 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 P3 {
public static void main (String[] args) {
Scanner sc = new Scanner (System.in);
PrintStream op = System.out;
int n = sc.nextInt(), m = sc.nextInt();
boolean[][] g = new boolean [n][n];
for (int i = 0; i < m; i++) {
int x = sc.nextInt() - 1, y = sc.n... | 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 | 82fef9465b92cde967a80c437b9e3f92 | 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.lang.Math.*;
public class Graph {
int V;int arrival[];int dep[];
LinkedList<Integer> adj[];
int time=0;
Graph(int v)
{
V=v;
adj=new LinkedList[v];
arrival=new int[v];
dep=new int[v];
for(int i=0;i<v;i++)
{
adj[i]=new LinkedList();
}
//System.o... | 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 | 6c9366f99c59f27a0c2ca6faba90a2e6 | 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.lang.*;
import java.io.*;
public class R333C {
static int INF = Integer.MAX_VALUE / 3;
public static void main (String[] args) throws java.lang.Exception {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n =... | 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 | a4541484ce5a4e5889080bb446ac674e | 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.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class MainClass {
int [] visited ;
MainClass (int v)
{
visited = new int[v] ;
... | 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 | 0b671f297000916aab01dc1f6980fd31 | 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.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
import java.util.StringTokenizer;
/**
*
* Codeforces Round #333 (Div 2) - C. The T... | 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 | 2173ddafedb026efae3b26d848c0a101 | 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.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
public class TheTwoRoutes {
public static void main(String[] args) {
FasterScanner sc = new FasterScanner();
int N =... | 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 | 155c2e41a4703d3122dd89945635d934 | 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 final class TwoRoutes
{ static boolean[] marked;
public static void main(String[] args) {
Scanner br=new Scanner(System.in);
int n=br.nextInt();
int m=br.nextInt();
int[][] arr=new int[n+1][n+1];
for(int i=0;i<m;i++)
{
int x=br.nextInt();
int y=br.nextInt();
arr[x][y]... | 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 | f5fba5aca8adc29a081256ee2bd2a2df | 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.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
public class TwoRoutes {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in)... | 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 | 0bc0cafca4c54e533c857f9a6527c480 | 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 | //package codeforces.cfr333div2;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
/**
* Created by raggzy on 3/21/2016.
*/
public class C {
private static int bfs(boolean[][] conneted, boolean value) {
int[] dist = new int[conneted.length];
... | 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 | 0184775f7c62ca80479664fafbf26606 | 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.awt.*;
import java.awt.geom.Line2D;
import java.io.*;
import java.math.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.FileTime;
import java.util.*;
import java.util.List;
public class Main implements Runnable... | 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 | 874e62f0e35c1a65efaa7ef7335de7e6 | 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.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.LinkedList;
impor... | 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 | 0802728072c133997984f3678c508a3f | 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 {
public static void solve() {
Kattio in = new Kattio(System.in);
int V = in.nextInt();
int E = in.nextInt();
boolean[][] adjMat = new boolean[V+1][V+1];
for(int i = 0; i < E; i++) {
int u = in.nextIn... | 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 | 413de74b3cc0a988e872a277228ab38a | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.