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
dcd0c3c68dcf235792561561054fcda2
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.GregorianCalendar; import java.util.Hashtable; import java.util.String...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
0fdf5aabc92c0be54a6c18464cab8199
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.util.*; import java.io.*; public class search { public static void main(String[] args) throws IOException { //BufferedReader rd=new BufferedReader(new FileReader(new File("input.txt"))); Scanner sc=new Scanner(new File("input.txt")); PrintWriter out=new PrintWriter(new File...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
fff734448733a92422057f5f8e5d91ab
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.PrintWriter; import java.util.GregorianCalendar; import java.util.StringTokenizer; public class B { private static BufferedReader in; private static StringTokenizer str; private static String SK; String next() throws Exception { while ((s...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
bc8e9b78e20dde8eed674899a26506c5
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.util.Scanner; import java.io.*; public class Main { public static void main(String[] args) throws Exception { // Scanner sc = new Scanner(System.in); Scanner sc = new Scanner(new FileReader("input.txt")); PrintWriter out = new PrintWriter(new FileWriter("output.txt")); in...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
3854782fdb5fa390c875c3f6b9ae85ab
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.util.Scanner; import static java.lang.Math.max; import static java.util.Arrays.fill; import java.io.*; public class Main { public static void main(String[] args) throws Exception { // Scanner sc = new Scanner(System.in); Scanner sc = new Scanner(new FileReader("input.txt")); Prin...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
e3e9361f1a1f65d6ba18e4ebbe581a89
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.util.Scanner; import static java.lang.Math.max; import static java.util.Arrays.fill; import java.io.*; public class Main { public static void main(String[] args) throws Exception { // Scanner sc = new Scanner(System.in); Scanner sc = new Scanner(new FileReader("input.txt")); Pri...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
700c56296d01ec926171d9e28bd2c3c9
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.util.*; public class Example { BufferedReader in; PrintWriter out; StringTokenizer st; String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(in.readLine()); } catch (Exception e) { ...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
766289646239fd60f48c3172f8d59be1
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
//package example; import java.io.*; import java.util.*; public class Example { BufferedReader in; PrintWriter out; StringTokenizer st; String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(in.readLine()); } catch (...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
f32fdaaeb58cf8b942800f744de2648d
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.util.*; import java.io.*; public class B { class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner(InputStream in) { try { br = new BufferedReader(new InputStreamReader(in)); } catch (Exception e) { e...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
ec1a076df15cc457fff7e2440bbf2dee
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.File; import java.io.PrintWriter; import java.util.Scanner; public class cf254b { public static void main(String[] args) throws Exception { Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); // Scanner in = new Scanner(System.in); /...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
f81dabb389b692d9f2411a816df12f66
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class B { public static void m...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
0daf81ca303d02fef4da519c09e747b2
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.awt.*; import java.awt.geom.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; /* br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); br = new BufferedReader(new InputStreamReader(System.in)); pw = new P...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
c9b45e94c8679a4b58527bd326a97f4e
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class JurySize { BufferedReader r; JurySize() throws FileNotFoundException{ r = n...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
9ea0483bdf2f0ac6f570d2d74ace35f4
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static BufferedReader kb; static StringTokenizer str; static PrintWriter out; static String SK; static String next() throws IOException { while ((str == null) || (!str.hasMoreTokens())) { SK = kb.readLine(); if (SK == ...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
c7cc17a85c56a85804bebe36f63ee859
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { static StringTokenizer st; static BufferedReader in; static PrintWriter pw; ...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
ae5759fda6e87360a9c04c50e6927674
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.Scanner; public class B { public class Task implements Comparable<Task>{ int m; int d; int t; int p; i...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
0413e17e38087bd71d3a88f64a09a154
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.util.*; public class B implements Runnable { class Event implements Comparable<Event> { int x, c; Event(int x, int c) { this.x = x; this.c = c; } public int compareTo(Event o) { if (x != o.x) return x - o.x; return o.c - c; } } final int[] month = { 31, 28...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
feeb0a215fa14b19c3a3ccb7075048bc
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.FileInputStream; import java.io.Writer; import java.util...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
4ca08a3e1e8625eb54058ebd176ddf1c
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { public static void main(String[] args) { try { BufferedReader br...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
f28fd3c417c2abacf43c8602b3e34807
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.util.Calendar; public class CF254B{ static final long MTD = 1000*60*60*24; public static void main(String args[]) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt"))); PrintWriter writer = new PrintWriter(new ...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
70dedab856f019a4273cfc18eb9a6eab
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Random; import java.io.Writer; import java.util.Collection; import java.util.Map; import java.util.List; import java.io.IOException; import java.util.A...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
e0e4898c0d97e3445970d0b8a009c003
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.IOException; import java.util.Calendar; import java.util.HashMap; import java.util.Map; import java.io.*; import java.util.StringTokenizer; public class Test { BufferedReader in; StringTokenizer str; PrintWriter out; String SK; String next() throws IOException { while ((str...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
91e1afebf73f8ac2781083e1a8776f70
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.util.*; import java.io.*; public class a { public static void main(String[] args) throws IOException { Scanner input = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); //input.init(System.in); //PrintWriter out = new PrintWriter(System.out); int n ...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
671e42b0a2a91131948f700fabb73b8c
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt")))); PrintWriter out = new PrintWriter(new File("output.txt")); // ...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
d2f4ac22ab24417585d2dc31093f3ba8
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.StringTokenizer; import java.util.TreeMap; public class B { pri...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
d2a516740a6ef0aedef29a06b5f22473
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; public class Main { static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); stati...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
e461422e90b058f5ad83ebbbd959f83a
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt")))); PrintWriter out = new PrintWriter(new File("output....
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
fff94ee1b665f0775cd1a9c634de752f
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class SolutionC { BufferedReader in; StringTokenizer str; PrintWriter out; String SK; String next() throws IOException { while ((str == null) || (!str.hasMoreTokens())) { SK = in.readLine(); if (SK == null) return nul...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
a1a483cea9a405ed11d8654ba28ded95
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.util.*; import java.io.*; public class ContA { public static void main(String[] args) throws IOException { // BufferedReader rd = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); BufferedReader rd=new BufferedReader(new FileReader("input.txt"));PrintWr...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
c546174f2b418744f63ddc2070e78a25
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringT...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
b0e9f66d193831bb85e564dd22d58394
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
//package codeforces.cf121209; import java.io.*; public class ProblemB { BufferedReader reader; PrintWriter writer; public ProblemB() throws IOException { // reader = new BufferedReader(new InputStreamReader(System.in)); // writer = new PrintWriter(new OutputStreamWriter(System.out)); ...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
1e8f7200522af023fb571818020b3865
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class ProblemB { static final int[] MDAY = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static int enc...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
25131e96bccda8ef4f47be1a983d1c12
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
//package round155; import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; public class B { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); int[] q = ne...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
dd2df28541db7e75de0553fdee5e6c76
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.FileInputStream; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHel...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
c75317adcbe254f850a502ee92c40ac0
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.FileInputStream; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHel...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
f571161cbd75abcc79d61af381ae7d95
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.FileInputStream; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHel...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
ce04f97c75f6ce311f7a5215005367f3
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class B { public static void main(String[] args) throws IOException{ (new B()).runFile(); } StreamTokenizer in; PrintWriter out; int nextInt() throws IOException{ in.nextToken(); return (int)in.nval; } ...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
70df25bb5bfa010597c128b02746eec4
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.util.*; import java.io.*; public class solve_dk { BufferedReader br; PrintWriter out; StringTokenizer stok; String nextToken() throws IOException { while (stok == null || !stok.hasMoreTokens()) { String s = br.readLine(); if (s == null) { return null; } stok = new StringTokenizer(s);...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
440243daf3595e355be94d359525b1c0
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.sql.Date; import java.util.ArrayList; import java.util.Arrays; public class B { public static int[] readNNumbers(BufferedReader bf, int n) throws IOExc...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
ff31072be3fae99617cbd71ca31e287c
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.util.*; public class P254B { public static StringTokenizer st; public static void nextLine(BufferedReader br) throws IOException { st = new StringTokenizer(br.readLine()); } public static String next() { return st.nextToken(); } pu...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
8043946d588cc6a5e4f31c8cdd8c542a
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.util.Date; import java.util.StringTokenizer; import java.util.TreeMap; public class CF155_2_B { BufferedReader in; StringTokenizer str; PrintWriter out; String SK; String next() throws IOException { while ((str == null) || (!str.hasMoreTokens())) { ...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
e21eaa4c3d8cb42a382c8244532555a3
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class B { public static void main(String[] args) throws Exception { new B().solve(new FileInputStream(new File("input.txt")), new PrintStream(new FileOutputStream(new File("output.txt")))); } void solve(InputStream _i...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
ee28949665f5490c93da6dabf635763b
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.*; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.StringTokenizer; public class B { BufferedReader in; StringTokenizer str; PrintWriter out; String SK; void solve() throws IOException { int N = readInt(); int C[] = new int[1000]; for (int _ = 0; _ < N; _++...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
1d665fa1a687cfb004ef528b65e16aee
train_001.jsonl
1355047200
In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.lang.reflect.Array; import java.mat...
Java
["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"]
1 second
["2", "3", "1"]
null
Java 6
input.txt
[ "implementation", "brute force" ]
34655e8de9f1020677c5681d9d217d75
The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1...
1,500
Print a single number — the minimum jury size.
output.txt
PASSED
427c5eb2b0b1b4abca65339b632d6855
train_001.jsonl
1541860500
You are given a connected undirected graph without cycles (that is, a tree) of $$$n$$$ vertices, moreover, there is a non-negative integer written on every edge.Consider all pairs of vertices $$$(v, u)$$$ (that is, there are exactly $$$n^2$$$ such pairs) and for each pair calculate the bitwise exclusive or (xor) of all...
256 megabytes
import java.io.*; import java.util.*; public class A { FastScanner in; PrintWriter out; void solve() { int n = in.nextInt(); long k = in.nextLong() - 1; int[] p = new int[n]; long[] w = new long[n]; for (int i = 1; i < n; i++) { p[i] = in.nextInt() - 1;...
Java
["2 1\n1 3", "3 6\n1 2\n1 3"]
4 seconds
["0", "2"]
NoteThe tree in the second sample test looks like this:For such a tree in total $$$9$$$ paths exist: $$$1 \to 1$$$ of value $$$0$$$ $$$2 \to 2$$$ of value $$$0$$$ $$$3 \to 3$$$ of value $$$0$$$ $$$2 \to 3$$$ (goes through $$$1$$$) of value $$$1 = 2 \oplus 3$$$ $$$3 \to 2$$$ (goes through $$$1$$$) of value $$$1 = ...
Java 8
standard input
[ "trees", "strings" ]
4a6ec68740e0a99e3907ed133b36956d
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 10^6$$$, $$$1 \le k \le n^2$$$) — the number of vertices in the tree and the number of path in the list with non-decreasing order. Each of the following $$$n - 1$$$ lines contains two integers $$$p_i$$$ and $$$w_i$$$ ($$$1 \le p_i \le i$$$, $$$0 \...
2,900
Print one integer: $$$k$$$-th smallest xor of a path in the tree.
standard output
PASSED
f590462616cbffc3bdd24e107b9eb817
train_001.jsonl
1541860500
You are given a connected undirected graph without cycles (that is, a tree) of $$$n$$$ vertices, moreover, there is a non-negative integer written on every edge.Consider all pairs of vertices $$$(v, u)$$$ (that is, there are exactly $$$n^2$$$ such pairs) and for each pair calculate the bitwise exclusive or (xor) of all...
256 megabytes
import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.System.arraycopy; import static java.lang.System.exit; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; pu...
Java
["2 1\n1 3", "3 6\n1 2\n1 3"]
4 seconds
["0", "2"]
NoteThe tree in the second sample test looks like this:For such a tree in total $$$9$$$ paths exist: $$$1 \to 1$$$ of value $$$0$$$ $$$2 \to 2$$$ of value $$$0$$$ $$$3 \to 3$$$ of value $$$0$$$ $$$2 \to 3$$$ (goes through $$$1$$$) of value $$$1 = 2 \oplus 3$$$ $$$3 \to 2$$$ (goes through $$$1$$$) of value $$$1 = ...
Java 8
standard input
[ "trees", "strings" ]
4a6ec68740e0a99e3907ed133b36956d
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 10^6$$$, $$$1 \le k \le n^2$$$) — the number of vertices in the tree and the number of path in the list with non-decreasing order. Each of the following $$$n - 1$$$ lines contains two integers $$$p_i$$$ and $$$w_i$$$ ($$$1 \le p_i \le i$$$, $$$0 \...
2,900
Print one integer: $$$k$$$-th smallest xor of a path in the tree.
standard output
PASSED
d4f02690a6c6baa038ce65026a1b9c16
train_001.jsonl
1541860500
You are given a connected undirected graph without cycles (that is, a tree) of $$$n$$$ vertices, moreover, there is a non-negative integer written on every edge.Consider all pairs of vertices $$$(v, u)$$$ (that is, there are exactly $$$n^2$$$ such pairs) and for each pair calculate the bitwise exclusive or (xor) of all...
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.Collection; import java.io.IOException; import java.util.Random; import java.util.Deque; import java.util.function.Supplier; import java.util.ArrayList; import java...
Java
["2 1\n1 3", "3 6\n1 2\n1 3"]
4 seconds
["0", "2"]
NoteThe tree in the second sample test looks like this:For such a tree in total $$$9$$$ paths exist: $$$1 \to 1$$$ of value $$$0$$$ $$$2 \to 2$$$ of value $$$0$$$ $$$3 \to 3$$$ of value $$$0$$$ $$$2 \to 3$$$ (goes through $$$1$$$) of value $$$1 = 2 \oplus 3$$$ $$$3 \to 2$$$ (goes through $$$1$$$) of value $$$1 = ...
Java 8
standard input
[ "trees", "strings" ]
4a6ec68740e0a99e3907ed133b36956d
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 10^6$$$, $$$1 \le k \le n^2$$$) — the number of vertices in the tree and the number of path in the list with non-decreasing order. Each of the following $$$n - 1$$$ lines contains two integers $$$p_i$$$ and $$$w_i$$$ ($$$1 \le p_i \le i$$$, $$$0 \...
2,900
Print one integer: $$$k$$$-th smallest xor of a path in the tree.
standard output
PASSED
c4b260976a3f16bb03a1df50046f2eba
train_001.jsonl
1541860500
You are given a connected undirected graph without cycles (that is, a tree) of $$$n$$$ vertices, moreover, there is a non-negative integer written on every edge.Consider all pairs of vertices $$$(v, u)$$$ (that is, there are exactly $$$n^2$$$ such pairs) and for each pair calculate the bitwise exclusive or (xor) of all...
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.Collection; import java.io.IOException; import java.util.Random; import java.util.Deque; import java.util.function.Supplier; import java.util.ArrayList; import java...
Java
["2 1\n1 3", "3 6\n1 2\n1 3"]
4 seconds
["0", "2"]
NoteThe tree in the second sample test looks like this:For such a tree in total $$$9$$$ paths exist: $$$1 \to 1$$$ of value $$$0$$$ $$$2 \to 2$$$ of value $$$0$$$ $$$3 \to 3$$$ of value $$$0$$$ $$$2 \to 3$$$ (goes through $$$1$$$) of value $$$1 = 2 \oplus 3$$$ $$$3 \to 2$$$ (goes through $$$1$$$) of value $$$1 = ...
Java 8
standard input
[ "trees", "strings" ]
4a6ec68740e0a99e3907ed133b36956d
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 10^6$$$, $$$1 \le k \le n^2$$$) — the number of vertices in the tree and the number of path in the list with non-decreasing order. Each of the following $$$n - 1$$$ lines contains two integers $$$p_i$$$ and $$$w_i$$$ ($$$1 \le p_i \le i$$$, $$$0 \...
2,900
Print one integer: $$$k$$$-th smallest xor of a path in the tree.
standard output
PASSED
4a5b8e71e9ca14d62918d4e445e7d843
train_001.jsonl
1541860500
You are given a connected undirected graph without cycles (that is, a tree) of $$$n$$$ vertices, moreover, there is a non-negative integer written on every edge.Consider all pairs of vertices $$$(v, u)$$$ (that is, there are exactly $$$n^2$$$ such pairs) and for each pair calculate the bitwise exclusive or (xor) of all...
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.Collection; import java.io.IOException; import java.util.Random; import java.util.Deque; import java.util.function.Supplier; import java.util.ArrayList; import java...
Java
["2 1\n1 3", "3 6\n1 2\n1 3"]
4 seconds
["0", "2"]
NoteThe tree in the second sample test looks like this:For such a tree in total $$$9$$$ paths exist: $$$1 \to 1$$$ of value $$$0$$$ $$$2 \to 2$$$ of value $$$0$$$ $$$3 \to 3$$$ of value $$$0$$$ $$$2 \to 3$$$ (goes through $$$1$$$) of value $$$1 = 2 \oplus 3$$$ $$$3 \to 2$$$ (goes through $$$1$$$) of value $$$1 = ...
Java 8
standard input
[ "trees", "strings" ]
4a6ec68740e0a99e3907ed133b36956d
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 10^6$$$, $$$1 \le k \le n^2$$$) — the number of vertices in the tree and the number of path in the list with non-decreasing order. Each of the following $$$n - 1$$$ lines contains two integers $$$p_i$$$ and $$$w_i$$$ ($$$1 \le p_i \le i$$$, $$$0 \...
2,900
Print one integer: $$$k$$$-th smallest xor of a path in the tree.
standard output
PASSED
fdfddbbce7fd302770851caec8fa998a
train_001.jsonl
1541860500
You are given a connected undirected graph without cycles (that is, a tree) of $$$n$$$ vertices, moreover, there is a non-negative integer written on every edge.Consider all pairs of vertices $$$(v, u)$$$ (that is, there are exactly $$$n^2$$$ such pairs) and for each pair calculate the bitwise exclusive or (xor) of all...
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.Random; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; /...
Java
["2 1\n1 3", "3 6\n1 2\n1 3"]
4 seconds
["0", "2"]
NoteThe tree in the second sample test looks like this:For such a tree in total $$$9$$$ paths exist: $$$1 \to 1$$$ of value $$$0$$$ $$$2 \to 2$$$ of value $$$0$$$ $$$3 \to 3$$$ of value $$$0$$$ $$$2 \to 3$$$ (goes through $$$1$$$) of value $$$1 = 2 \oplus 3$$$ $$$3 \to 2$$$ (goes through $$$1$$$) of value $$$1 = ...
Java 8
standard input
[ "trees", "strings" ]
4a6ec68740e0a99e3907ed133b36956d
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 10^6$$$, $$$1 \le k \le n^2$$$) — the number of vertices in the tree and the number of path in the list with non-decreasing order. Each of the following $$$n - 1$$$ lines contains two integers $$$p_i$$$ and $$$w_i$$$ ($$$1 \le p_i \le i$$$, $$$0 \...
2,900
Print one integer: $$$k$$$-th smallest xor of a path in the tree.
standard output
PASSED
c0ef16dda624a5881b67dfd700b055f9
train_001.jsonl
1541860500
You are given a connected undirected graph without cycles (that is, a tree) of $$$n$$$ vertices, moreover, there is a non-negative integer written on every edge.Consider all pairs of vertices $$$(v, u)$$$ (that is, there are exactly $$$n^2$$$ such pairs) and for each pair calculate the bitwise exclusive or (xor) of all...
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.Random; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; /...
Java
["2 1\n1 3", "3 6\n1 2\n1 3"]
4 seconds
["0", "2"]
NoteThe tree in the second sample test looks like this:For such a tree in total $$$9$$$ paths exist: $$$1 \to 1$$$ of value $$$0$$$ $$$2 \to 2$$$ of value $$$0$$$ $$$3 \to 3$$$ of value $$$0$$$ $$$2 \to 3$$$ (goes through $$$1$$$) of value $$$1 = 2 \oplus 3$$$ $$$3 \to 2$$$ (goes through $$$1$$$) of value $$$1 = ...
Java 8
standard input
[ "trees", "strings" ]
4a6ec68740e0a99e3907ed133b36956d
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 10^6$$$, $$$1 \le k \le n^2$$$) — the number of vertices in the tree and the number of path in the list with non-decreasing order. Each of the following $$$n - 1$$$ lines contains two integers $$$p_i$$$ and $$$w_i$$$ ($$$1 \le p_i \le i$$$, $$$0 \...
2,900
Print one integer: $$$k$$$-th smallest xor of a path in the tree.
standard output
PASSED
972286d6daa6f5e5692c767bffa438b1
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.awt.event.MouseAdapter; import java.io.*; import java.util.*; public class Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); String s[]=bu.readLi...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
2071f4ebe96b51be8cfd3e3633b37e80
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class MaximumofMaximumsofMinimums { public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int k=in.nextInt(); int result = 0; int i; Arra...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
4e43c80c8e0f41d3bec162cdc4174667
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.io.*; import java.util.*; public class epicCode { public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Long> daList = new ArrayList<>(); StringTokenizer line = new StringTokenizer(br.readLin...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
3fe53ae5694b50003efff726506518b1
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.io.*; import java.util.Scanner; public class Max { public static void main (String[] args) { Scanner input = new Scanner(System.in); int m = input.nextInt(); int k = input.nextInt(); int [] arr = new int[m]; int max = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; for(int i = 0; i < m; i++...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
8729531b2a92e38b560a9163074125f2
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class MaxMin { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int arrlen = sc.nextInt(); int subsets = sc.nextInt(); int [] arr = new int[arrlen]; int max = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; for (in...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
7466989fcc0b3359cec284668a6d37c4
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.io.*; import java.util.*; public class Main{ static long mod=998244353; public static void main(String[] args) throws Exception{ PrintWriter pw=new PrintWriter(System.out); MScanner sc = new MScanner(System.in); int n=sc.nextInt(),k=sc.nextInt(); long min=(long)1e10,max=-min; int[]in=new int[n]...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
0603546c5546dd7536474ae3e38e8443
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main (String []args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] params = br.readLine().split(" "); int count = Integer.parseInt(params[0]); ...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
7f9ff4b0b8de6340e0f5013974167b0c
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.io.*; import java.util.*; public class Test { public static void main(String[] args) throws IOException { Scanner sc = new Scanner (System.in); int n = sc.nextInt(); int k = sc.nextInt(); ArrayList<Integer> arr = new ArrayList<Integer>(); for (int i = 0; i<n; i++) ...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
a7724680bbd655899add341708f87e85
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.util.*; public class MaximumofMaximumsofMinimums { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int num = kb.nextInt(); int k = kb.nextInt(); long min = Long.MAX_VALUE; long max = Long.MIN_VALUE; int first = 0; int current = 0; ...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
f74eee72a7d5889a63e6d5f9c397adcb
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.io.*; import java.util.*; public class Solutionc { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(bufferedReader.readLine()); int...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
3a75782f99c26ca391f745cbce9e6579
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.io.*; public class solution { public static void merge(int arr[], int l, int m, int r) { // Find sizes of two subarrays to be merged int n1 = m - l + 1; int n2 = r - m; /* Create temp arrays */ int L[] = new int[n...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
9542bf195751c9ef64c940e7a9d9c953
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class MaxMaxMin { public static void main(String[] args) { final Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int k = scan.nextInt(); int[] list = new int[n]; for (int i = 0; i < n; i+...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
1f92a992f9cadf273be203dcc8683bdd
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static void solver(InputReader sc, PrintWriter out) throws Exception { int n =sc.nextInt(); int k =sc.nextInt(); long max = Long.MIN_VALUE; long min = Long.MAX_VALUE; long arr[] = new long[n]; for(i...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
d641a310cc04330533ee2ad0d0ff8c27
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Codeforces870B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } System.out.pri...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
113f6c5cc610f4c08422e6edc2af948e
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.util.*; import java.math.*; public class sdf{ public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); ArrayList<Integer> list = new ArrayList<>(); for(int i = 0; i < n; i++) list.add(in.nextInt()); if(k == 1) System.o...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
5fd3b94b70d854152ec9d60824268bae
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import static java.lang.Math.*; public class Main { void run() throws IOException { int n = nextInt(); int k = nextInt(); int[] a = new int[n]; int m = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; ...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
961777cc3c31afa8be58932295b7ac16
train_001.jsonl
1508054700
You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the k obtained minimums. What is the maximum possible integer you can get?Def...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int min=1000000000,max=-1000000000; int n=sc.nextInt(); int k=sc.nextInt(); int[] n1=new int[n]; for(int i=0;i<n;i++){ int s=sc.nextInt(); n1[i]=s; ...
Java
["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1"]
1 second
["5", "-5"]
NoteA subsegment [l,  r] (l ≤ r) of array a is the sequence al,  al + 1,  ...,  ar.Splitting of array a of n elements into k subsegments [l1, r1], [l2, r2], ..., [lk, rk] (l1 = 1, rk = n, li = ri - 1 + 1 for all i &gt; 1) is k sequences (al1, ..., ar1), ..., (alk, ..., ark).In the first example you should split the arr...
Java 11
standard input
[ "greedy" ]
ec1a29826209a0820e8183cccb2d2f01
The first line contains two integers n and k (1 ≤ k ≤ n ≤  105) — the size of the array a and the number of subsegments you have to split the array to. The second line contains n integers a1,  a2,  ...,  an ( - 109  ≤  ai ≤  109).
1,200
Print single integer — the maximum possible integer you can get if you split the array into k non-empty subsegments and take maximum of minimums on the subsegments.
standard output
PASSED
3daad1d066259555333d568c4c1f22c6
train_001.jsonl
1292862000
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≤ i, j ≤ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class S { public static void main (String[] args) { Scanner in=new Scanner(System.in); String s=in.next(); Map<Character,Long> map=new HashMap<>(); for(int i=0;i<s.length();i++) { char ch=s.charAt(i); ...
Java
["great10", "aaaaaaaaaa"]
2 seconds
["7", "100"]
null
Java 8
standard input
[ "strings" ]
6bb2793e275426eb076972fab69d0eba
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
1,500
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
standard output
PASSED
da639c87c6e7b5f5a92bc747636db5ec
train_001.jsonl
1292862000
There is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that1. 1 ≤ i, j ≤ N2. S[i] = S[j], that is the i-th symbol of string S is equal to the j-th.
256 megabytes
import java.util.*; import java.util.Map.Entry; public class ChoosingSymbolPairs { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); int len = str.length(); HashMap<Character, Integer> map = new HashMap<Character, Integer>(); long count = len; for(i...
Java
["great10", "aaaaaaaaaa"]
2 seconds
["7", "100"]
null
Java 8
standard input
[ "strings" ]
6bb2793e275426eb076972fab69d0eba
The single input line contains S, consisting of lowercase Latin letters and digits. It is guaranteed that string S in not empty and its length does not exceed 105.
1,500
Print a single number which represents the number of pairs i and j with the needed property. Pairs (x, y) and (y, x) should be considered different, i.e. the ordered pairs count.
standard output
PASSED
13ffe8aa423344edf7aeab5d351cd533
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String [] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter p = new PrintWriter(System.out); int n = Integer.valueOf(br.readLine()); ...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
2843872152d4f3e7a5a084e1c8abb1aa
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String [] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.valueOf(br.readLine()); int a[] = new int[n]; int b[] = new int[n]; ...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
e674b7133b27c5b337c0736c1e449180
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.ArrayList; /* package codechef; // don't place package name! */ import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.Map; import java.util.Scanner; import java.util.TreeMap; public class TP1 { public static void main(String[] args) { // TODO Aut...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
0f45b3d1dee7fa01b80e62e1729b3a1f
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.Scanner; public class C1365 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int length = scanner.nextInt(); int[] nums = new int[length + 1]; int[] differences = new int[length]; for(int i = 0; i < length; i++) { nums[scanner.nextInt()] = i; } for...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
4a146ec99e12119b4b85ecc05f19473b
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.Collection; import java.util.HashMap; import java.util.Scanner; public class C1365 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int length = scanner.nextInt(); int[] nums = new int[length + 1]; HashMap<Integer, Integer> differences = new HashMap<Integer...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
0e89cd7431d4659097356c2fdee5886a
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⡎...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
dbc0889b98f1234101c56192ba62455b
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⡎...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
c72abc6636cd1ac16a6cb19d5399ccf2
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n+1]; int[] b = new int[n+1]; int[] c = new int[n+1]; for(int i=1;i<=n;i++){ int temp = in.nextInt(); a[temp] = i; } for(int i=1;i...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
f4d3acc3592ee0dd43131448f2f65a5c
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; /** * @author hypnos * @date 2020/11/24 */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr1 = new i...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
e59e6a717251acc72c001257f626edb3
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.TreeMap; import java.util.StringTokenizer; public class codeforces1365C { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new ...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
03ee1dcd3961a59b68a8eca005b214ae
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.TreeMap; public class codeforces1365C { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new ...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
113b43d0d20464852dc0a121fe3bd538
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.Scanner; import java.util.HashMap; public class codeforces1365C { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n=s.nextInt(),i,x,m=1,h; int[] a = new int[n]; int[] b = new int[n]; for(i=0;i<n;i++) a[s.nextInt()-1]=i; for(i=0;i<n;i++...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
0e43b9a75959b2bce9d0423b72af00cc
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.util.*; public class SomeJavaThing { private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static StringTokenizer st; public static void main(String args[]) throws IOException{ int tempRead; int size = readInt(); ...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
3db034b29508265ac883652fb7a25f62
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
/* package codechef; // 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 Main { public static void main (String[] args) throws java.lang.Exception { BufferedReader bf = new BufferedReader(new ...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
617b5f811b13dec04b7b25ecf275d889
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; PrintWriter out = new PrintWriter(outputStream); InputReader in = new InputReader(in...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
9cbdd521584ac8d5fc3ffb142776e5d8
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; PrintWriter out = new PrintWriter(outputStream); InputReader in = new InputReader(in...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
055b8e24d2c0ad6e90ea79b7d87b1c56
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.util.*; /** * * @author Aaryan * AV */ public class Test2 { private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Prin...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
fba99b8902a55142a6248c68b57698d9
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.util.*; /** * * @author Aaryan * AV */ public class Test2 { private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Prin...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
a7863f5b3d3e7f0fb6c56b1dd86586bd
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.Scanner; public class Rotation_Matching { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a[] = new int[n]; int b[] = new int[n]; //int a1[] = new int[n+1]; int b1[] = new int[n+1]; for(int i=0;i<n;i++) { a[i] = sc.n...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
a1dacefe98a5028f32e701ce96f1eaa4
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
/* package codechef; // 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 Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); P...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
6f8c9c6bddf1ddfc731954fa5c5ee54e
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
/* package codechef; // 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 Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); P...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
c425d975bb8db7af6f4999f547dbdcb2
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
//Utilities import java.io.*; import java.util.*; public class Main { static int N; static int[] a, b, cnt, map; static int max = 1; public static void main(String[] args) throws IOException { N = in.iscan(); a = new int[N]; map = new int[N+1]; b = new int[N]; cnt = new int[N]; for (int i = 0; i < N; i++) { ...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
70a379a786a6476cee17cdff357c8141
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /** * * @author alanl */ public class Main{ static BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
bafaa07eb7959480f9827627a8c32f14
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.util.*; /** * Created by Harry on 5/31/20. */ public class Test { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(new BufferedInputStream(System.in)); int n = scanner.nextInt(); int[] aPos = new int[n+1]; int[]...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
3f0a27dfdf07500c2142509d64c8c03b
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class RotationMatching{ public static class FastReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; publ...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
f72467490c08055dcba073ed39f3dcfa
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
/* 盗图小能手 ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
0253ef63df981c0ed2154eb6c4583f12
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.util.*; public class RotationMatching { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int p[] = new int[n], q[] = new int[n]; int a=0,b=0; int pos[] = new int[n+1...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
1c54b0941331e79b96ddba642db9019c
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger; import java.util.LinkedList; import java.util.Queue; import javafx.util.*; public final class CodeForcesA { static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); static ArrayList<Arra...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
4cbc8c14b1f6a2f5383c05b7bc75189e
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger; import java.util.LinkedList; import java.util.Queue; import javafx.util.*; public final class CodeForcesA { static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); static ArrayList<Arra...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
b97a37779631087581f7cf87c00a1b08
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.math.*; import java.io.*; import java.awt.*; import java.util.*; public class Solution{ static Helper hp; final static int MAXN = 1000_006; final static long MOD = (long) 1000000007; final static long MOD1 = (long) 998244353; public static void debug(Object s)throws Exception{ if...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output