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
44227250fdfe2328df8811a3f7090989
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.util.*; import java.io.*; /* 4 3 1 3 2 4 4 1 4 4 1 1 2 3 1 4 1 4 */ public class c implements Runnable { PrintWriter out; int n, q; static long N; int[] rows; int[][] rects; public void main() throws Throwable { FastScanner in = new FastScanner(System.in); out = new...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
ac6394a916d311cccff5ad09b1908409
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Boredom { InputStream in; PrintWriter out; long tree[]; int left[],right[]; int root[]; int MAX=(int)2e5+7; int MAXN=25*((int)1e6); int nnode=1; void solve() { int n=ni(); int q=ni(); tree = new long[MAXN]; left = new i...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
c7ea0f6537bd9422384aa25943677731
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
ab031beb2b54e422c767c42c8fc26597
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
db10a816aaad60c17b651c7860ca2c1e
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
15df0b523953576ae6ce2d206c766d67
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.*; import java.util.*; public class C { long[] ans; long[] c2; static class Query implements Comparable<Query> { int x, y, id; public Query(int x, int y, int id) { this.x = x; this.y = y; this.id = id; } @Override public int compareTo(Query o) { return Integer.compare(x, o....
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
2f56e9957581218adf87a7dc3ac58a2a
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
b3484d9d4639df70c20a24c2344bbb7a
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
c6d87e8af8a888513a57fcf941d802e7
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class Div1_433C { public static void main(String[] args) throws IOException { new Div1_...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
788bfa3eb832fff1176c774b89d0ac9f
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.NoSuchElementException; import java.util.Objects; impo...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
63b8b0d0698dfbc0f628863372311b58
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class C { static int [] T, size, l, r; static int cur; stati...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
67ccf6e01c18a2ba27f7fb4774893b06
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class C { static int [] T, size, l, r; static int cur; stati...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
1e8cad390b3ece96cc4123682cecb176
train_002.jsonl
1504702500
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha...
512 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; import java.util.Map.Entry; import static java.lang.Math.*; public class C extends PrintWriter { int cnt1, cnt2; class Node { final int fx, tx; final int[] y; final Node l, r; Node(int x, int y) { ...
Java
["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"]
2 seconds
["1\n1\n1", "3\n5"]
NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as...
Java 8
standard input
[ "data structures" ]
bc834c0aa602a8ba789b676affb0b33a
The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma...
2,100
For each query rectangle output its beauty degree on a separate line.
standard output
PASSED
3d4392b8d07327ed0e07cb87f096225b
train_002.jsonl
1569762300
You have a simple undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The graph doesn't contain self-loops, there is at most one edge between a pair of vertices. The given graph can be disconnected.Let's make a definition.Let $$$v_1$$$ and $$$v_2$$$ be two some nonempty subsets of vertices that do not in...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; import java.util.StringTokenizer; public class D { @SuppressWarnings("unchecked") public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringTokenizer st =...
Java
["6 11\n1 2\n1 3\n1 4\n1 5\n1 6\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4"]
2 seconds
["1 2 2 3 3 3", "-1"]
NoteIn the first example, if $$$v_{1} = \{ 1 \}$$$, $$$v_{2} = \{ 2, 3 \}$$$, and $$$v_{3} = \{ 4, 5, 6 \}$$$ then vertex sets will satisfy all conditions. But you can assign vertices to vertex sets in a different way; Other answers like "2 3 3 1 1 1" will be accepted as well. In the second example, it's impossible to...
Java 8
standard input
[ "hashing", "graphs", "constructive algorithms", "implementation", "brute force" ]
7dea96a7599946a5b5d0b389c7e76651
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 10^{5}$$$, $$$0 \le m \le \text{min}(3 \cdot 10^{5}, \frac{n(n-1)}{2})$$$) — the number of vertices and edges in the graph. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$a_{i}$$$ and $$$b_{i}$$$ ($$$1 \le a_{i} \lt b_{i} \le n$...
1,900
If the answer exists, print $$$n$$$ integers. $$$i$$$-th integer means the vertex set number (from $$$1$$$ to $$$3$$$) of $$$i$$$-th vertex. Otherwise, print $$$-1$$$. If there are multiple answers, print any.
standard output
PASSED
4f54d72a4473c5be045a664d14e3d685
train_002.jsonl
1569762300
You have a simple undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The graph doesn't contain self-loops, there is at most one edge between a pair of vertices. The given graph can be disconnected.Let's make a definition.Let $$$v_1$$$ and $$$v_2$$$ be two some nonempty subsets of vertices that do not in...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.*; import java.util.*; import java.util.Map.Entry; public class Main { private static InputStream stream; private static byte[] buf = new byte[1024]; private static int curChar; private static int numChars; private static SpaceCharFilter filter; ...
Java
["6 11\n1 2\n1 3\n1 4\n1 5\n1 6\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4"]
2 seconds
["1 2 2 3 3 3", "-1"]
NoteIn the first example, if $$$v_{1} = \{ 1 \}$$$, $$$v_{2} = \{ 2, 3 \}$$$, and $$$v_{3} = \{ 4, 5, 6 \}$$$ then vertex sets will satisfy all conditions. But you can assign vertices to vertex sets in a different way; Other answers like "2 3 3 1 1 1" will be accepted as well. In the second example, it's impossible to...
Java 8
standard input
[ "hashing", "graphs", "constructive algorithms", "implementation", "brute force" ]
7dea96a7599946a5b5d0b389c7e76651
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 10^{5}$$$, $$$0 \le m \le \text{min}(3 \cdot 10^{5}, \frac{n(n-1)}{2})$$$) — the number of vertices and edges in the graph. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$a_{i}$$$ and $$$b_{i}$$$ ($$$1 \le a_{i} \lt b_{i} \le n$...
1,900
If the answer exists, print $$$n$$$ integers. $$$i$$$-th integer means the vertex set number (from $$$1$$$ to $$$3$$$) of $$$i$$$-th vertex. Otherwise, print $$$-1$$$. If there are multiple answers, print any.
standard output
PASSED
6d84f0013355dfadf18b69ac8e3b04e6
train_002.jsonl
1569762300
You have a simple undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The graph doesn't contain self-loops, there is at most one edge between a pair of vertices. The given graph can be disconnected.Let's make a definition.Let $$$v_1$$$ and $$$v_2$$$ be two some nonempty subsets of vertices that do not in...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int m=s.nextInt(); HashSet<Integer> g[]=new HashSet[n+1]; pair arr[]=new pair[m]; for(int i=0;i<g.length;i++) { g[i]=new HashSet<Integer>(); } for(int i=0...
Java
["6 11\n1 2\n1 3\n1 4\n1 5\n1 6\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4"]
2 seconds
["1 2 2 3 3 3", "-1"]
NoteIn the first example, if $$$v_{1} = \{ 1 \}$$$, $$$v_{2} = \{ 2, 3 \}$$$, and $$$v_{3} = \{ 4, 5, 6 \}$$$ then vertex sets will satisfy all conditions. But you can assign vertices to vertex sets in a different way; Other answers like "2 3 3 1 1 1" will be accepted as well. In the second example, it's impossible to...
Java 8
standard input
[ "hashing", "graphs", "constructive algorithms", "implementation", "brute force" ]
7dea96a7599946a5b5d0b389c7e76651
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 10^{5}$$$, $$$0 \le m \le \text{min}(3 \cdot 10^{5}, \frac{n(n-1)}{2})$$$) — the number of vertices and edges in the graph. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$a_{i}$$$ and $$$b_{i}$$$ ($$$1 \le a_{i} \lt b_{i} \le n$...
1,900
If the answer exists, print $$$n$$$ integers. $$$i$$$-th integer means the vertex set number (from $$$1$$$ to $$$3$$$) of $$$i$$$-th vertex. Otherwise, print $$$-1$$$. If there are multiple answers, print any.
standard output
PASSED
db2165de50f8203bfea36a1b80aad8fc
train_002.jsonl
1569762300
You have a simple undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The graph doesn't contain self-loops, there is at most one edge between a pair of vertices. The given graph can be disconnected.Let's make a definition.Let $$$v_1$$$ and $$$v_2$$$ be two some nonempty subsets of vertices that do not in...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.InputStreamReader; import java.util.ArrayList; public class D { private static class Node { ArrayList<Integer> e = new ArrayList<Integer>(); } public static void main(String[] args) throws Exception {...
Java
["6 11\n1 2\n1 3\n1 4\n1 5\n1 6\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4"]
2 seconds
["1 2 2 3 3 3", "-1"]
NoteIn the first example, if $$$v_{1} = \{ 1 \}$$$, $$$v_{2} = \{ 2, 3 \}$$$, and $$$v_{3} = \{ 4, 5, 6 \}$$$ then vertex sets will satisfy all conditions. But you can assign vertices to vertex sets in a different way; Other answers like "2 3 3 1 1 1" will be accepted as well. In the second example, it's impossible to...
Java 8
standard input
[ "hashing", "graphs", "constructive algorithms", "implementation", "brute force" ]
7dea96a7599946a5b5d0b389c7e76651
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 10^{5}$$$, $$$0 \le m \le \text{min}(3 \cdot 10^{5}, \frac{n(n-1)}{2})$$$) — the number of vertices and edges in the graph. The $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$a_{i}$$$ and $$$b_{i}$$$ ($$$1 \le a_{i} \lt b_{i} \le n$...
1,900
If the answer exists, print $$$n$$$ integers. $$$i$$$-th integer means the vertex set number (from $$$1$$$ to $$$3$$$) of $$$i$$$-th vertex. Otherwise, print $$$-1$$$. If there are multiple answers, print any.
standard output
PASSED
f42d02f46fc22ad0c9d0f375a4eb4115
train_002.jsonl
1548516900
You are playing a new famous fighting game: Kortal Mombat XII. You have to perform a brutality on your opponent's character.You are playing the game on the new generation console so your gamepad have $$$26$$$ buttons. Each button has a single lowercase Latin letter from 'a' to 'z' written on it. All the letters on butt...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { FastReader scan = new FastReader(); //PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("taming.out"))); PrintWriter out = new ...
Java
["7 3\n1 5 16 18 7 2 10\nbaaaaca", "5 5\n2 4 1 3 1000\naaaaa", "5 4\n2 4 1 3 1000\naaaaa", "8 1\n10 15 2 1 4 8 15 16\nqqwweerr", "6 3\n14 18 9 19 2 15\ncccccc", "2 1\n10 10\nqq"]
1 second
["54", "1010", "1009", "41", "52", "10"]
NoteIn the first example you can choose hits with numbers $$$[1, 3, 4, 5, 6, 7]$$$ with the total damage $$$1 + 16 + 18 + 7 + 2 + 10 = 54$$$.In the second example you can choose all hits so the total damage is $$$2 + 4 + 1 + 3 + 1000 = 1010$$$.In the third example you can choose all hits expect the third one so the tot...
Java 11
standard input
[ "two pointers", "sortings", "greedy" ]
aa3b5895046ed34e89d5fcc3264b3944
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) — the number of hits and the maximum number of times you can push the same button in a row. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$...
1,300
Print one integer $$$dmg$$$ — the maximum possible damage to the opponent's character you can deal without breaking your gamepad buttons.
standard output
PASSED
2a95d5437d8c5987a1081437a7dd0855
train_002.jsonl
1548516900
You are playing a new famous fighting game: Kortal Mombat XII. You have to perform a brutality on your opponent's character.You are playing the game on the new generation console so your gamepad have $$$26$$$ buttons. Each button has a single lowercase Latin letter from 'a' to 'z' written on it. All the letters on butt...
256 megabytes
import java.nio.charset.IllegalCharsetNameException; import java.rmi.MarshalException; import java.util.*; import java.io.*; import java.math.*; public class program { public static FastIO file = new FastIO(); private static void solve() { // int tt = nextInt(); int tt = 1; long start...
Java
["7 3\n1 5 16 18 7 2 10\nbaaaaca", "5 5\n2 4 1 3 1000\naaaaa", "5 4\n2 4 1 3 1000\naaaaa", "8 1\n10 15 2 1 4 8 15 16\nqqwweerr", "6 3\n14 18 9 19 2 15\ncccccc", "2 1\n10 10\nqq"]
1 second
["54", "1010", "1009", "41", "52", "10"]
NoteIn the first example you can choose hits with numbers $$$[1, 3, 4, 5, 6, 7]$$$ with the total damage $$$1 + 16 + 18 + 7 + 2 + 10 = 54$$$.In the second example you can choose all hits so the total damage is $$$2 + 4 + 1 + 3 + 1000 = 1010$$$.In the third example you can choose all hits expect the third one so the tot...
Java 11
standard input
[ "two pointers", "sortings", "greedy" ]
aa3b5895046ed34e89d5fcc3264b3944
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) — the number of hits and the maximum number of times you can push the same button in a row. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$...
1,300
Print one integer $$$dmg$$$ — the maximum possible damage to the opponent's character you can deal without breaking your gamepad buttons.
standard output
PASSED
c07e05814516731563d645ac21c247b9
train_002.jsonl
1548516900
You are playing a new famous fighting game: Kortal Mombat XII. You have to perform a brutality on your opponent's character.You are playing the game on the new generation console so your gamepad have $$$26$$$ buttons. Each button has a single lowercase Latin letter from 'a' to 'z' written on it. All the letters on butt...
256 megabytes
import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import java.util.TreeMap; public class Solution { st...
Java
["7 3\n1 5 16 18 7 2 10\nbaaaaca", "5 5\n2 4 1 3 1000\naaaaa", "5 4\n2 4 1 3 1000\naaaaa", "8 1\n10 15 2 1 4 8 15 16\nqqwweerr", "6 3\n14 18 9 19 2 15\ncccccc", "2 1\n10 10\nqq"]
1 second
["54", "1010", "1009", "41", "52", "10"]
NoteIn the first example you can choose hits with numbers $$$[1, 3, 4, 5, 6, 7]$$$ with the total damage $$$1 + 16 + 18 + 7 + 2 + 10 = 54$$$.In the second example you can choose all hits so the total damage is $$$2 + 4 + 1 + 3 + 1000 = 1010$$$.In the third example you can choose all hits expect the third one so the tot...
Java 11
standard input
[ "two pointers", "sortings", "greedy" ]
aa3b5895046ed34e89d5fcc3264b3944
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) — the number of hits and the maximum number of times you can push the same button in a row. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$...
1,300
Print one integer $$$dmg$$$ — the maximum possible damage to the opponent's character you can deal without breaking your gamepad buttons.
standard output
PASSED
f7fc4213a3021454000116e36eea7dec
train_002.jsonl
1349105400
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.Overall the galaxy has n p...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.InputMismatchException; import java.util.PriorityQueue; import java.util.Scanner; public class P229B { private static class Node implements Comparable<Node> { ...
Java
["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0", "3 1\n1 2 3\n0\n1 3\n0"]
2 seconds
["7", "-1"]
NoteIn the first sample Jack has three ways to go from planet 1. If he moves to planet 4 at once, he spends 8 seconds. If he transfers to planet 3, he spends 3 seconds, but as other travellers arrive to planet 3 at time 3 and 4, he can travel to planet 4 only at time 5, thus spending 8 seconds in total. But if Jack mov...
Java 8
standard input
[ "data structures", "binary search", "graphs", "shortest paths" ]
d5fbb3033bd7508fd468edb9bb995d6c
The first line contains two space-separated integers: n (2 ≤ n ≤ 105), the number of planets in the galaxy, and m (0 ≤ m ≤ 105) — the number of pairs of planets between which Jack can travel using stargates. Then m lines follow, containing three integers each: the i-th line contains numbers of planets ai and bi (1 ≤ ai...
1,700
Print a single number — the least amount of time Jack needs to get from planet 1 to planet n. If Jack can't get to planet n in any amount of time, print number -1.
standard output
PASSED
ee618639e128eb291e67941b8142839f
train_002.jsonl
1349105400
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.Overall the galaxy has n p...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; import java.util.List; import java.util.PriorityQueue; imp...
Java
["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0", "3 1\n1 2 3\n0\n1 3\n0"]
2 seconds
["7", "-1"]
NoteIn the first sample Jack has three ways to go from planet 1. If he moves to planet 4 at once, he spends 8 seconds. If he transfers to planet 3, he spends 3 seconds, but as other travellers arrive to planet 3 at time 3 and 4, he can travel to planet 4 only at time 5, thus spending 8 seconds in total. But if Jack mov...
Java 8
standard input
[ "data structures", "binary search", "graphs", "shortest paths" ]
d5fbb3033bd7508fd468edb9bb995d6c
The first line contains two space-separated integers: n (2 ≤ n ≤ 105), the number of planets in the galaxy, and m (0 ≤ m ≤ 105) — the number of pairs of planets between which Jack can travel using stargates. Then m lines follow, containing three integers each: the i-th line contains numbers of planets ai and bi (1 ≤ ai...
1,700
Print a single number — the least amount of time Jack needs to get from planet 1 to planet n. If Jack can't get to planet n in any amount of time, print number -1.
standard output
PASSED
03e2830a4a514d6c5818f1744a73b3d5
train_002.jsonl
1349105400
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.Overall the galaxy has n p...
256 megabytes
import java.util.*; import java.io.*; public class Planets { static final long INF = Long.MAX_VALUE / 3; static class Edge { int to; long w; Edge(int to, long w) { this.to = to; this.w = w; } } static class QueueItem implements Comparable<QueueItem> { int u; long t, dist; public QueueItem...
Java
["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0", "3 1\n1 2 3\n0\n1 3\n0"]
2 seconds
["7", "-1"]
NoteIn the first sample Jack has three ways to go from planet 1. If he moves to planet 4 at once, he spends 8 seconds. If he transfers to planet 3, he spends 3 seconds, but as other travellers arrive to planet 3 at time 3 and 4, he can travel to planet 4 only at time 5, thus spending 8 seconds in total. But if Jack mov...
Java 8
standard input
[ "data structures", "binary search", "graphs", "shortest paths" ]
d5fbb3033bd7508fd468edb9bb995d6c
The first line contains two space-separated integers: n (2 ≤ n ≤ 105), the number of planets in the galaxy, and m (0 ≤ m ≤ 105) — the number of pairs of planets between which Jack can travel using stargates. Then m lines follow, containing three integers each: the i-th line contains numbers of planets ai and bi (1 ≤ ai...
1,700
Print a single number — the least amount of time Jack needs to get from planet 1 to planet n. If Jack can't get to planet n in any amount of time, print number -1.
standard output
PASSED
451bdd1fc348eba8ce68c7b65bd767b9
train_002.jsonl
1349105400
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.Overall the galaxy has n p...
256 megabytes
import java.io.BufferedReader; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Collection; import java.util.List; import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.ArrayList; import java.util.StringTokenizer; im...
Java
["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0", "3 1\n1 2 3\n0\n1 3\n0"]
2 seconds
["7", "-1"]
NoteIn the first sample Jack has three ways to go from planet 1. If he moves to planet 4 at once, he spends 8 seconds. If he transfers to planet 3, he spends 3 seconds, but as other travellers arrive to planet 3 at time 3 and 4, he can travel to planet 4 only at time 5, thus spending 8 seconds in total. But if Jack mov...
Java 8
standard input
[ "data structures", "binary search", "graphs", "shortest paths" ]
d5fbb3033bd7508fd468edb9bb995d6c
The first line contains two space-separated integers: n (2 ≤ n ≤ 105), the number of planets in the galaxy, and m (0 ≤ m ≤ 105) — the number of pairs of planets between which Jack can travel using stargates. Then m lines follow, containing three integers each: the i-th line contains numbers of planets ai and bi (1 ≤ ai...
1,700
Print a single number — the least amount of time Jack needs to get from planet 1 to planet n. If Jack can't get to planet n in any amount of time, print number -1.
standard output
PASSED
3d9897e263ee4748590d0853a669a757
train_002.jsonl
1349105400
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.Overall the galaxy has n p...
256 megabytes
import java.util.List; import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.util.ArrayList; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Random; import java.util.TreeSet; im...
Java
["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0", "3 1\n1 2 3\n0\n1 3\n0"]
2 seconds
["7", "-1"]
NoteIn the first sample Jack has three ways to go from planet 1. If he moves to planet 4 at once, he spends 8 seconds. If he transfers to planet 3, he spends 3 seconds, but as other travellers arrive to planet 3 at time 3 and 4, he can travel to planet 4 only at time 5, thus spending 8 seconds in total. But if Jack mov...
Java 8
standard input
[ "data structures", "binary search", "graphs", "shortest paths" ]
d5fbb3033bd7508fd468edb9bb995d6c
The first line contains two space-separated integers: n (2 ≤ n ≤ 105), the number of planets in the galaxy, and m (0 ≤ m ≤ 105) — the number of pairs of planets between which Jack can travel using stargates. Then m lines follow, containing three integers each: the i-th line contains numbers of planets ai and bi (1 ≤ ai...
1,700
Print a single number — the least amount of time Jack needs to get from planet 1 to planet n. If Jack can't get to planet n in any amount of time, print number -1.
standard output
PASSED
988bba20d66e5466fbdbc8353f92a1f7
train_002.jsonl
1349105400
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.Overall the galaxy has n p...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.TreeSet; /** * Created by himanshubhardwaj on 15/06/19. */ public class Planets { public static void main(String[] args) throws IOException { BufferedReader br = new B...
Java
["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0", "3 1\n1 2 3\n0\n1 3\n0"]
2 seconds
["7", "-1"]
NoteIn the first sample Jack has three ways to go from planet 1. If he moves to planet 4 at once, he spends 8 seconds. If he transfers to planet 3, he spends 3 seconds, but as other travellers arrive to planet 3 at time 3 and 4, he can travel to planet 4 only at time 5, thus spending 8 seconds in total. But if Jack mov...
Java 8
standard input
[ "data structures", "binary search", "graphs", "shortest paths" ]
d5fbb3033bd7508fd468edb9bb995d6c
The first line contains two space-separated integers: n (2 ≤ n ≤ 105), the number of planets in the galaxy, and m (0 ≤ m ≤ 105) — the number of pairs of planets between which Jack can travel using stargates. Then m lines follow, containing three integers each: the i-th line contains numbers of planets ai and bi (1 ≤ ai...
1,700
Print a single number — the least amount of time Jack needs to get from planet 1 to planet n. If Jack can't get to planet n in any amount of time, print number -1.
standard output
PASSED
6aa5a18372c293e3f3a748ba5724088f
train_002.jsonl
1349105400
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.Overall the galaxy has n p...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.TreeSet; /** * Created by himanshubhardwaj on 15/06/19. */ public class Planets { public static void main(String[] args) throws IOException { BufferedReader br = new B...
Java
["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0", "3 1\n1 2 3\n0\n1 3\n0"]
2 seconds
["7", "-1"]
NoteIn the first sample Jack has three ways to go from planet 1. If he moves to planet 4 at once, he spends 8 seconds. If he transfers to planet 3, he spends 3 seconds, but as other travellers arrive to planet 3 at time 3 and 4, he can travel to planet 4 only at time 5, thus spending 8 seconds in total. But if Jack mov...
Java 8
standard input
[ "data structures", "binary search", "graphs", "shortest paths" ]
d5fbb3033bd7508fd468edb9bb995d6c
The first line contains two space-separated integers: n (2 ≤ n ≤ 105), the number of planets in the galaxy, and m (0 ≤ m ≤ 105) — the number of pairs of planets between which Jack can travel using stargates. Then m lines follow, containing three integers each: the i-th line contains numbers of planets ai and bi (1 ≤ ai...
1,700
Print a single number — the least amount of time Jack needs to get from planet 1 to planet n. If Jack can't get to planet n in any amount of time, print number -1.
standard output
PASSED
d98b2e0914a8cbf2180e87e5217de482
train_002.jsonl
1349105400
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.Overall the galaxy has n p...
256 megabytes
import java.util.*; import java.io.*; public class Main { static final int INF = (int)1e15; //don't increase, avoid overflow static ArrayList<Edge>[] adjList; static HashSet<Long> []h; static int V; static class Edge implements Comparable<Edge> { int node; long cost; Edge(int a, long b) { node = a; cos...
Java
["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0", "3 1\n1 2 3\n0\n1 3\n0"]
2 seconds
["7", "-1"]
NoteIn the first sample Jack has three ways to go from planet 1. If he moves to planet 4 at once, he spends 8 seconds. If he transfers to planet 3, he spends 3 seconds, but as other travellers arrive to planet 3 at time 3 and 4, he can travel to planet 4 only at time 5, thus spending 8 seconds in total. But if Jack mov...
Java 8
standard input
[ "data structures", "binary search", "graphs", "shortest paths" ]
d5fbb3033bd7508fd468edb9bb995d6c
The first line contains two space-separated integers: n (2 ≤ n ≤ 105), the number of planets in the galaxy, and m (0 ≤ m ≤ 105) — the number of pairs of planets between which Jack can travel using stargates. Then m lines follow, containing three integers each: the i-th line contains numbers of planets ai and bi (1 ≤ ai...
1,700
Print a single number — the least amount of time Jack needs to get from planet 1 to planet n. If Jack can't get to planet n in any amount of time, print number -1.
standard output
PASSED
211f02c4ea4f738594f1391382faefbc
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class test { /* * array list * * ArrayList<Integer> al=new ArrayList<>(); creating BigIntegers * * BigInteger a=new BigInteger(); BigInteger b=new BigInteger(); * * hash map * * HashMap<Integer,Integer> hm=new HashMap<Integer,Integ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
e8cf94b3bb6bfa9ef25e695f227d30aa
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
//package c1270.a; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { private static class FastScanner { private BufferedReader reader = null; private StringTokenizer tokenizer = null;...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
5bc0198342a15b9b8379ad70028ea48a
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class Test { public static void main(String[] args) { Scanner read = new Scanner(System.in); int t = read.nextInt(); while(t-- > 0) { int n = read.nextInt(), k1 = read.nextInt(), k2 = read.nextInt(); int first = 0, second = 0; for(int i = 0; i < k1; i++) first = Math.m...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
1b0c706d74fda9d7ff1e835b7c27f799
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.lang.*; public class Main{ static long mod = 1000000007; static InputReader in = new InputReader(System.in); static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args)...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
466b5c82d1697b8f2cbfa1647650b2d6
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-- > 0){ int n = scan.nextInt(),k1 = scan.nextInt(),k2 = scan.nextInt(),flag = 0; int arr1[] = new int[k1]; int arr2[] = new int[k...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
8302e529194dc1b142726a0358ddac29
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; import java.io.*; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; public class Hello { public static void main(String[] args) { //try { // FileInputStream fis = new FileInputStream("data.txt"); // System.setIn(fis); Scanner in = new S...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
65c71bf648cf4b61cde7385d1904b5f1
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class D { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); while (t>0){ int n = input.nextInt(); int a = input.nextInt(); int b = input.nextInt(); boolean flag...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
563a0bcecadbe92be792507433922c88
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.Scanner; public class CardGame { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); int k1 = sc.nextInt(); int k2 = sc.nextInt();...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
0788efb35d3800840ee44346fa0fe134
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t > 0){ int n = sc.nextInt();int k1 = sc.nextInt(); int k2 = sc.nextInt(); int[] a1 = new int[k1]; int[]...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
e0fad7d51644198f02e6f7c32d8277b6
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.stream.IntStream; import java.util.Arrays; import java.util.Scanner; import java.util.OptionalInt; /** * Built using CHelper plug-in * Actual solution is at the top * * @author ky112233...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
ce9487fa649bb70271a81db3ed531d3b
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a=sc.nextInt(); int b=sc.nextInt(); int ma=0; int temp; for(int i=1;i<=n;i++) { ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
d112edf290a6e106c11df9e433de51ff
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1270a { public static void main(String[] args) throws IOException { int t = ri(); while (t --> 0) { int n = rni(), k1 = ni(), k2 = ni(), a = maxof(ria(k1)), b = maxof...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
f6554c5d21c065ff1fbb83cd7715c683
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class b { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); int k1=sc.nextInt(); //no. of cards with the first player int k2=sc.nextInt(); //no. of cards with the 2nd player i...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
a22d423f4e5b4f122f1ccafdbc0ed0ae
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; public class file { public static void main(String args[])throws IOException { BufferedReader reader =new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(reader.readLine()); while(t>0) { StringTokenizer tk = new Stri...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
e87f40679c68107c2337a38882bf9f1d
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Almas Turganbayev */ public class Main { public static void main(String[] args) { Inp...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
4f20b159d652a86597b117fe4e546fe6
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int i = 0; i < t; i++){ int n = in.nextInt(); int[] a = new int[in.nextInt()]; int[] b = new int[in.nextInt()]; f...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
943ca25432897c9567a7671efddfb6e8
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class JavaApplication14 { public static void main(String[] args) { Scanner io = new Scanner(System.in); int t = io.nextInt(); while(t-- != 0) { int n = io.nextInt(), a = io.nextInt(), b = io.nextInt(); int max1 = Integer.MIN_VALUE, max...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
3f36c1c7a76ef172b7c72f1061dc2c91
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; public class card_game{ public static void main(String []args){ Scanner sc = new Scanner(System.in); int []first_values = new int[99]; int []second_values = new int[99]; int t =sc.nextInt(); while(t-- >0){ int n=sc.nextInt()...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
2b6bdeba58572c92f70319056300753c
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class CardGame { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while (t-- > 0) { int n = s.nextInt(); int k1 = s.nextInt(); int k2 = s.nextInt(); int firstMax = 0; for (int i = 0; i < k1; ++i) { ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
04fb0cc6238839fbc19082889d8c3b27
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class CodeForces { public static void main(String[] args) throws IOException,NumberFormatException{ try { FastScanner sc=new FastScanner(); int t =sc.nextInt(); while(t-->0) { int n=sc.nextInt(),k1=sc.nextInt(),k2=sc.nextInt(); ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
77bf1f77e7d6ba6bec10dda09ee59c68
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; public class B implements Runnable { public void run() { final InputReader sc = new InputReader(System.in); final PrintWriter out = new PrintWriter(System.out); int t=sc.nextInt(); ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
1ff86b550ce5d69c6f1c508443f1576d
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; import java.math.BigDecimal; import java.math.RoundingMode; public class forces{ public static void main(String args[])throws IOException{ DataInputStream ins=new DataInputStream(System.in); int t=Integer.parseInt(ins.readLine()); for(in...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
3d6db0c0aa35595c62f3ab868a6586fc
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int x=0;x<t;x++) { int n=sc.nextInt(); int k1=sc.nextInt(); int k2=sc.nextInt(); int arr1[]=...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
54823a17e686c6f8adf682b400fa2690
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class main{ public static void main(String[] args) { Scanner in=new Scanner(System.in); int t,n,k1,k2; t=in.nextInt(); for(int i=1;i<=t;i++) { ArrayList<Integer>a=ne...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
012f3a9e8e415a9b2aee7a15e0f14f6c
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; import java.io.*; public class GB2019A { public static void main(String[] args) { MyScanner sc = new MyScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); while (t > 0) { int n = sc.nextInt(); ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
888bfe47cd79c6c35fd9ee81982fdadf
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; import java.io.*; public class Test { public static void main(String[] args) { InputReader in = new InputReader(System.in); int testCases = in.nextInt(); for(; testCases > 0 ; testCases--) { int noCards = in.nextInt(); int noFirstCards = in.nextIn...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
3594d6f6942e643b64e4ece7ed164ed9
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java. util. Arrays; /* 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 in...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
8f3df36c2f94cfcaa4952c03f60a6961
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { // Complete the maximumSum function below private static final Scanner scanner = new Scanner(System.in); public static vo...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
32e14b98ee61638be2862f0f57e82539
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Solution{ public static void test_case(BufferedReader in) throws IOException{ String str[] = in.readLine().trim().split(" "); int n = Integer.parseInt(str[0]); int a = Integer.parseInt(str[1]); int b = Integer...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
cd6c39935bab359213d5011601e4ce30
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; public class Q1 { public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); while (t-- > 0) { int N = in.nextInt(), k1 = in.nextInt(), k2 = ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
7f8c584976ec3b4f5e3dd8897b692196
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int k1=sc.nextInt(); int k2=sc.nextInt(); for(int i=0;i<k1;i++){ ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
71d9e4398c31a2a59b0ac5ab455545b3
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class A1270_CardGame { public static void main(String[] args) { PrintWriter pw = new PrintWriter(System.out); ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
32b2672c0b5d6ac799d556026b5a4e6c
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a=sc.nextInt(); int b=sc.nextInt(); int ma=0; int temp; ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
9b04a87725ea1b3b24cb2d63489db125
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args){ Scanner scan=new Scanner(System.in); int tests=scan.nextInt(); for (int i=0;i<tests;i++){ scan.nextInt(); int p1=scan.nextInt(); int p2=scan.nextInt(); int max1=0; int max2=0; for (int j=0;j<p1;j++){ int e...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
bd79eec8e431cd1c9849801fd510175a
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i=0;i<t;i++){ int n,k1,k2; n= sc.nextInt(); k1= sc.nextInt(); k2= sc.next...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
9d351ed231ae98dbb0ae50db99c18993
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
//package codeforces; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Findlo { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int i = 0; i < t; i++) { ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
6ff86485d5060da2e6aeb80096cd42ed
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
//package com.company; //import com.sun.source.tree.Tree; //import com.sun.source.tree.TreeVisitor; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main{ static class FastReader { BufferedReader br; StringTokenizer s...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
99717b780807d0241c9efde132e9b245
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = Integer.parseInt(scan.nextLine()); for (int i = 0; i < t; i++) { int n = scan.nextInt(); int k1 = scan.nextInt(); int k2...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
c0d57ae4e6eb7035a6a79b5f491d9891
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; import java.io.*; public class C1270 { public static void main(String[] args) { Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int T = sc.nextInt(); while (T-- > 0) { int N = sc.nextInt(), A = sc.nextInt(), B = sc.nextInt(); int maxA = 0; while ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
a3f0174dd97790ef3d808142495097ca
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t > 0) { --t; in.nextInt(); int k1 = in.nextInt(); int k2 = in.nextInt(); int p1_max = 1; for (int i=0;i<k1;++i) { int val = in.nextInt();...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
1c1b8302edef65c5ed04cf9fd38b8f23
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
// package CodeForces; import java.util.Scanner; public class CardGame { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while (t > 0) { int noc = scn.nextInt(); int fst = scn.nextInt(); int sec = scn.nextInt(); int[] a = new int[fst]; int[]...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
5946952c24b93ac36e822a920fec424e
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
//codeforces 700 import java.io.*; import java.util.*; import java.util.Arrays; import static java.lang.System.out; public class CardGame { public...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
45b53b224d712ed2eeb3b09a246fcabc
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.math.BigInteger; import java.util.*; public class div { private static Scanner sc = new Scanner(System.in); private static Map<Integer, Long> m = new TreeMap<>(); private static List<Integer> l = new ArrayList<>(); private static long sum = 0; public static String sortString(String inp...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
e30b13302a2d86c4c52a527b3954782b
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElement...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
1388b81fb0b4accf59e0c48c93da42db
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class problem1372A25 { private static Scanner sc=new Scanner(System.in); public static void main(String[] args) { int t=sc.nextInt(); while(t>0) { int max1=Integer.MIN_VALUE; int max2=Integer.MIN_VALUE; int n=sc.nextInt(); ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
48c49330e0b34bfb66c8a74e208f8fae
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; impo...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
01b0b7db5dac8fe14735317e5a03bad4
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; import java.util.*; import static java.lang.System.*; /* Shortcut--> Arrays.stream(n).parallel(...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
e083636418d8761ec3ace6aaf117720a
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.Scanner; public class card { public static void main(String[] args) { Scanner in = new Scanner(System.in); int tot = 0; tot = in.nextInt(); for (int i = 0; i < tot; i++) { int hai =0 ; int a=0, b=0, c=0,v = 0; int max = 0; ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
66bce1804c4c45d860fbce234519e8e1
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class Cf1270A { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t,n,k1,k2,m1,m2,i; t=sc.nextInt(); while(t>0){ m1=0; m2=0; n=sc.nextInt(); k1=sc.nextInt(); k2=sc.nextInt(); int []arr=new int[k1]; int []brr=new int[k2]; for (i=0;...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
a423530f67b4d082ce0526cd3234afff
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; public class CardGame { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int numoftc = Integer.parseInt(st....
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
52e39e1077132117f79d38c62c79ed16
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.*; import java.util.*; //System.out.println(); public class A { public static int[] a1; public static int[] a2; public static int n; public static int k1; public static int k2; public static String s; public static void main(String[] args) throws IOException { Buf...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
c2f8357c10d13261a9c91661d7e9fc86
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.util.stream.*; public class Solution { public static void main (String[] args) throws java.lang.Exception { int t; int n, k1, k2, card; Scanner scan = new Scanner(System.in); t = scan.nextInt(); while(t-- > 0) { n = scan.nextInt(); ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
1ae47a918d9452ef3330fd01e0cb81ad
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; public class Yash { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); int k1 = sc.nextInt(); int k2 = sc.nextInt(); int a[] = new int[k1]; int b[] = new int[k2]; int max1 = 0; int...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
f28726622f660805473aa051c2e89b65
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int z=0;z<t;z++){ int n=in.nextInt(); int k1=in.nextInt(); int k2=in.nextInt(); int a[]...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
74bfe661a7352197c6257aa62e833858
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class Main { public static void process()throws IOException { int n=ni(),k1=ni(),k2=ni(); int a1=0,a2=0; for(int i=1;i<=k1;i++) a1=Math.max(a1,ni()); for(int i=1;i<=k2;i++) a2=Math.max(a2,ni()); if(a1>a...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
92d5c5454d556f95d8c23aefca8509d4
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class main { public static int getMax(int[] inputArray){ int maxValue = inputArray[0]; int position=0; for(int i=1;i < inputArray.length;i++){ if(inputArray[i] > maxValue){ maxValue = inputArray[i]; ...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
06b2d9a52ea6b0686cf4ff47a01efb8e
train_002.jsonl
1577628300
Two players decided to play one interesting card game.There is a deck of $$$n$$$ cards, with values from $$$1$$$ to $$$n$$$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between players such that e...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Ribhav */ public class Mai...
Java
["2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5"]
1 second
["YES\nNO"]
NoteIn the first test case of the example, there is only one possible move for every player: the first player will put $$$2$$$, the second player will put $$$1$$$. $$$2&gt;1$$$, so the first player will get both cards and will win.In the second test case of the example, it can be shown that it is the second player who ...
Java 11
standard input
[ "greedy", "games", "math" ]
3ef23f114be223255bd10131b2375b86
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$k_1$$$, $$$k_2$$$ ($$$2 \le n \le 100, 1 \le k_1 \le n - 1, 1 \le k_2 \le n - 1, k_1 +...
800
For each test case, output "YES" in a separate line, if the first player wins. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).
standard output
PASSED
e9acf5924b933a5d00bd0d7a81231e97
train_002.jsonl
1369582200
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w...
256 megabytes
import java.util.*; import java.io.*; public class third { public static void main(String args[]) { int n,k; Scanner sc = new Scanner(System.in); n=sc.nextInt(); k=sc.nextInt(); if(k>=((n*(n-1))/2)) { System.out.println("no solution"); } else { int f=0,t=0; while(t<n) { System.out....
Java
["4 3", "2 100"]
2 seconds
["0 0\n0 1\n1 0\n1 1", "no solution"]
null
Java 6
standard input
[ "constructive algorithms" ]
a7846e4ae1f3fa5051fab9139a25539c
A single line which contains two space-separated integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ 109).
1,300
If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi, yi (|xi|, |yi| ≤ 109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|, |y...
standard output
PASSED
850ff54c173f395c85ab7fc2b3c54584
train_002.jsonl
1369582200
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w...
256 megabytes
import java.io.IOException; import java.util.Scanner; /** * Created with IntelliJ IDEA. * User: Alexander Shchegolev * Date: 26.05.13 * Time: 18:08 * To change this template use File | Settings | File Templates. */ public class Three { public static void main(String[] args) throws IOException { Scann...
Java
["4 3", "2 100"]
2 seconds
["0 0\n0 1\n1 0\n1 1", "no solution"]
null
Java 6
standard input
[ "constructive algorithms" ]
a7846e4ae1f3fa5051fab9139a25539c
A single line which contains two space-separated integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ 109).
1,300
If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi, yi (|xi|, |yi| ≤ 109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|, |y...
standard output
PASSED
50a5596d58e9ad9ab9f8b148aa5aa1a3
train_002.jsonl
1369582200
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class CF { public static void main(String[] args) throws IOException { InputStream inpu...
Java
["4 3", "2 100"]
2 seconds
["0 0\n0 1\n1 0\n1 1", "no solution"]
null
Java 6
standard input
[ "constructive algorithms" ]
a7846e4ae1f3fa5051fab9139a25539c
A single line which contains two space-separated integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ 109).
1,300
If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi, yi (|xi|, |yi| ≤ 109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|, |y...
standard output
PASSED
f30d359c26e47f7e8413e1313e4cf408
train_002.jsonl
1369582200
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.io.*; import java.awt.Point; import java.math.BigInteger; import static java.lang.Math.*; public class Codeforces_Solution_C implements Runnable{ final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; ...
Java
["4 3", "2 100"]
2 seconds
["0 0\n0 1\n1 0\n1 1", "no solution"]
null
Java 6
standard input
[ "constructive algorithms" ]
a7846e4ae1f3fa5051fab9139a25539c
A single line which contains two space-separated integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ 109).
1,300
If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi, yi (|xi|, |yi| ≤ 109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|, |y...
standard output
PASSED
782c071f2b598ac4f7da077226a5f96e
train_002.jsonl
1369582200
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.*; import java.util.*; /** * * @author N-AssassiN */ public class Main { private static BufferedReader reader; private static BufferedWriter out; private static StringTokenizer tokenizer;...
Java
["4 3", "2 100"]
2 seconds
["0 0\n0 1\n1 0\n1 1", "no solution"]
null
Java 6
standard input
[ "constructive algorithms" ]
a7846e4ae1f3fa5051fab9139a25539c
A single line which contains two space-separated integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ 109).
1,300
If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi, yi (|xi|, |yi| ≤ 109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|, |y...
standard output
PASSED
0e1a8de6c44415c8f79a05118800625b
train_002.jsonl
1369582200
Currently Tiny is learning Computational Geometry. When trying to solve a problem called "The Closest Pair Of Points In The Plane", he found that a code which gave a wrong time complexity got Accepted instead of Time Limit Exceeded.The problem is the follows. Given n points in the plane, find a pair of points between w...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), k = in.nextInt(); int sum = 0; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) sum++; Strin...
Java
["4 3", "2 100"]
2 seconds
["0 0\n0 1\n1 0\n1 1", "no solution"]
null
Java 6
standard input
[ "constructive algorithms" ]
a7846e4ae1f3fa5051fab9139a25539c
A single line which contains two space-separated integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ 109).
1,300
If there doesn't exist such a data which let the given code get TLE, print "no solution" (without quotes); else print n lines, and the i-th line contains two integers xi, yi (|xi|, |yi| ≤ 109) representing the coordinates of the i-th point. The conditions below must be held: All the points must be distinct. |xi|, |y...
standard output
PASSED
b038d87ef123741774d2c29c99e84cd9
train_002.jsonl
1591886100
You are given $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$.For each $$$a_i$$$ find its two divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ (where $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$) or say that there is no such pair.
256 megabytes
import java.util.*; import java.io.*; public class Main { static class Scan { private byte[] buf=new byte[1024]; private int index; private InputStream in; private int total; public Scan() { in=System.in; } public int scan()throws IOExcepti...
Java
["10\n2 3 4 5 6 7 8 9 10 24"]
2 seconds
["-1 -1 -1 -1 3 -1 -1 -1 2 2 \n-1 -1 -1 -1 2 -1 -1 -1 5 3"]
NoteLet's look at $$$a_7 = 8$$$. It has $$$3$$$ divisors greater than $$$1$$$: $$$2$$$, $$$4$$$, $$$8$$$. As you can see, the sum of any pair of divisors is divisible by $$$2$$$ as well as $$$a_7$$$.There are other valid pairs of $$$d_1$$$ and $$$d_2$$$ for $$$a_{10}=24$$$, like $$$(3, 4)$$$ or $$$(8, 3)$$$. You can pr...
Java 11
standard input
[ "constructive algorithms", "number theory", "math" ]
8639d3ec61f25457c24c5e030b15516e
The first line contains single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the size of the array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$2 \le a_i \le 10^7$$$) — the array $$$a$$$.
2,000
To speed up the output, print two lines with $$$n$$$ integers in each line. The $$$i$$$-th integers in the first and second lines should be corresponding divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ or $$$-1$$$ and $$$-1$$$ if there is no such pair. If there are multiple answe...
standard output
PASSED
ce0585b9c30ca5725292510a5cf834e2
train_002.jsonl
1591886100
You are given $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$.For each $$$a_i$$$ find its two divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ (where $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$) or say that there is no such pair.
256 megabytes
import java.util.*; public class Main { static int prime[]=new int[10000000+1]; static int factor[]=new int[10000000+1]; static void prims() { Arrays.fill(prime,1); for(int i=2;i<=Math.sqrt(10000000);i++) { if(prime[i]==1) { for(int j=i*i;...
Java
["10\n2 3 4 5 6 7 8 9 10 24"]
2 seconds
["-1 -1 -1 -1 3 -1 -1 -1 2 2 \n-1 -1 -1 -1 2 -1 -1 -1 5 3"]
NoteLet's look at $$$a_7 = 8$$$. It has $$$3$$$ divisors greater than $$$1$$$: $$$2$$$, $$$4$$$, $$$8$$$. As you can see, the sum of any pair of divisors is divisible by $$$2$$$ as well as $$$a_7$$$.There are other valid pairs of $$$d_1$$$ and $$$d_2$$$ for $$$a_{10}=24$$$, like $$$(3, 4)$$$ or $$$(8, 3)$$$. You can pr...
Java 11
standard input
[ "constructive algorithms", "number theory", "math" ]
8639d3ec61f25457c24c5e030b15516e
The first line contains single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the size of the array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$2 \le a_i \le 10^7$$$) — the array $$$a$$$.
2,000
To speed up the output, print two lines with $$$n$$$ integers in each line. The $$$i$$$-th integers in the first and second lines should be corresponding divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ or $$$-1$$$ and $$$-1$$$ if there is no such pair. If there are multiple answe...
standard output
PASSED
e5e107dde09222c8f6f1f7c5f3bc8249
train_002.jsonl
1591886100
You are given $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$.For each $$$a_i$$$ find its two divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ (where $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$) or say that there is no such pair.
256 megabytes
import java.util.*; public class Main { static int prime[]=new int[10000000+1]; static int factor[]=new int[10000000+1]; static void prims() { Arrays.fill(prime,1); for(int i=2;i<=Math.sqrt(10000000);i++) { if(prime[i]==1) { for(int j=i*i;...
Java
["10\n2 3 4 5 6 7 8 9 10 24"]
2 seconds
["-1 -1 -1 -1 3 -1 -1 -1 2 2 \n-1 -1 -1 -1 2 -1 -1 -1 5 3"]
NoteLet's look at $$$a_7 = 8$$$. It has $$$3$$$ divisors greater than $$$1$$$: $$$2$$$, $$$4$$$, $$$8$$$. As you can see, the sum of any pair of divisors is divisible by $$$2$$$ as well as $$$a_7$$$.There are other valid pairs of $$$d_1$$$ and $$$d_2$$$ for $$$a_{10}=24$$$, like $$$(3, 4)$$$ or $$$(8, 3)$$$. You can pr...
Java 11
standard input
[ "constructive algorithms", "number theory", "math" ]
8639d3ec61f25457c24c5e030b15516e
The first line contains single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the size of the array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$2 \le a_i \le 10^7$$$) — the array $$$a$$$.
2,000
To speed up the output, print two lines with $$$n$$$ integers in each line. The $$$i$$$-th integers in the first and second lines should be corresponding divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ or $$$-1$$$ and $$$-1$$$ if there is no such pair. If there are multiple answe...
standard output
PASSED
f7b876d4eeb6e098ff6bb5f906f4f69e
train_002.jsonl
1591886100
You are given $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$.For each $$$a_i$$$ find its two divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ (where $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$) or say that there is no such pair.
256 megabytes
import java.io.*; import java.util.*; public class Main{ static int mod = (int)(Math.pow(10, 9) + 7); public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); boolean[] sieve = new boolean[(int)Math.sqrt(pow(10,7))+1...
Java
["10\n2 3 4 5 6 7 8 9 10 24"]
2 seconds
["-1 -1 -1 -1 3 -1 -1 -1 2 2 \n-1 -1 -1 -1 2 -1 -1 -1 5 3"]
NoteLet's look at $$$a_7 = 8$$$. It has $$$3$$$ divisors greater than $$$1$$$: $$$2$$$, $$$4$$$, $$$8$$$. As you can see, the sum of any pair of divisors is divisible by $$$2$$$ as well as $$$a_7$$$.There are other valid pairs of $$$d_1$$$ and $$$d_2$$$ for $$$a_{10}=24$$$, like $$$(3, 4)$$$ or $$$(8, 3)$$$. You can pr...
Java 11
standard input
[ "constructive algorithms", "number theory", "math" ]
8639d3ec61f25457c24c5e030b15516e
The first line contains single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the size of the array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$2 \le a_i \le 10^7$$$) — the array $$$a$$$.
2,000
To speed up the output, print two lines with $$$n$$$ integers in each line. The $$$i$$$-th integers in the first and second lines should be corresponding divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ or $$$-1$$$ and $$$-1$$$ if there is no such pair. If there are multiple answe...
standard output
PASSED
148e5f85967fab7b90ca6f18b60b5fea
train_002.jsonl
1591886100
You are given $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$.For each $$$a_i$$$ find its two divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ (where $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$) or say that there is no such pair.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.stream.Collectors; public class ProblemD { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamR...
Java
["10\n2 3 4 5 6 7 8 9 10 24"]
2 seconds
["-1 -1 -1 -1 3 -1 -1 -1 2 2 \n-1 -1 -1 -1 2 -1 -1 -1 5 3"]
NoteLet's look at $$$a_7 = 8$$$. It has $$$3$$$ divisors greater than $$$1$$$: $$$2$$$, $$$4$$$, $$$8$$$. As you can see, the sum of any pair of divisors is divisible by $$$2$$$ as well as $$$a_7$$$.There are other valid pairs of $$$d_1$$$ and $$$d_2$$$ for $$$a_{10}=24$$$, like $$$(3, 4)$$$ or $$$(8, 3)$$$. You can pr...
Java 11
standard input
[ "constructive algorithms", "number theory", "math" ]
8639d3ec61f25457c24c5e030b15516e
The first line contains single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the size of the array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$2 \le a_i \le 10^7$$$) — the array $$$a$$$.
2,000
To speed up the output, print two lines with $$$n$$$ integers in each line. The $$$i$$$-th integers in the first and second lines should be corresponding divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ or $$$-1$$$ and $$$-1$$$ if there is no such pair. If there are multiple answe...
standard output
PASSED
b68ae01b31605c014b5e0e7daee37a92
train_002.jsonl
1591886100
You are given $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$.For each $$$a_i$$$ find its two divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ (where $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$) or say that there is no such pair.
256 megabytes
// Imports import java.util.*; import java.io.*; public class D { static int MAX_NUM = (int)1E7 + 10; static int smallest[]; static void loadPrimes() { smallest[1] = 1; for(int i = 2; i < MAX_NUM; i++) { smallest[i] = i; } for(int ...
Java
["10\n2 3 4 5 6 7 8 9 10 24"]
2 seconds
["-1 -1 -1 -1 3 -1 -1 -1 2 2 \n-1 -1 -1 -1 2 -1 -1 -1 5 3"]
NoteLet's look at $$$a_7 = 8$$$. It has $$$3$$$ divisors greater than $$$1$$$: $$$2$$$, $$$4$$$, $$$8$$$. As you can see, the sum of any pair of divisors is divisible by $$$2$$$ as well as $$$a_7$$$.There are other valid pairs of $$$d_1$$$ and $$$d_2$$$ for $$$a_{10}=24$$$, like $$$(3, 4)$$$ or $$$(8, 3)$$$. You can pr...
Java 11
standard input
[ "constructive algorithms", "number theory", "math" ]
8639d3ec61f25457c24c5e030b15516e
The first line contains single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the size of the array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$2 \le a_i \le 10^7$$$) — the array $$$a$$$.
2,000
To speed up the output, print two lines with $$$n$$$ integers in each line. The $$$i$$$-th integers in the first and second lines should be corresponding divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ or $$$-1$$$ and $$$-1$$$ if there is no such pair. If there are multiple answe...
standard output
PASSED
3ba29feb61fa1f7077b7452adc73ced4
train_002.jsonl
1591886100
You are given $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$.For each $$$a_i$$$ find its two divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ (where $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$) or say that there is no such pair.
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; public class Main{ static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, ...
Java
["10\n2 3 4 5 6 7 8 9 10 24"]
2 seconds
["-1 -1 -1 -1 3 -1 -1 -1 2 2 \n-1 -1 -1 -1 2 -1 -1 -1 5 3"]
NoteLet's look at $$$a_7 = 8$$$. It has $$$3$$$ divisors greater than $$$1$$$: $$$2$$$, $$$4$$$, $$$8$$$. As you can see, the sum of any pair of divisors is divisible by $$$2$$$ as well as $$$a_7$$$.There are other valid pairs of $$$d_1$$$ and $$$d_2$$$ for $$$a_{10}=24$$$, like $$$(3, 4)$$$ or $$$(8, 3)$$$. You can pr...
Java 11
standard input
[ "constructive algorithms", "number theory", "math" ]
8639d3ec61f25457c24c5e030b15516e
The first line contains single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the size of the array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$2 \le a_i \le 10^7$$$) — the array $$$a$$$.
2,000
To speed up the output, print two lines with $$$n$$$ integers in each line. The $$$i$$$-th integers in the first and second lines should be corresponding divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ or $$$-1$$$ and $$$-1$$$ if there is no such pair. If there are multiple answe...
standard output
PASSED
39d3b281225cb6a4bc3d4c7f881c19b1
train_002.jsonl
1591886100
You are given $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$.For each $$$a_i$$$ find its two divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ (where $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$) or say that there is no such pair.
256 megabytes
import java.io.*; import java.util.*; public class D{ private void solve() { int primes[]=new int[10000007]; for(int i=2;i<10000007;i++){ if(primes[i]==0){ for(int j=i;j<10000007;j+=i){ primes[j]=i; } } } int n=nextInt(); ...
Java
["10\n2 3 4 5 6 7 8 9 10 24"]
2 seconds
["-1 -1 -1 -1 3 -1 -1 -1 2 2 \n-1 -1 -1 -1 2 -1 -1 -1 5 3"]
NoteLet's look at $$$a_7 = 8$$$. It has $$$3$$$ divisors greater than $$$1$$$: $$$2$$$, $$$4$$$, $$$8$$$. As you can see, the sum of any pair of divisors is divisible by $$$2$$$ as well as $$$a_7$$$.There are other valid pairs of $$$d_1$$$ and $$$d_2$$$ for $$$a_{10}=24$$$, like $$$(3, 4)$$$ or $$$(8, 3)$$$. You can pr...
Java 11
standard input
[ "constructive algorithms", "number theory", "math" ]
8639d3ec61f25457c24c5e030b15516e
The first line contains single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the size of the array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$2 \le a_i \le 10^7$$$) — the array $$$a$$$.
2,000
To speed up the output, print two lines with $$$n$$$ integers in each line. The $$$i$$$-th integers in the first and second lines should be corresponding divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ or $$$-1$$$ and $$$-1$$$ if there is no such pair. If there are multiple answe...
standard output
PASSED
f7c2383cabd4b44e53c5c710e55ff671
train_002.jsonl
1591886100
You are given $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$.For each $$$a_i$$$ find its two divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ (where $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$) or say that there is no such pair.
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class d { public static void print(String str,int val){ System.out.println(str+" "+val); } public static void debug(long[][] arr){ int len = arr.length; for(int i=0;i<l...
Java
["10\n2 3 4 5 6 7 8 9 10 24"]
2 seconds
["-1 -1 -1 -1 3 -1 -1 -1 2 2 \n-1 -1 -1 -1 2 -1 -1 -1 5 3"]
NoteLet's look at $$$a_7 = 8$$$. It has $$$3$$$ divisors greater than $$$1$$$: $$$2$$$, $$$4$$$, $$$8$$$. As you can see, the sum of any pair of divisors is divisible by $$$2$$$ as well as $$$a_7$$$.There are other valid pairs of $$$d_1$$$ and $$$d_2$$$ for $$$a_{10}=24$$$, like $$$(3, 4)$$$ or $$$(8, 3)$$$. You can pr...
Java 11
standard input
[ "constructive algorithms", "number theory", "math" ]
8639d3ec61f25457c24c5e030b15516e
The first line contains single integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the size of the array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$2 \le a_i \le 10^7$$$) — the array $$$a$$$.
2,000
To speed up the output, print two lines with $$$n$$$ integers in each line. The $$$i$$$-th integers in the first and second lines should be corresponding divisors $$$d_1 &gt; 1$$$ and $$$d_2 &gt; 1$$$ such that $$$\gcd(d_1 + d_2, a_i) = 1$$$ or $$$-1$$$ and $$$-1$$$ if there is no such pair. If there are multiple answe...
standard output