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
3687b03cda7491fdbf4e66d580397f94
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
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 */ public class Main { public static...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
763af780c4d5239df9cbd6083c7b9f02
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); PrintWriter pw = new PrintWriter(System.out); int R = sc.ni(); int G = sc.ni(); int B = sc.ni(); int[] reds = new int[R]; for (int i = 0; i < R; ...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
3cd00b197c60ec582f902be968cd4e90
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class DEdu93{ public static void main(String args[]){ FastReader sc = new FastReader(); StringBuilder sb=new StringBuilder(); int t,i,n1,n2,n3,j,k; t=1; while(t-->0){ n1=sc.nextInt(); n2=sc.nextInt(); n3=sc.nextInt(); int r[]=new i...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
c41c98c097ba1a373319d75fc46fffb1
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.*; import java.io.*; public class Mamo { static long mod=1000000007; static Reader in=new Reader(); static List<Integer >G[]; static long a[],p[],xp[],xv[]; static StringBuilder Sd=new StringBuilder(),Sl=new StringBuilder(); public static void main(String [] args) { //Di...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
62c68ee356af59a30ce4301768350409
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.*; import java.util.stream.*; import java.io.*; import java.math.*; public class Main { static boolean FROM_FILE = false; static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { if (FROM_FILE) { t...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
f829f35e2ac6ace0288219cf56f56e37
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.*; // scanner.nextInt(); public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int r = scanner.nextInt(); int g = scanner.nextInt(); int b = scanner.nextInt(); long[] rr = new ...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
b0809f965fae504af7c368f4fc7f71ad
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.*; public class Prac{ static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputReader(InputStream st) { ...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
a5864d2aba3fe56bc1e4df5103f1a472
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.util.Random; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import ...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
5a33a2c606529f03c85dc1924c7b6aeb
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static long testCase(int R, int G, int B, int[] r, int[] g, int[] b) { int[][][] dp = new int[R + 1][G + 1][B + 1]; Arrays.sort(r); Arrays.sort(g); Arrays.sort(b); reverse(r); reverse(g); re...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
c04b7bf27203ec9d54b99e43013b791f
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static long testCase(int R, int G, int B, int[] r, int[] g, int[] b) { int ans = 0; int[][][] dp = new int[R + 1][G + 1][B + 1]; for (int i = 0; i <= R; i++) { for (int j = 0; j <= G; j++) { Arra...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
d6226b53ebe59e7b235ff0b0cc44f818
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.*; import java.util.*; public class D { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st ...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
b934dd71bb8cead5038ee683701f38f3
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.Entry; import static java.lang.Math.*; public class Ans implements Runnable { public static void main(String args[]) { Ans s = new Ans(); s.run(); } static void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } InputReader sc = ...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
833c28607becaef4b9729db3d764e870
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.Entry; import static java.lang.Math.*; public class Ans implements Runnable { public static void main(String args[]) { Ans s = new Ans(); s.run(); } static void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } InputReader sc = ...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
71990ca068dd2357e7959c440458a86f
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.*; import java.util.*; public class CFJava1 { static BufferedReader in; static PrintWriter out; static StringTokenizer st; static int[][][] dp; static boolean[][][] vst; static int A, B, C; static List<Integer> al, bl, cl; static void solve(int a, int b, int c) { if (vst[a][b][c]) ret...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
2a04ea509012acc6b4701500e5048150
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
//package Competitive; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ String[] arr= {"a"}; code3 obj=new code3(); obj.main(arr); } } class code3{ public static void main(String[] args) throws IOException{ Scanner sc=new Scanner(System.in);...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
21ae2966db8df26cb67d69b6e2317fe2
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.*; import java.io.*; public class R665D{ public static void main(String[] main) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); PrintWriter out = new PrintWriter(System.out); int R = Integer.pa...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
709f7c9cde87ac387da9e9d8f2f794ef
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class ColoredRectangles { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int R = sc.nextInt(); int G = sc.nextInt(); int B = sc.nextInt(); int[] r = ne...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
896e7164b80dafc7d51be9e954d9fc60
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class ColoredRectangles { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int R = sc.nextInt(); int G = sc.nextInt(); int B = sc.nextInt(); int[] r = ne...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
83abdca4f293f62e5d81d117b6322f4b
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; import static java.lang.Math.*; public class Main { static final int mod = (int)1e9+7; static Long[] arrR, arrG, arrB; static long[][][] dp; public static void main(String[] args) throws Exception { FastReader in = new FastR...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
3b415444010e76b6c0496dd1870ac041
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class pb4 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int R = in.nextInt(); int G = in.nextInt(); int B = in.nextInt(); ArrayList<Integer> ra = new ArrayLi...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
4ecdefb0baed55fecb34d77d6404bf91
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
/** * author : stdnoob * created : 2020-08-20 23:04:45 **/ // This code will help stdnoob to become red coder on codeforces and CEO of his dream company // import java.util.*; import java.io.*; import java.lang.*; public class codeforces { static int R,G,B; static Integer r[],g[],b[]; static l...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
9e380d2d31fc52d11abd39535be43c50
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class NewProblem { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(Syst...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
5ff2e80c825767eb57b35cd1a766b96f
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
539a8558c0bc4c7fad73a2c156354df2
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
6fa242ab5252d277f093b7b0115d82ae
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.*; import java.io.*; public class D_1398 { static int a, b, c; static int[] ar1, ar2, ar3; static long[][][] memo; public static long dp(int i, int j, int k) { int z = (i == a ? 0 : 1) + (j == b ? 0 : 1) + (k == c ? 0 : 1); if(z <= 1) return 0; if(memo[i][j][k] != -1) return memo[i][...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
d61d381f0cebf40b2652ea1801e81005
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.*; import java.util.*; public class TaskD { public static void main(String[] args) throws Exception { Reader sc = new Reader(); PrintWriter pw = new PrintWriter(System.out); try { int n = sc.nextInt(); int m = sc.nextInt(); int o =...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
f2406a5ea79b264409ceb4aa9f13c3f4
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Scanner sc = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); long mod = 998244353; public static void main(String[] arg...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
af5c2e198f7f28a42492de2776b7ec02
train_002.jsonl
1597415700
You are given three multisets of pairs of colored sticks: $$$R$$$ pairs of red sticks, the first pair has length $$$r_1$$$, the second pair has length $$$r_2$$$, $$$\dots$$$, the $$$R$$$-th pair has length $$$r_R$$$; $$$G$$$ pairs of green sticks, the first pair has length $$$g_1$$$, the second pair has length $$$g_...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.*; import java.math.*; public class Main { InputStream is; PrintWriter out; String INPUT = ""; //class Declaration static class pair implements Comparable < pair > { long x; long y; p...
Java
["1 1 1\n3\n5\n4", "2 1 3\n9 5\n1\n2 8 5", "10 1 1\n11 7 20 15 19 14 2 4 13 14\n8\n11"]
2 seconds
["20", "99", "372"]
NoteIn the first example you can construct one of these rectangles: red and green with sides $$$3$$$ and $$$5$$$, red and blue with sides $$$3$$$ and $$$4$$$ and green and blue with sides $$$5$$$ and $$$4$$$. The best area of them is $$$4 \times 5 = 20$$$.In the second example the best rectangles are: red/blue $$$9 \ti...
Java 8
standard input
[ "dp", "sortings", "greedy" ]
9e6cb1e8037e1d35b6c6fe43f805a22f
The first line contains three integers $$$R$$$, $$$G$$$, $$$B$$$ ($$$1 \le R, G, B \le 200$$$) — the number of pairs of red sticks, the number of pairs of green sticks and the number of pairs of blue sticks. The second line contains $$$R$$$ integers $$$r_1, r_2, \dots, r_R$$$ ($$$1 \le r_i \le 2000$$$) — the lengths of...
1,800
Print the maximum possible total area of the constructed rectangles.
standard output
PASSED
245f0cacb284edebb6129bc23ce6be20
train_002.jsonl
1432658100
What-The-Fatherland is a strange country! All phone numbers there are strings consisting of lowercase English letters. What is double strange that a phone number can be associated with several bears!In that country there is a rock band called CF consisting of n bears (including Mike) numbered from 1 to n. Phone numbe...
256 megabytes
import java.io.*; import java.util.*; public class R305qGMikeAndFriends { static int n,N,Q; static StringBuilder S; static int start[], len[]; static int sa[], rank[], lcp[]; static int logs[],z[][]; static Query q[]; static int[] ans; static BIT bit; public static void main(String args[]) { InputReader i...
Java
["5 5\na\nab\nabab\nababab\nb\n1 5 1\n3 5 1\n1 5 2\n1 5 3\n1 4 5"]
3 seconds
["7\n5\n6\n3\n6"]
null
Java 7
standard input
[ "data structures", "string suffix structures", "trees", "strings" ]
1ce1fdce039eb779382fb4ae0d4bbe35
The first line of input contains integers n and q (1 ≤ n ≤ 2 × 105 and 1 ≤ q ≤ 5 × 105). The next n lines contain the phone numbers, i-th line contains a string si consisting of lowercase English letters (). The next q lines contain the information about the questions, each of them contains integers l, r and k (1 ≤ l ≤...
2,800
Print the answer for each question in a separate line.
standard output
PASSED
e2d1fa143a182056b3f0ab1df9c17314
train_002.jsonl
1432658100
What-The-Fatherland is a strange country! All phone numbers there are strings consisting of lowercase English letters. What is double strange that a phone number can be associated with several bears!In that country there is a rock band called CF consisting of n bears (including Mike) numbered from 1 to n. Phone numbe...
256 megabytes
//package round305; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; public class E3 { InputStream is; PrintWriter out; String INPUT = ""; void so...
Java
["5 5\na\nab\nabab\nababab\nb\n1 5 1\n3 5 1\n1 5 2\n1 5 3\n1 4 5"]
3 seconds
["7\n5\n6\n3\n6"]
null
Java 7
standard input
[ "data structures", "string suffix structures", "trees", "strings" ]
1ce1fdce039eb779382fb4ae0d4bbe35
The first line of input contains integers n and q (1 ≤ n ≤ 2 × 105 and 1 ≤ q ≤ 5 × 105). The next n lines contain the phone numbers, i-th line contains a string si consisting of lowercase English letters (). The next q lines contain the information about the questions, each of them contains integers l, r and k (1 ≤ l ≤...
2,800
Print the answer for each question in a separate line.
standard output
PASSED
aa9839948d22b23c2fd5a1ac96b095eb
train_002.jsonl
1432658100
What-The-Fatherland is a strange country! All phone numbers there are strings consisting of lowercase English letters. What is double strange that a phone number can be associated with several bears!In that country there is a rock band called CF consisting of n bears (including Mike) numbered from 1 to n. Phone numbe...
256 megabytes
//package round305; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; public class E2 { InputStream is; PrintWriter out; String INPUT = ""; void so...
Java
["5 5\na\nab\nabab\nababab\nb\n1 5 1\n3 5 1\n1 5 2\n1 5 3\n1 4 5"]
3 seconds
["7\n5\n6\n3\n6"]
null
Java 7
standard input
[ "data structures", "string suffix structures", "trees", "strings" ]
1ce1fdce039eb779382fb4ae0d4bbe35
The first line of input contains integers n and q (1 ≤ n ≤ 2 × 105 and 1 ≤ q ≤ 5 × 105). The next n lines contain the phone numbers, i-th line contains a string si consisting of lowercase English letters (). The next q lines contain the information about the questions, each of them contains integers l, r and k (1 ≤ l ≤...
2,800
Print the answer for each question in a separate line.
standard output
PASSED
79659c9ed018db15734f37ae3032877a
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. *****************************************************...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
72612cb47d94c016459ddf1622c3eddd
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String[]args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); for(int d=0;d<n;d++) { int c=0; int max; int a=0; int b=0; int[]arr=new int[4]; for(int i=0;i<4;i++) { in...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
818751794241a3a6255b9334f6a30d92
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String[]args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); while (n-->0) { int a =sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt(),e=a+b+c+d; if (e%3!=0) Sys...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
6d8f0786d560301b85abde19a524aeec
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { long a = sc.nextLong(); ...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
c278684cb4c5c45bf019c6a9a10025d4
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int q = scan.nextInt(); while (q-->0) { int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt(); int...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
130bdc889b4cf3e621c4ce58cbd213ff
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.util.Scanner; public class Problem_A { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); for(int i = 0; i < n; i ++) { int a = input.nextInt(); int b = input.nextInt(); int c = input.nextInt(); int P = input.nextInt(); int res...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
6205530fdfa0915f234f053e5f9f2e9e
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.Arrays; public class Test2{ public static void main(String args[]){ Scanner in=new Scanner (System.in); int t=in.nextInt(); while(--t>=0) { int a=in.nextInt(); int b=in.nextInt(); ...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
fda245d44254e12281522ac4d44d09e8
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.util.Scanner; public class Div31 { public static void main(String args[]) throws Exception { Scanner scn=new Scanner(System.in); int t=scn.nextInt(); for(int i=0;i<t;i++) { long a=scn.nextLong(); long b=scn.nextLong(); long c=scn.nextLong(); long n=scn.nextLong(); long total=a+b+c+...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
daa2ad134cc60890476b4d903a180b7f
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class d { public static void main (String[] args) { PrintWriter pw=new PrintWriter(System.out); Scanner sc=new Scanner(System.in); int t=sc.next...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
4b76df33eb16c939496de97b0a7501e0
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.io.*; import java.util.*; import java.util.*; public class Bricks { public static void main(String []argh){ Scanner s=new Scanner(System.in); int tc=s.nextInt(); while(tc>0) { tc--; long a=s.nextLong(); long b=s.nextLong(); long c=s.nextLong(); l...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
d6e02b9346cc0d4a13f5c5a5419249a7
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.lang.*; import java.util.*; import java.io.*; public class collectingcoin { Scanner sc=new Scanner(System.in); PrintWriter pr=new PrintWriter(System.out,true); public static void main(String... args) { collectingcoin c=new collectingcoin(); c.prop(); } public void prop() { ...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
3e1e7e2295a08818433964787d272a60
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.io.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; /** * @author Utkarsh * */ public class FibinacciSeries { static class FastReader { BufferedReader br; StringToken...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
47e9cdff3406d9581bc8d877aea9e516
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class ProblemA1294 { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int testCases = sc.nextInt(); // read input as integer for(int...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
4f103bbbc0c5416292bc9ab1223d6591
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner input = new Scanner(System.in); int noOfTests = input.nextInt(); for(int i = 0; i<noOfTests; i++ ) { int total=0; int n1,n2,n3,n4; n1 = input.nextInt(); n...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
7dfdc84d04040b06d9515cab6120f190
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public final class coins { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int[] arr = new int[3]; for(int i=0;i<t;i++) { arr[0]=sc.nextInt(); arr[1]=sc.nextInt(); arr[2]=sc.nextInt(); int ...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
5d6cb0baae11c8079bbb6cc6bd414974
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
/** * Created by first on 1/27/2020. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; /** * Created by first on 1/27/2020. */ public class ProblemA { pub...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
4b62fece1764488aa4132f3410274d1e
train_002.jsonl
1579703700
Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int test=s.nextInt(); while(test>0) { int a=s.nextInt(); int b=s.nextInt(); int c=s.nextInt...
Java
["5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3"]
2 seconds
["YES\nYES\nNO\nNO\nYES"]
null
Java 8
standard input
[ "math" ]
bc5fb5d6882b86d83e5c86f21d806a52
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins ...
800
For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.
standard output
PASSED
fadfbca24c73bcfd14074bc50a8db41c
train_002.jsonl
1535898900
Given an array $$$a$$$ of $$$n$$$ integers and an integer $$$k$$$ ($$$2 \le k \le n$$$), where each element of the array is denoted by $$$a_i$$$ ($$$0 \le i &lt; n$$$). Perform the operation $$$z$$$ given below on $$$a$$$ and print the value of $$$z(a,k)$$$ modulo $$$10^{9}+7$$$.function z(array a, integer k): if le...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class...
Java
["3 2\n9 1 10", "5 3\n5 8 7 1 9"]
2 seconds
["29", "34"]
NoteIn the first example: for $$$a=(9,1,10)$$$, $$$ans=19$$$ and $$$b=(9,10)$$$, for $$$a=(9,10)$$$, $$$ans=10$$$ and $$$b=(10)$$$, for $$$a=(10)$$$, $$$ans=0$$$. So the returned value is $$$19+10+0=29$$$.In the second example: for $$$a=(5,8,7,1,9)$$$, $$$ans=25$$$ and $$$b=(8,8,9)$$$, for $$$a=(8,8,9)$$$, $$$an...
Java 8
standard input
[ "data structures", "combinatorics", "math" ]
95689b68064e7c86af938094ee3acdc3
The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le k \le n \le 10^6$$$) — the length of the initial array $$$a$$$ and the parameter $$$k$$$. The second line of input contains $$$n$$$ integers $$$a_0, a_1, \ldots, a_{n - 1}$$$ ($$$1 \le a_{i} \le 10^9$$$) — the elements of the array $$$a$$$.
2,500
Output the only integer, the value of $$$z(a,k)$$$ modulo $$$10^9+7$$$.
standard output
PASSED
ee4e5f266764bff6db28929de77fe9b4
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.function.IntConsumer; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in */ public...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
68e0c1cd56f6673c8c8bd17bf09ca563
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.*; import java.util.StringTokenizer; import java.util.TreeSet; public class Day9 { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); Strin...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
3b3a6d0a00b28fc084a1202843e8ed18
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main { static Scanner scan=new Scanner(System.in); public static void main(String[] args) { int a=scan.nextInt(); int b=scan.nextInt(); Set<String>set=new HashSet<>(); String s[]=new String[a]; for(int i=0;i<a;i++) { ...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
b7152b09683e990000e21b1ce517e01e
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.Arrays; import java.util.Vector; public class Main { public static void main(String[] args) throws IOException...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
ac8ceb5c1d04da4d418fbc96d56e6ad2
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class HyperSet implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private ...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
2c673f3282b2be7b300e8e237afe25d9
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class HyperSet implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private ...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
e9856cc00b86e13516262052da061e33
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.*; import java.util.*; public class HelloWorld { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(br.readLine()); int a ...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
4c1ca0d11fe472507e62faf13f1951b8
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.HashMap; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelpe...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
57d1062316ac9de57103fc524cfa4e81
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); sc.nextLine(); HashSet<String> h = new HashSet<String>(); String[] cards = new String[n]; ...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
660e4933d147a9c833cc7c132dbf6136
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); String[] str = br.readLine().split(" "); int n = I...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
62b50e535c2ef8c2b37e32e3b57592a3
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
// package Strings; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class zCF_2B_HyperSet { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); ArrayL...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
43190ccd583cb34ecffa4996b449171e
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.*; import java.util.*; public class sixtwelveB { static int[][] cards; public static void main(String[] args) throws Exception { FastScanner input = new FastScanner(System.in); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); // FastScanner input = new ...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
4a1d5370dea01a2f12d62027ff14d30b
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; public class Main { public static void main(String[] args)throws Exception { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); String [] line=in.readLine().split(" "); ...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
f549cad785bb42faed5cbed9f4407373
train_002.jsonl
1578233100
Bees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, shading, and color. In this game, some combinations of three cards are said to make up a set. For every...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.HashSet; import java.util.StringTokenizer; public class HyperSet { public static void main(String[] args) { FastReader input=new FastReader(); int n=input.nextInt(...
Java
["3 3\nSET\nETS\nTSE", "3 4\nSETE\nETSE\nTSES", "5 4\nSETT\nTEST\nEEET\nESTE\nSTES"]
3 seconds
["1", "0", "2"]
NoteIn the third example test, these two triples of cards are sets: "SETT", "TEST", "EEET" "TEST", "ESTE", "STES"
Java 8
standard input
[ "data structures", "implementation", "brute force" ]
ae7c80e068e267673a5f910bb0b121ec
The first line of each test contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 1500$$$, $$$1 \le k \le 30$$$) — number of cards and number of features. Each of the following $$$n$$$ lines contains a card description: a string consisting of $$$k$$$ letters "S", "E", "T". The $$$i$$$-th character of this string de...
1,500
Output a single integer — the number of ways to choose three cards that form a set.
standard output
PASSED
d9745cabda58a439097e4c3b384a539e
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); while(n-- > 0){ String temp = input.next(); if(temp.matches("R[0-9]+C[0-9]+")){ ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
11602ad66fd34fde0d20aa2c7c36d48d
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Arrays; import java.util.Locale; import java.util.Scanner; public class MainTest { static void print(int a[]) { for(int i=0;i<a.length;i++) System.out.print(a[i]+" "); System.out.println(); } static int sum(int []a) { int res=0; for(int i=0;i<a.leng...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
0cc3e9967f29b20957e377a67e56ec95
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; public class B1 { static class MyScanner2 { BufferedReader br; ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
06b9a8a1f42b00e550e79ecd2047f473
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; public class B1 { static class MyScanner2 { BufferedReader br; ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
8395a71fcd72eb94b6c8f12396ed04ea
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.*; import java.io.*; public class Spreadsheets { static char arr[]; static String toAlph(int N) { if(N <= 26) return String.valueOf(arr[N-1]); else return toAlph((N-1)/26) + arr[(N-1)%26]; } public static void main(String args[]) { MyScanner s1=new MyScanner(); ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
20da3dab376b53b293812a3f247e0bad
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; public class B1 { static class MyScanner2 { BufferedReader br; ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
8a4f5ff8719a207eb66cf72ed842218f
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; public class B1 { public static int pow(int a, int exp) { int result = 1;...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
31462f8ee6e0a90de54f4702f3663ea3
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class Spreadsheet { public static String convert(String input) { String output = ""; if(input.charAt(0) == 'R' && Character.isDigit(input.charAt(1)) && input.indexOf('C')>1) { int row, column; row = Integer.parseInt(input.substr...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
7026cc723b10c0f81552d55d7e797417
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Jose */ import java.util.ArrayList; import java.util.Scanner; public class Excel { public static void main(String[] args) { Scanner in = new Scanner(System.in); int casos = Integ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
2c4a50bd80da301d6f6c3dc6b1b278f4
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Jose */ import java.util.ArrayList; import java.util.Scanner; public class Excel { public static void main(String[] args) { Scanner in = new Scanner(System.in); int casos = Integ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
257c4ac7f86f2a89cebd6125b2fb0713
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class Spreadsheets { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] input = new String[n]; for(int i=0;i<n;i++){ input[i] = sc.next(); } sc.close(); for(int i=0;i<n;i++){ if(input[i].matches("R[0-9]+C[...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
901293d02cf3fe7a6c2114ae10c6fba6
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String charFromInt(int c) { return Character.toString((char)((int)'A' + c)); } public static int intFromChar(char c) { return ((int)c - (int)'A'); } public static St...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
a42fa512eca85a50dfce9361e761b3e1
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.* ; public class Main { public static void main(String [] args) { Scanner s=new Scanner(System.in); int T =s.nextInt(); s.nextLine(); for(int cas=0;cas<T;cas++) { String str=s.nextLine(); boolean flag=false ; int index=0; if(str.charAt(1)>='0'&&str.charAt(1)<='9') { for(...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
a80cf0b75637a889a96871e2136c3fcf
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader buffReader = new BufferedReader(new InputStreamReader( System.in)); int n = Integer.parseInt(b...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
1d518238f741c173cedf2420f0bae2d7
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class B1 { public static String toRXCY(String input){ int i; for(i=0; i<input.length(); ++i){ if(input.charAt(i)<='9') break; } String row = input.substring(0, i); String column = input.substring(i,...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
8c4b57fba340ecb74753127afbb61b3f
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; /** * * @author SSD */ public class Spreadsheets { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); for (int i = 0; i < tc; i++)...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
e113f27fbdbf7261ab8c26a7f4b2ec32
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; /** * * @author SSD */ public class Spreadsheets { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); for (int i = 0; i < tc; i++) ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
07467829189ccb5ee3ffe2eacc8b4668
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
/** * * @author Faruk */ import java.util.Arrays; import java.util.Scanner; import java.util.HashSet; import java.util.HashMap; import java.util.ArrayList; public class tmp { public static void main(String [] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
474ad89be8699d0d8221a7422826bad1
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
/** * * @author Faruk */ import java.util.Arrays; import java.util.Scanner; import java.util.HashSet; import java.util.HashMap; import java.util.ArrayList; public class tmp { public static void main(String [] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
5d9eb18e220dc48decb8d7b64a504098
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class Main{ /** * @param args */ public static String changeNumSystem(String s){ int indexR = s.indexOf("R"); int indexC = s.indexOf("C"); if(s.contains("R") && s.contains("C") && indexR < indexC && s.charAt(indexR + 1) >= '1' && s.charAt(indexR + 1) <= '9'){ // RC to ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
37736c0f18e1f08ba9fe5e8b35230b9d
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Problem1B { // static String spreadsheet(String s) { // int c, i = 0, j = 0, n = 0; // String u; // // for (c = s.indexOf("C"); s.charAt(i) > 64;) // i++; // // // if (i < c) { // // ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
aa527073e9e4067de7af69e9b45f6218
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.io.*; public class BH { public static void main(String args[])throws IOException { BufferedReader obj=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(obj.readLine()); int c=0,f,l; while(c<n) { String s=obj.readLine(); char ch=s.charAt(0); String p="",q=""; l=s.length(); for(f=1;...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
a519d3d2a56813c9b9688605e1c40d91
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class B { public static String toString(String x, String y) { Integer col = Integer.parseInt(y); List<Integer> buf = new ArrayList<Integer>(); if (col == 0){ buf.add(0); } while (col > 0) { if (col % 26 == 0) ...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
b761628b48f169f95e1c66cf7ca9c9a0
train_002.jsonl
1266580800
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th...
64 megabytes
import java.util.Scanner; public class cf { public static Scanner input=new Scanner(System.in); public static void B1_dtol(int d) { if(d!=0) { if(d%26==0) { B1_dtol(d/26-1); System.out.printf("Z"); } else { B1_dtol(d/26); System.out.printf("%c", d%26+'A'-1); } } } public static in...
Java
["2\nR23C55\nBC23"]
10 seconds
["BC23\nR23C55"]
null
Java 7
standard input
[ "implementation", "math" ]
910c0e650d48af22fa51ab05e8123709
The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 .
1,600
Write n lines, each line should contain a cell coordinates in the other numeration system.
standard output
PASSED
25aa2475ee59e735f747f6cca1f75a34
train_002.jsonl
1520177700
In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated near base of tree and any other inflorescence with number i (i &gt; 1) is situated at the top of bra...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static long sx = 0, sy = 0, mod = (long) (1e9 + 7); static ArrayList<Integer>[] a; static long[][][] dp; static int[] size; static long[] farr; public static PrintWriter out; static ArrayList<pair> pa = new ArrayList<>(); ...
Java
["3\n1 1", "5\n1 2 2 2", "18\n1 1 1 4 4 3 2 2 2 10 8 9 9 9 10 10 4"]
1 second
["1", "3", "4"]
NoteIn first example Arcady will be able to collect only one apple, initially situated in 1st inflorescence. In next second apples from 2nd and 3rd inflorescences will roll down and annihilate, and Arcady won't be able to collect them.In the second example Arcady will be able to collect 3 apples. First one is one initi...
Java 11
standard input
[ "dfs and similar", "trees", "graphs" ]
a4563e6aea9126e20e7a33df664e3171
First line of input contains single integer number n (2 ≤ n ≤ 100 000)  — number of inflorescences. Second line of input contains sequence of n - 1 integer numbers p2, p3, ..., pn (1 ≤ pi &lt; i), where pi is number of inflorescence into which the apple from i-th inflorescence rolls down.
1,500
Single line of output should contain one integer number: amount of apples that Arcady will be able to collect from first inflorescence during one harvest.
standard output
PASSED
c7d80604eb9f08d04f06c388250726e1
train_002.jsonl
1520177700
In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated near base of tree and any other inflorescence with number i (i &gt; 1) is situated at the top of bra...
256 megabytes
// practice with kaiboy import java.io.*; import java.util.*; public class CF931D extends PrintWriter { CF931D() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF931D o = new CF931D(); o.main(); o.flush(); } void main() { int n = sc.nextInt(); int[] ...
Java
["3\n1 1", "5\n1 2 2 2", "18\n1 1 1 4 4 3 2 2 2 10 8 9 9 9 10 10 4"]
1 second
["1", "3", "4"]
NoteIn first example Arcady will be able to collect only one apple, initially situated in 1st inflorescence. In next second apples from 2nd and 3rd inflorescences will roll down and annihilate, and Arcady won't be able to collect them.In the second example Arcady will be able to collect 3 apples. First one is one initi...
Java 11
standard input
[ "dfs and similar", "trees", "graphs" ]
a4563e6aea9126e20e7a33df664e3171
First line of input contains single integer number n (2 ≤ n ≤ 100 000)  — number of inflorescences. Second line of input contains sequence of n - 1 integer numbers p2, p3, ..., pn (1 ≤ pi &lt; i), where pi is number of inflorescence into which the apple from i-th inflorescence rolls down.
1,500
Single line of output should contain one integer number: amount of apples that Arcady will be able to collect from first inflorescence during one harvest.
standard output
PASSED
e7c06166ba7027dd816997e4faf2e617
train_002.jsonl
1520177700
In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated near base of tree and any other inflorescence with number i (i &gt; 1) is situated at the top of bra...
256 megabytes
// package com.company; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.sql.SQLOutput; import java.util.*; public class Main { public static void main(String[] args) throws IOException { ...
Java
["3\n1 1", "5\n1 2 2 2", "18\n1 1 1 4 4 3 2 2 2 10 8 9 9 9 10 10 4"]
1 second
["1", "3", "4"]
NoteIn first example Arcady will be able to collect only one apple, initially situated in 1st inflorescence. In next second apples from 2nd and 3rd inflorescences will roll down and annihilate, and Arcady won't be able to collect them.In the second example Arcady will be able to collect 3 apples. First one is one initi...
Java 11
standard input
[ "dfs and similar", "trees", "graphs" ]
a4563e6aea9126e20e7a33df664e3171
First line of input contains single integer number n (2 ≤ n ≤ 100 000)  — number of inflorescences. Second line of input contains sequence of n - 1 integer numbers p2, p3, ..., pn (1 ≤ pi &lt; i), where pi is number of inflorescence into which the apple from i-th inflorescence rolls down.
1,500
Single line of output should contain one integer number: amount of apples that Arcady will be able to collect from first inflorescence during one harvest.
standard output
PASSED
907c83105658a1df4f471d695d025f0e
train_002.jsonl
1484499900
PolandBall has such a convex polygon with n veritces that no three of its diagonals intersect at the same point. PolandBall decided to improve it and draw some red segments. He chose a number k such that gcd(n, k) = 1. Vertices of the polygon are numbered from 1 to n in a clockwise way. PolandBall repeats the following...
256 megabytes
import java.util.Scanner; /** * Created by Khiem on 1/17/2017. */ public class D { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); SegmentTree st = new SegmentTree(n); int k = in.nextInt(); if (k > n / 2) { k ...
Java
["5 2", "10 3"]
4 seconds
["2 3 5 8 11", "2 3 4 6 9 12 16 21 26 31"]
NoteThe greatest common divisor (gcd) of two integers a and b is the largest positive integer that divides both a and b without a remainder.For the first sample testcase, you should output "2 3 5 8 11". Pictures below correspond to situations after drawing lines.
Java 8
standard input
[ "data structures" ]
fc82362dbda74396ad6db0d95a0f7acc
There are only two numbers in the input: n and k (5 ≤ n ≤ 106, 2 ≤ k ≤ n - 2, gcd(n, k) = 1).
2,000
You should print n values separated by spaces. The i-th value should represent number of polygon's sections after drawing first i lines.
standard output
PASSED
99849b887cf4beb59638290dad98eff8
train_002.jsonl
1484499900
PolandBall has such a convex polygon with n veritces that no three of its diagonals intersect at the same point. PolandBall decided to improve it and draw some red segments. He chose a number k such that gcd(n, k) = 1. Vertices of the polygon are numbered from 1 to n in a clockwise way. PolandBall repeats the following...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class D { public static void main(String[] args) throws NumberFormatExceptio...
Java
["5 2", "10 3"]
4 seconds
["2 3 5 8 11", "2 3 4 6 9 12 16 21 26 31"]
NoteThe greatest common divisor (gcd) of two integers a and b is the largest positive integer that divides both a and b without a remainder.For the first sample testcase, you should output "2 3 5 8 11". Pictures below correspond to situations after drawing lines.
Java 8
standard input
[ "data structures" ]
fc82362dbda74396ad6db0d95a0f7acc
There are only two numbers in the input: n and k (5 ≤ n ≤ 106, 2 ≤ k ≤ n - 2, gcd(n, k) = 1).
2,000
You should print n values separated by spaces. The i-th value should represent number of polygon's sections after drawing first i lines.
standard output
PASSED
0010c6e400b5b5eb0d50e6e6d86872c3
train_002.jsonl
1601219100
You are given an array $$$a$$$ consisting of $$$n$$$ integers numbered from $$$1$$$ to $$$n$$$.Let's define the $$$k$$$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $$$k$$$ (recall that a subsegment of $$$a$$$ of length $$$k$$$ is a contiguous part o...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class KAmazingNumbers { public static void main(String[] args) throws IOException{ BufferedReader r=new BufferedReader(new InputStreamReader(System.i...
Java
["3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1"]
1 second
["-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1"]
null
Java 11
standard input
[ "data structures" ]
b7abfb1103bb1796c8f89653c303d7dc
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the number of elements in the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \d...
1,500
For each test case print $$$n$$$ integers, where the $$$i$$$-th integer is equal to the $$$i$$$-amazing number of the array.
standard output
PASSED
2e0ab658ddec234c9df2b335ac1e2d29
train_002.jsonl
1601219100
You are given an array $$$a$$$ consisting of $$$n$$$ integers numbered from $$$1$$$ to $$$n$$$.Let's define the $$$k$$$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $$$k$$$ (recall that a subsegment of $$$a$$$ of length $$$k$$$ is a contiguous part o...
256 megabytes
import com.sun.source.tree.Tree; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; public class problemC { private static void solve...
Java
["3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1"]
1 second
["-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1"]
null
Java 11
standard input
[ "data structures" ]
b7abfb1103bb1796c8f89653c303d7dc
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the number of elements in the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \d...
1,500
For each test case print $$$n$$$ integers, where the $$$i$$$-th integer is equal to the $$$i$$$-amazing number of the array.
standard output
PASSED
3189486cfc828cc3a776926e9355bc9e
train_002.jsonl
1601219100
You are given an array $$$a$$$ consisting of $$$n$$$ integers numbered from $$$1$$$ to $$$n$$$.Let's define the $$$k$$$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $$$k$$$ (recall that a subsegment of $$$a$$$ of length $$$k$$$ is a contiguous part o...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C { static Scanner sc = new Scanner(System.in); static StringBuilder out = new StringBuilder(); public static void main(String[] args){ int t = sc.nextInt(); while (t-- >0){ int n = sc.nextInt(); int[] a...
Java
["3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1"]
1 second
["-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1"]
null
Java 11
standard input
[ "data structures" ]
b7abfb1103bb1796c8f89653c303d7dc
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the number of elements in the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \d...
1,500
For each test case print $$$n$$$ integers, where the $$$i$$$-th integer is equal to the $$$i$$$-amazing number of the array.
standard output
PASSED
f07b5f5dd7502775966598282500a680
train_002.jsonl
1601219100
You are given an array $$$a$$$ consisting of $$$n$$$ integers numbered from $$$1$$$ to $$$n$$$.Let's define the $$$k$$$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $$$k$$$ (recall that a subsegment of $$$a$$$ of length $$$k$$$ is a contiguous part o...
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 Main { static int[]arr = new int[]{1,2,3}; static boolean[]vis = new boolean[3]; public static boolean isOK(int seg , ArrayList<I...
Java
["3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1"]
1 second
["-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1"]
null
Java 11
standard input
[ "data structures" ]
b7abfb1103bb1796c8f89653c303d7dc
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the number of elements in the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \d...
1,500
For each test case print $$$n$$$ integers, where the $$$i$$$-th integer is equal to the $$$i$$$-amazing number of the array.
standard output
PASSED
f498394f6cbc9e2d8c3c92752bbb8493
train_002.jsonl
1601219100
You are given an array $$$a$$$ consisting of $$$n$$$ integers numbered from $$$1$$$ to $$$n$$$.Let's define the $$$k$$$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $$$k$$$ (recall that a subsegment of $$$a$$$ of length $$$k$$$ is a contiguous part o...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class C { private...
Java
["3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1"]
1 second
["-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1"]
null
Java 11
standard input
[ "data structures" ]
b7abfb1103bb1796c8f89653c303d7dc
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the number of elements in the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \d...
1,500
For each test case print $$$n$$$ integers, where the $$$i$$$-th integer is equal to the $$$i$$$-amazing number of the array.
standard output
PASSED
b8b9db6d92f4b5c21e4a02f202b2e152
train_002.jsonl
1601219100
You are given an array $$$a$$$ consisting of $$$n$$$ integers numbered from $$$1$$$ to $$$n$$$.Let's define the $$$k$$$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $$$k$$$ (recall that a subsegment of $$$a$$$ of length $$$k$$$ is a contiguous part o...
256 megabytes
import java.util.*; import java.io.*; public class C673 { 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
["3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1"]
1 second
["-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1"]
null
Java 11
standard input
[ "data structures" ]
b7abfb1103bb1796c8f89653c303d7dc
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the number of elements in the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \d...
1,500
For each test case print $$$n$$$ integers, where the $$$i$$$-th integer is equal to the $$$i$$$-amazing number of the array.
standard output
PASSED
e1f1121498bbff642d03540a40b28739
train_002.jsonl
1601219100
You are given an array $$$a$$$ consisting of $$$n$$$ integers numbered from $$$1$$$ to $$$n$$$.Let's define the $$$k$$$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $$$k$$$ (recall that a subsegment of $$$a$$$ of length $$$k$$$ is a contiguous part o...
256 megabytes
import java.util.*; import java.util.Scanner; import java.io.*; import javax.lang.model.util.ElementScanner6; import static java.lang.System.out; public class C1417 { public static void main(String args[]) { FastReader in=new FastReader(); PrintWriter pr = new PrintWriter(new BufferedWrit...
Java
["3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1"]
1 second
["-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1"]
null
Java 11
standard input
[ "data structures" ]
b7abfb1103bb1796c8f89653c303d7dc
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the number of elements in the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \d...
1,500
For each test case print $$$n$$$ integers, where the $$$i$$$-th integer is equal to the $$$i$$$-amazing number of the array.
standard output
PASSED
d07c71ff7c74c5e16ec33e63bc8a04aa
train_002.jsonl
1601219100
You are given an array $$$a$$$ consisting of $$$n$$$ integers numbered from $$$1$$$ to $$$n$$$.Let's define the $$$k$$$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $$$k$$$ (recall that a subsegment of $$$a$$$ of length $$$k$$$ is a contiguous part o...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class ProblemC { static int gcd(int a, int b) { while(a%b!=0) { int buf = b; b=a%b; a = buf; } ret...
Java
["3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1"]
1 second
["-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1"]
null
Java 11
standard input
[ "data structures" ]
b7abfb1103bb1796c8f89653c303d7dc
The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the number of elements in the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \d...
1,500
For each test case print $$$n$$$ integers, where the $$$i$$$-th integer is equal to the $$$i$$$-amazing number of the array.
standard output