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 | 74810bdcdffa31166a4c6ec2c3f75a11 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here'
Scanner sc = n... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 721b58ceaf178157b62a4da1bec520b6 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int yo = sc.nextInt();
while(yo-->0) {
int n = 3;
int[] a = new int[3];
for(int i = 0; i < 3; i++) {
a[i] = sc.nextInt();
}
int[] b = new int[3];
for(in... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 4c4cfadaa0705bcbc778041cfbec84e2 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | //package prob.daniels;
import javax.swing.*;
import java.math.BigInteger;
import java.util.*;
import java.awt.Desktop;
public class Problem {
private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
boats1();
}
public static void boats1() {
... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | f7d75d6d7a9c0845cbfe9140cf92832c | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.util.*;
import java.io.*;
public class B_ {
private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
private static StringTokenizer st;
priva... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | d9f20233dfeac4934264c5d26883ee31 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.util.*;
import java.io.*;
public class B_TernarySequence {
private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
private static StringTokenizer... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 429463376327e7caa6dcb73e274bafc2 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.util.Scanner;
public class A{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
while(t-- > 0){
int x1, y1, z1;
x1 = sc.nextInt();
y1 = sc.nextInt();
z1 = sc... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 92ceda163b1c5594115186b1f4219ac3 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class B {
public static void main(String[] args) {
FastReader reader = new FastReader();
int tests = reader.nextInt();
for(int test = 1; test <= tests; tes... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 57a8f77d661412eec35ae2671130646a | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf1401b {
public static void main(String[] args) throws IOException {
int t = ri();
while (t --> 0) {
int x1 = rni(), y1 = ni(), z1 = ni(), x2 = rni(), y2 = ni(), z2 = ... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 92e7a1a690cce86e7d9450d39a475040 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.util.Scanner;
public class Ternarysequence {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-- > 0) {
int [] a, b;
a = new int[3];
b = new int[3];
for (int i=0; i<3; i++) a... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | f2beffa9372d517d4edec1dc2e7c812d | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.time.chrono.MinguoChronology;
import java.util.*;
public class test{
public static void main(String args[])
{
Scanner take=new Scanner(System.in);
int t=take.nextInt();
int z1,o1,t1,z2,t2,o2,i,j,n,ans,tmp;
int a[],b[],c[];
while(t--!=0)
{ ans=0;
z1=take.nextInt();
o1=take.nextInt();
t... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | c1573dc0f938ac8b43f6ec13d0cb0503 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class TernarySequence {
static int[] a, b;
public static void main(String[] args) throws IOException {
InputReader reader = new InputReader();
PrintWriter writer = new PrintWriter(System.out);
int t = reader.nextInt();
f... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 25ad865ebda0ead736ca2b79a36a10af | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args)throws IOException {
Scanner scan=new Scanner(System.in);
// BufferedReader br=new BufferedReader... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 3fbad9c0051d451b241eb9e6e3712949 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Arrays;
import java.lang.Math;
import java.util.ArrayList;
import java.util.List;
/*
1
3 20 977
0 5 995
*/
public class A {
public static void main(String[] args) {
... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | fceb88250dc8727d968dbb40b7861ca9 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | /* IMPORTANT: Multiple classes and nested static classes are supported */
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class cf {
public static void main(String args[] ) throws Exception {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 1d9e4f40b72c91b3e246e0676f004a7a | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.util.Scanner;
import java.awt.image.BandedSampleModel;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class B {
public... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 667ff0a18734569c5c0af0be7e80ecdd | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Pb{
public static void main(String[] args)throws IOException{
FastReader sc = new FastReader();
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out),"ASCII"),512);
int t = sc.nextInt();
while(t-- > 0)... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 07bde7eb73a30125125d88da6599d519 | train_002.jsonl | 1598020500 | You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$... | 256 megabytes | /*
Modassir_Ali
algo.java
*/
import java.util.*;
import java.io.*;
import java.util.Stack ;
import java.util.HashSet;
import java.util.HashMap;
public class B_TernarySequence
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
... | Java | ["3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 0 1"] | 2 seconds | ["4\n2\n0"] | NoteIn the first sample, one of the optimal solutions is:$$$a = \{2, 0, 1, 1, 0, 2, 1\}$$$$$$b = \{1, 0, 1, 0, 2, 1, 0\}$$$$$$c = \{2, 0, 0, 0, 0, 2, 0\}$$$In the second sample, one of the optimal solutions is:$$$a = \{0, 2, 0, 0, 0\}$$$$$$b = \{1, 1, 0, 1, 0\}$$$$$$c = \{0, 2, 0, 0, 0\}$$$In the third sample, the only... | Java 11 | standard input | [
"constructive algorithms",
"greedy",
"math"
] | e1de1e92fac8a6db3222c0d3c26843d8 | The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the s... | 1,100 | For each test case, print the maximum possible sum of the sequence $$$c$$$. | standard output | |
PASSED | 677994e5e2755b237dc2d7e4f32357cc | train_002.jsonl | 1571236500 | This is an easier version of the problem. In this version, $$$n \le 2000$$$.There are $$$n$$$ distinct points in three-dimensional space numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th point has coordinates $$$(x_i, y_i, z_i)$$$. The number of points $$$n$$$ is even.You'd like to remove all $$$n$$$ points using a sequ... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Kraken7
*/
public class Main {
public static void main(String[] args)... | Java | ["6\n3 1 0\n0 3 0\n2 2 0\n1 0 0\n1 3 0\n0 1 0", "8\n0 1 1\n1 0 1\n1 1 0\n1 1 1\n2 2 2\n3 2 2\n2 3 2\n2 2 3"] | 1 second | ["3 6\n5 1\n2 4", "4 5\n1 6\n2 7\n3 8"] | NoteIn the first example, here is what points and their corresponding bounding boxes look like (drawn in two dimensions for simplicity, as all points lie on $$$z = 0$$$ plane). Note that order of removing matters: for example, points $$$5$$$ and $$$1$$$ don't form a perfectly balanced pair initially, but they do after ... | Java 11 | standard input | [
"constructive algorithms",
"geometry",
"greedy"
] | 47a9d72651f1407de89e28fb4b142367 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2000$$$; $$$n$$$ is even), denoting the number of points. Each of the next $$$n$$$ lines contains three integers $$$x_i$$$, $$$y_i$$$, $$$z_i$$$ ($$$-10^8 \le x_i, y_i, z_i \le 10^8$$$), denoting the coordinates of the $$$i$$$-th point. No two points coin... | 1,700 | Output $$$\frac{n}{2}$$$ pairs of integers $$$a_i, b_i$$$ ($$$1 \le a_i, b_i \le n$$$), denoting the indices of points removed on snap $$$i$$$. Every integer between $$$1$$$ and $$$n$$$, inclusive, must appear in your output exactly once. We can show that it is always possible to remove all points. If there are many so... | standard output | |
PASSED | 379450ea5478fa49ff680752a8badce1 | train_002.jsonl | 1571236500 | This is an easier version of the problem. In this version, $$$n \le 2000$$$.There are $$$n$$$ distinct points in three-dimensional space numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th point has coordinates $$$(x_i, y_i, z_i)$$$. The number of points $$$n$$$ is even.You'd like to remove all $$$n$$$ points using a sequ... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Objects;
import java.util.Random;
import java.ut... | Java | ["6\n3 1 0\n0 3 0\n2 2 0\n1 0 0\n1 3 0\n0 1 0", "8\n0 1 1\n1 0 1\n1 1 0\n1 1 1\n2 2 2\n3 2 2\n2 3 2\n2 2 3"] | 1 second | ["3 6\n5 1\n2 4", "4 5\n1 6\n2 7\n3 8"] | NoteIn the first example, here is what points and their corresponding bounding boxes look like (drawn in two dimensions for simplicity, as all points lie on $$$z = 0$$$ plane). Note that order of removing matters: for example, points $$$5$$$ and $$$1$$$ don't form a perfectly balanced pair initially, but they do after ... | Java 11 | standard input | [
"constructive algorithms",
"geometry",
"greedy"
] | 47a9d72651f1407de89e28fb4b142367 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2000$$$; $$$n$$$ is even), denoting the number of points. Each of the next $$$n$$$ lines contains three integers $$$x_i$$$, $$$y_i$$$, $$$z_i$$$ ($$$-10^8 \le x_i, y_i, z_i \le 10^8$$$), denoting the coordinates of the $$$i$$$-th point. No two points coin... | 1,700 | Output $$$\frac{n}{2}$$$ pairs of integers $$$a_i, b_i$$$ ($$$1 \le a_i, b_i \le n$$$), denoting the indices of points removed on snap $$$i$$$. Every integer between $$$1$$$ and $$$n$$$, inclusive, must appear in your output exactly once. We can show that it is always possible to remove all points. If there are many so... | standard output | |
PASSED | 750c9489ac295d63a193c5a523544a53 | train_002.jsonl | 1571236500 | This is an easier version of the problem. In this version, $$$n \le 2000$$$.There are $$$n$$$ distinct points in three-dimensional space numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th point has coordinates $$$(x_i, y_i, z_i)$$$. The number of points $$$n$$$ is even.You'd like to remove all $$$n$$$ points using a sequ... | 512 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int N=s.nextInt();
point[] rem=new point[N];
Map<point,Integer> index=new HashMap();
for(int i=0;i<N;i++){
rem[i]=new point(s.nextInt(),s.nextInt(),... | Java | ["6\n3 1 0\n0 3 0\n2 2 0\n1 0 0\n1 3 0\n0 1 0", "8\n0 1 1\n1 0 1\n1 1 0\n1 1 1\n2 2 2\n3 2 2\n2 3 2\n2 2 3"] | 1 second | ["3 6\n5 1\n2 4", "4 5\n1 6\n2 7\n3 8"] | NoteIn the first example, here is what points and their corresponding bounding boxes look like (drawn in two dimensions for simplicity, as all points lie on $$$z = 0$$$ plane). Note that order of removing matters: for example, points $$$5$$$ and $$$1$$$ don't form a perfectly balanced pair initially, but they do after ... | Java 11 | standard input | [
"constructive algorithms",
"geometry",
"greedy"
] | 47a9d72651f1407de89e28fb4b142367 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2000$$$; $$$n$$$ is even), denoting the number of points. Each of the next $$$n$$$ lines contains three integers $$$x_i$$$, $$$y_i$$$, $$$z_i$$$ ($$$-10^8 \le x_i, y_i, z_i \le 10^8$$$), denoting the coordinates of the $$$i$$$-th point. No two points coin... | 1,700 | Output $$$\frac{n}{2}$$$ pairs of integers $$$a_i, b_i$$$ ($$$1 \le a_i, b_i \le n$$$), denoting the indices of points removed on snap $$$i$$$. Every integer between $$$1$$$ and $$$n$$$, inclusive, must appear in your output exactly once. We can show that it is always possible to remove all points. If there are many so... | standard output | |
PASSED | c7503c5ea74e0ccd64f2644933b39126 | train_002.jsonl | 1571236500 | This is an easier version of the problem. In this version, $$$n \le 2000$$$.There are $$$n$$$ distinct points in three-dimensional space numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th point has coordinates $$$(x_i, y_i, z_i)$$$. The number of points $$$n$$$ is even.You'd like to remove all $$$n$$$ points using a sequ... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.FileInputStream;
import java.util.Arra... | Java | ["6\n3 1 0\n0 3 0\n2 2 0\n1 0 0\n1 3 0\n0 1 0", "8\n0 1 1\n1 0 1\n1 1 0\n1 1 1\n2 2 2\n3 2 2\n2 3 2\n2 2 3"] | 1 second | ["3 6\n5 1\n2 4", "4 5\n1 6\n2 7\n3 8"] | NoteIn the first example, here is what points and their corresponding bounding boxes look like (drawn in two dimensions for simplicity, as all points lie on $$$z = 0$$$ plane). Note that order of removing matters: for example, points $$$5$$$ and $$$1$$$ don't form a perfectly balanced pair initially, but they do after ... | Java 11 | standard input | [
"constructive algorithms",
"geometry",
"greedy"
] | 47a9d72651f1407de89e28fb4b142367 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2000$$$; $$$n$$$ is even), denoting the number of points. Each of the next $$$n$$$ lines contains three integers $$$x_i$$$, $$$y_i$$$, $$$z_i$$$ ($$$-10^8 \le x_i, y_i, z_i \le 10^8$$$), denoting the coordinates of the $$$i$$$-th point. No two points coin... | 1,700 | Output $$$\frac{n}{2}$$$ pairs of integers $$$a_i, b_i$$$ ($$$1 \le a_i, b_i \le n$$$), denoting the indices of points removed on snap $$$i$$$. Every integer between $$$1$$$ and $$$n$$$, inclusive, must appear in your output exactly once. We can show that it is always possible to remove all points. If there are many so... | standard output | |
PASSED | f84d6936243cc1a4913377e07584940b | train_002.jsonl | 1571236500 | This is an easier version of the problem. In this version, $$$n \le 2000$$$.There are $$$n$$$ distinct points in three-dimensional space numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th point has coordinates $$$(x_i, y_i, z_i)$$$. The number of points $$$n$$$ is even.You'd like to remove all $$$n$$$ points using a sequ... | 512 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class C1
{
static class Coord{
int x, y, z;
public Coord(int x, int y, int z){
this.x = x;
this.y = y;
this.z = z;
}
}
public static void process(int test_number)throws IOException... | Java | ["6\n3 1 0\n0 3 0\n2 2 0\n1 0 0\n1 3 0\n0 1 0", "8\n0 1 1\n1 0 1\n1 1 0\n1 1 1\n2 2 2\n3 2 2\n2 3 2\n2 2 3"] | 1 second | ["3 6\n5 1\n2 4", "4 5\n1 6\n2 7\n3 8"] | NoteIn the first example, here is what points and their corresponding bounding boxes look like (drawn in two dimensions for simplicity, as all points lie on $$$z = 0$$$ plane). Note that order of removing matters: for example, points $$$5$$$ and $$$1$$$ don't form a perfectly balanced pair initially, but they do after ... | Java 11 | standard input | [
"constructive algorithms",
"geometry",
"greedy"
] | 47a9d72651f1407de89e28fb4b142367 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2000$$$; $$$n$$$ is even), denoting the number of points. Each of the next $$$n$$$ lines contains three integers $$$x_i$$$, $$$y_i$$$, $$$z_i$$$ ($$$-10^8 \le x_i, y_i, z_i \le 10^8$$$), denoting the coordinates of the $$$i$$$-th point. No two points coin... | 1,700 | Output $$$\frac{n}{2}$$$ pairs of integers $$$a_i, b_i$$$ ($$$1 \le a_i, b_i \le n$$$), denoting the indices of points removed on snap $$$i$$$. Every integer between $$$1$$$ and $$$n$$$, inclusive, must appear in your output exactly once. We can show that it is always possible to remove all points. If there are many so... | standard output | |
PASSED | 382aeb44f0a1e49fa234a6cb216cd6d5 | train_002.jsonl | 1571236500 | This is an easier version of the problem. In this version, $$$n \le 2000$$$.There are $$$n$$$ distinct points in three-dimensional space numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th point has coordinates $$$(x_i, y_i, z_i)$$$. The number of points $$$n$$$ is even.You'd like to remove all $$$n$$$ points using a sequ... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.TreeMap;
public class d {
static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
// static Scanner s=new Scanner(System.in);
public static void... | Java | ["6\n3 1 0\n0 3 0\n2 2 0\n1 0 0\n1 3 0\n0 1 0", "8\n0 1 1\n1 0 1\n1 1 0\n1 1 1\n2 2 2\n3 2 2\n2 3 2\n2 2 3"] | 1 second | ["3 6\n5 1\n2 4", "4 5\n1 6\n2 7\n3 8"] | NoteIn the first example, here is what points and their corresponding bounding boxes look like (drawn in two dimensions for simplicity, as all points lie on $$$z = 0$$$ plane). Note that order of removing matters: for example, points $$$5$$$ and $$$1$$$ don't form a perfectly balanced pair initially, but they do after ... | Java 11 | standard input | [
"constructive algorithms",
"geometry",
"greedy"
] | 47a9d72651f1407de89e28fb4b142367 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2000$$$; $$$n$$$ is even), denoting the number of points. Each of the next $$$n$$$ lines contains three integers $$$x_i$$$, $$$y_i$$$, $$$z_i$$$ ($$$-10^8 \le x_i, y_i, z_i \le 10^8$$$), denoting the coordinates of the $$$i$$$-th point. No two points coin... | 1,700 | Output $$$\frac{n}{2}$$$ pairs of integers $$$a_i, b_i$$$ ($$$1 \le a_i, b_i \le n$$$), denoting the indices of points removed on snap $$$i$$$. Every integer between $$$1$$$ and $$$n$$$, inclusive, must appear in your output exactly once. We can show that it is always possible to remove all points. If there are many so... | standard output | |
PASSED | 8ee89b552ade03885115cd1a65c48d5c | train_002.jsonl | 1571236500 | This is an easier version of the problem. In this version, $$$n \le 2000$$$.There are $$$n$$$ distinct points in three-dimensional space numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th point has coordinates $$$(x_i, y_i, z_i)$$$. The number of points $$$n$$$ is even.You'd like to remove all $$$n$$$ points using a sequ... | 512 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Task solver = new Task();
int i =... | Java | ["6\n3 1 0\n0 3 0\n2 2 0\n1 0 0\n1 3 0\n0 1 0", "8\n0 1 1\n1 0 1\n1 1 0\n1 1 1\n2 2 2\n3 2 2\n2 3 2\n2 2 3"] | 1 second | ["3 6\n5 1\n2 4", "4 5\n1 6\n2 7\n3 8"] | NoteIn the first example, here is what points and their corresponding bounding boxes look like (drawn in two dimensions for simplicity, as all points lie on $$$z = 0$$$ plane). Note that order of removing matters: for example, points $$$5$$$ and $$$1$$$ don't form a perfectly balanced pair initially, but they do after ... | Java 11 | standard input | [
"constructive algorithms",
"geometry",
"greedy"
] | 47a9d72651f1407de89e28fb4b142367 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2000$$$; $$$n$$$ is even), denoting the number of points. Each of the next $$$n$$$ lines contains three integers $$$x_i$$$, $$$y_i$$$, $$$z_i$$$ ($$$-10^8 \le x_i, y_i, z_i \le 10^8$$$), denoting the coordinates of the $$$i$$$-th point. No two points coin... | 1,700 | Output $$$\frac{n}{2}$$$ pairs of integers $$$a_i, b_i$$$ ($$$1 \le a_i, b_i \le n$$$), denoting the indices of points removed on snap $$$i$$$. Every integer between $$$1$$$ and $$$n$$$, inclusive, must appear in your output exactly once. We can show that it is always possible to remove all points. If there are many so... | standard output | |
PASSED | 4686994ba5ddab20887bed717a1c4c0e | train_002.jsonl | 1571236500 | This is an easier version of the problem. In this version, $$$n \le 2000$$$.There are $$$n$$$ distinct points in three-dimensional space numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th point has coordinates $$$(x_i, y_i, z_i)$$$. The number of points $$$n$$$ is even.You'd like to remove all $$$n$$$ points using a sequ... | 512 megabytes | import java.io.*;
import java.util.*;
public class C
{
static class Point
{
long x, y, z;
Point(int xx, int yy, int zz)
{
x = xx;
y = yy;
z = zz;
}
}
static long dist(Point a, Point b)
{
return (a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y) + (a.z - b.z)*(a.z - b.z);
}
static void solve... | Java | ["6\n3 1 0\n0 3 0\n2 2 0\n1 0 0\n1 3 0\n0 1 0", "8\n0 1 1\n1 0 1\n1 1 0\n1 1 1\n2 2 2\n3 2 2\n2 3 2\n2 2 3"] | 1 second | ["3 6\n5 1\n2 4", "4 5\n1 6\n2 7\n3 8"] | NoteIn the first example, here is what points and their corresponding bounding boxes look like (drawn in two dimensions for simplicity, as all points lie on $$$z = 0$$$ plane). Note that order of removing matters: for example, points $$$5$$$ and $$$1$$$ don't form a perfectly balanced pair initially, but they do after ... | Java 11 | standard input | [
"constructive algorithms",
"geometry",
"greedy"
] | 47a9d72651f1407de89e28fb4b142367 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2000$$$; $$$n$$$ is even), denoting the number of points. Each of the next $$$n$$$ lines contains three integers $$$x_i$$$, $$$y_i$$$, $$$z_i$$$ ($$$-10^8 \le x_i, y_i, z_i \le 10^8$$$), denoting the coordinates of the $$$i$$$-th point. No two points coin... | 1,700 | Output $$$\frac{n}{2}$$$ pairs of integers $$$a_i, b_i$$$ ($$$1 \le a_i, b_i \le n$$$), denoting the indices of points removed on snap $$$i$$$. Every integer between $$$1$$$ and $$$n$$$, inclusive, must appear in your output exactly once. We can show that it is always possible to remove all points. If there are many so... | standard output | |
PASSED | 0b8cf353caf3495c6dee79584cfbcc4c | train_002.jsonl | 1571236500 | This is an easier version of the problem. In this version, $$$n \le 2000$$$.There are $$$n$$$ distinct points in three-dimensional space numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th point has coordinates $$$(x_i, y_i, z_i)$$$. The number of points $$$n$$$ is even.You'd like to remove all $$$n$$$ points using a sequ... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main {
static FastReader in;
static PrintWriter out;
static class Pair {
int i, j;
Pair(int i, int j) {
this.i = i;
this.j = j;
}
}
static class Point {
int i, x, y, z;
Point(int i... | Java | ["6\n3 1 0\n0 3 0\n2 2 0\n1 0 0\n1 3 0\n0 1 0", "8\n0 1 1\n1 0 1\n1 1 0\n1 1 1\n2 2 2\n3 2 2\n2 3 2\n2 2 3"] | 1 second | ["3 6\n5 1\n2 4", "4 5\n1 6\n2 7\n3 8"] | NoteIn the first example, here is what points and their corresponding bounding boxes look like (drawn in two dimensions for simplicity, as all points lie on $$$z = 0$$$ plane). Note that order of removing matters: for example, points $$$5$$$ and $$$1$$$ don't form a perfectly balanced pair initially, but they do after ... | Java 11 | standard input | [
"constructive algorithms",
"geometry",
"greedy"
] | 47a9d72651f1407de89e28fb4b142367 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2000$$$; $$$n$$$ is even), denoting the number of points. Each of the next $$$n$$$ lines contains three integers $$$x_i$$$, $$$y_i$$$, $$$z_i$$$ ($$$-10^8 \le x_i, y_i, z_i \le 10^8$$$), denoting the coordinates of the $$$i$$$-th point. No two points coin... | 1,700 | Output $$$\frac{n}{2}$$$ pairs of integers $$$a_i, b_i$$$ ($$$1 \le a_i, b_i \le n$$$), denoting the indices of points removed on snap $$$i$$$. Every integer between $$$1$$$ and $$$n$$$, inclusive, must appear in your output exactly once. We can show that it is always possible to remove all points. If there are many so... | standard output | |
PASSED | f80e544ff309d57b32694dd5563d8e2c | train_002.jsonl | 1359732600 | Emuskald is an avid horticulturist and owns the world's longest greenhouse — it is effectively infinite in length.Over the years Emuskald has cultivated n plants in his greenhouse, of m different plant species numbered from 1 to m. His greenhouse is very narrow and can be viewed as an infinite line, with each plant occ... | 256 megabytes | import java.util.Scanner;
public class D {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int m = s.nextInt();
int[] sa = new int[n];
for (int i = 0; i < n; i++) {
sa[i] = s.nextInt();
s.nextDouble();... | Java | ["3 2\n2 1\n1 2.0\n1 3.100", "3 3\n1 5.0\n2 5.5\n3 6.0", "6 3\n1 14.284235\n2 17.921382\n1 20.328172\n3 20.842331\n1 25.790145\n1 27.204125"] | 2 seconds | ["1", "0", "2"] | NoteIn the first test case, Emuskald can replant the first plant to the right of the last plant, so the answer is 1.In the second test case, the species are already in the correct order, so no replanting is needed. | Java 7 | standard input | [
"dp"
] | 32f245fa1a2d99bfabd30b558687ca5f | The first line of input contains two space-separated integers n and m (1 ≤ n, m ≤ 5000, n ≥ m), the number of plants and the number of different species. Each of the following n lines contain two space-separated numbers: one integer number si (1 ≤ si ≤ m), and one real number xi (0 ≤ xi ≤ 109), the species and position... | 1,700 | Output a single integer — the minimum number of plants to be replanted. | standard output | |
PASSED | 21bbc82dff34ef86d8477517c429d943 | train_002.jsonl | 1359732600 | Emuskald is an avid horticulturist and owns the world's longest greenhouse — it is effectively infinite in length.Over the years Emuskald has cultivated n plants in his greenhouse, of m different plant species numbered from 1 to m. His greenhouse is very narrow and can be viewed as an infinite line, with each plant occ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author George Marcus
*/
public class Main {
public static void main(String[] args) {
Inpu... | Java | ["3 2\n2 1\n1 2.0\n1 3.100", "3 3\n1 5.0\n2 5.5\n3 6.0", "6 3\n1 14.284235\n2 17.921382\n1 20.328172\n3 20.842331\n1 25.790145\n1 27.204125"] | 2 seconds | ["1", "0", "2"] | NoteIn the first test case, Emuskald can replant the first plant to the right of the last plant, so the answer is 1.In the second test case, the species are already in the correct order, so no replanting is needed. | Java 7 | standard input | [
"dp"
] | 32f245fa1a2d99bfabd30b558687ca5f | The first line of input contains two space-separated integers n and m (1 ≤ n, m ≤ 5000, n ≥ m), the number of plants and the number of different species. Each of the following n lines contain two space-separated numbers: one integer number si (1 ≤ si ≤ m), and one real number xi (0 ≤ xi ≤ 109), the species and position... | 1,700 | Output a single integer — the minimum number of plants to be replanted. | standard output | |
PASSED | 70e8a0553773da280fafa67375dc3386 | train_002.jsonl | 1359732600 | Emuskald is an avid horticulturist and owns the world's longest greenhouse — it is effectively infinite in length.Over the years Emuskald has cultivated n plants in his greenhouse, of m different plant species numbered from 1 to m. His greenhouse is very narrow and can be viewed as an infinite line, with each plant occ... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String args[]){
new Main().run();
}
public void run(){
Scanner scanner = new Scanner(System.in);
String line = scanner.nextLine();
int n = Integer.parseInt(line.split(" ")[0]);
int m = Integer.parseInt(line.split(" ")[1]);
int[] types = new... | Java | ["3 2\n2 1\n1 2.0\n1 3.100", "3 3\n1 5.0\n2 5.5\n3 6.0", "6 3\n1 14.284235\n2 17.921382\n1 20.328172\n3 20.842331\n1 25.790145\n1 27.204125"] | 2 seconds | ["1", "0", "2"] | NoteIn the first test case, Emuskald can replant the first plant to the right of the last plant, so the answer is 1.In the second test case, the species are already in the correct order, so no replanting is needed. | Java 7 | standard input | [
"dp"
] | 32f245fa1a2d99bfabd30b558687ca5f | The first line of input contains two space-separated integers n and m (1 ≤ n, m ≤ 5000, n ≥ m), the number of plants and the number of different species. Each of the following n lines contain two space-separated numbers: one integer number si (1 ≤ si ≤ m), and one real number xi (0 ≤ xi ≤ 109), the species and position... | 1,700 | Output a single integer — the minimum number of plants to be replanted. | standard output | |
PASSED | fde1a2ac36a033da566a1b9740ff372b | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static class Scan {
private byte[] buf=new byte[1024];
private int index;
private InputStream in;
private int total;
public Scan()
{
in=System.in;
}
public int scan()throws IOExcepti... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | d3b4b27708a76937c87dc3f4bf91b8a6 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
public class Solution {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int t = sc.nextInt();
while (t-- > 0) {
int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), r = sc.nextInt();
int left = Math.max(Math.min(a, b), c - r);
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 1bae3ebf0671838d8a123f47ef2a7510 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
static int mod = (int)(Math.pow(10, 9) + 7);
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int t= sc.nextInt();
while (t-->0) {
int a = ... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | e35aac18fa348407e555b222828424ca | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import javax.swing.text.InternationalFormatter;
import java.math.*;
public class temp1 {
public static PrintWriter out;
static int[] a;
static int[] b;
public static void main(String[] args) throws IOException {
Scanner scn = new Scanner(Sy... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 9e170b518f2344f3ef2dffd995a9656c | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner =new Scanner(System.in);
int t =scanner.nextInt();
while (t-->0){
int x =scanner.nextInt();
int y=scanner.nextInt();
int l =scanner.nextInt();
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | cef6a818fd2e424a2493f06d11466d1d | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.Scanner;
public class TemporarilyUnavailable
{
public static void main(String [] args)
{
Scanner input = new Scanner(System.in);
int t = input.nextInt();
for(int i = 0; i < t; i++)
{
long a = input.nextLong(), b = input.nextLong();
long ... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | af7d91130183fb27ab0d9251096efffc | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
import java.io.*;
public class a {
public static void main(String[] Args)
throws Exception
{
FS sc = new FS(System.in);
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int t = sc.nextInt();
while (t-->0) {
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 6e7be795fa629e678704be5f9202a78a | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class A {
public static void main(String[] args){
FastInput in = new FastInput();
PrintWriter out = new PrintWriter(System.out);
int test = in.nextInt();
while (test-- > 0) {
int a = in.nextInt(),
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 398c8de30e37911e5e33ab019a225593 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
public class solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++) {
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int r=sc.nextInt();
int ans=0;
if(r==0) {
ans=Math.abs(a-b);
}
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 7a1064e6be227772b735ec21f09ac9dc | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public final class Main
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner s = new Scanner(System.in);
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 6b79e7a3f4b92ada0e44b5895ffed50d | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.*;
public class A_1282 {
public static void main(String[] args) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
int testCases = Integer.parseInt(br.readLine());
for (int i = 0; i < testCases; i++) {
String inp = ... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 3fded93f59d4259a7433f1b4d14ecbfa | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
public class temporary
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i=0;i<t;i++)
{
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int r = sc.nextInt();
int mi = Math.min(a,b);
int ma = Ma... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | fb32578d1f61de9d369557a4e8514f3e | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes |
import java.io.PrintWriter;
import java.util.Scanner;
public class TemporarilyUnavailableA extends PrintWriter {
//this trick improves performances
TemporarilyUnavailableA() {
super(System.out);
}
public static void main(String[] $) {
TemporarilyUnavailableA o = new TemporarilyUnavail... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 559a1a32b292f36ab252208644d932c0 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Stack;
import java.util.StringTokenizer;
public class Solution {
static class Reader {
BufferedReader br;
StringTokenizer st;
public Reader() {
br = new BufferedReader(new I... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 18c7accfb2264206a20bda539c3c5d98 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
import java.io.*;
public class TaskA
{
public static void main(String [] args)
{
MyScanner sc = new MyScanner();
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int t = sc.nextInt();
for (int i = 0; i < t; i++)
{
int a = sc.nextInt();
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | a726f9245f55f4f399e83d73d788a2f5 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
while(t>0) {
t--;
int a,b,c,r;
a=sc.nextInt();
b=sc... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 8ae0098e5d90357b057959909534ae25 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
public class CodeForceContestQuestionTemporarilyUnavailable {
public static void main(String[] args) {
TemporarilyUnavailable();
}
public static void TemporarilyUnavailable(){
Scanner scanner = new Scanner(System.in);
int testCase = scanner.nextInt();
i... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 0d396032675255c490a5f23afa5ff3aa | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Q1 {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method s... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 1a22aad00f7cee04a4a73c22165d8acc | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
public class Solution
{
public static void main(String []args)
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0)
{
int aa = sc.nextInt();
int bb = sc.nextInt();
int c = sc.nextInt();
int... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 95254762252e79ab1f5809bb111b4dec | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | // package com.company;
import java.math.BigInteger;
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{
public static void main(String args[]){
PrintWriter out=new PrintWriter(System.out);
InputReader in=new InputReader(System.in);
TASK solver = new TASK... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | ee5f4f7973273fb662c675aa40db37e9 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while (T-- > 0) {
int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), r = sc.nextInt();
if (a > b) {
a = ... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | f03e6b4969830379b6da1462bb55edfd | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | //package CodeforcesProject;
import java.io.*;
import java.lang.*;
import java.util.*;
public class Main extends IO {
public static void main(String[] args) throws Exception {
int quantity = readInt();
for (int i = 0; i < quantity; i++) {
int[] number = readArrayInt(" ");
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 8823ab6140f2b3bec5094edaadcff06a | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
// code
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
while (t > 0) {
t--;
int a = scn.nextInt();
int b = scn.nextInt();
int c = scn.nextInt();
int n = scn.ne... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | f4b11fe9374ecfa2d47cc3d1b215bdd2 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 9883f6e051964eb5b36abda0854d30d5 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.Scanner;
public class TemporarilyUnavailable {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
boolean start = true;
int count = s.nextInt();
for(int i = 0; i < count; i++)
{
if(start)
{
System.out.println();
start = false;
}
int a1 =... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 3c4a4c35994cced1fe15051cf737600b | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.Scanner;
public class TemporarilyUnavailable {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
boolean start = true;
int count = s.nextInt();
for(int i = 0; i < count; i++)
{
if(start)
{
System.out.println();
start = false;
}
int a1 =... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | c388628ba06a0654d7e3eaf153e0c62b | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
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();
int min=Math.min(a, b);
int max=Math.max(a, b);
int i=c-d;
int j=c+d;
int sum=0;... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 84775e508449f802e5d6ccd7d56b524a | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Solve5 {
public static void main(String[] args) throws IOException {
PrintWriter pw = new PrintWriter(System.ou... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 27440474332bc98a82f969cc85c0d86b | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.*;
import java.util.*;
public final class A1282 {
static void solve() throws IOException {
int aa = nextInt(), bb = nextInt(), c = nextInt(), r = nextInt();
int a = Math.min(aa, bb), b = Math.max(aa, bb), ss = Math.max(a, c - r), se = Math.min(b, c + r);
int dist = se - ss;
if (dist < 0) {
d... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 45e36f83e2fb0deb36645daced3a6188 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
public static void process()throws IOException
{
int a=ni(),b=ni(),c=ni(),rad=ni();
int l=Math.min(a, b),r=Math.max(a, b);
if(l>c+rad || c-rad>r){
pn(r-l);
}
else{
if... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | ff0039cd7c85ba47a16cc803464bf131 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.Scanner;
public class gogo {
public static void main(String args[]) {
Scanner scan=new Scanner(System.in);
int t=scan.nextInt();
for(int q=0;q<t;q++)
{
int a=scan.nextInt();
int b=scan.nextInt();
if(a>b) {
int temp=a;
a=b;
b=temp;
}
int c=scan.nextInt();
int r... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | b10bc567659410afa59b7790d73d13d4 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
import java.util.Scanner;
public class Cf1282A {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t>0) {
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int r=sc.nextInt();
int L=c-r;
int R=c+r;
int start=Ma... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | a3a2aa14eb7f09da4d05565971280d99 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Cf131 implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private in... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | ece5494f787e6b1b200803f30ffc73de | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF1282A extends PrintWriter {
CF1282A() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1282A o = new CF1282A(); o.main(); o.flush();
}
int intersect(int a, int b, int c, int d) {
int l = Math.max(a, c);
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 4a64f443b1d1ab69ebf8d98dffbb8cc2 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.awt.*;
import java.awt.dnd.Autoscroll;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Main {
public static void main(String[] args) t... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 4ee309220d43569a14b0001ab7e0ac27 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.awt.Point;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Candidate {
public static void main(String[] args) throws Exception {
FastReader sc = new FastReader();
int t=sc.nextInt();
while(t-->0) {
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 3c764d67198a95cc77e3ad7cd6bcc516 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | /*import java.util.*;
public class test {
public static void main(String args[])
{
int size =1000;
int array[]=new int[size];
String ch;
int i=size;
Scanner sc= new Scanner(System.in);
while(i>0)
{
ch = sc.next();
for(int j=0;j<50;j++)
{ array[size-i+j]=ch.charAt(j)-'0';
System.out.pri... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 360949dd03a0342247e21b439b8a6ab1 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | /*input
5 5 2 3
*/
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
static Scanner in = new Scanner(System.in);
public static void solve()
{
int a=in.nextInt(),b=in.nextInt(),c=in.nextInt(),r=in.nextInt();
int min=(int)Math.min(a,b);
int ... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 1f7677585366cf32ecdd7c2f45e5b15e | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class test {
public static void main(String[] args) {
int test = fs.nextInt();
for (int cases = 0; cases < test; cases++) {
int a = fs.nextInt();
int b = fs.nextInt();
int c = fs.nextInt();
int r = fs.nextInt();
int L = Integer.max(I... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 6ad8777c830d949bfb03740d0e36868a | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
public class temporarilyUnavailable
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int a;
int b;
int c;
int r;
int convergenceMin;
int convergenceMax;
int temp;
for (int i = 0; i < n; i++) {
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 83af65f131f4c94103cf2484955d1954 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
import java.io.*;
/*
*/
public class Main{
public static OutputStream out=new BufferedOutputStream(System.out);
//nl-->neew line; //l-->line; //arp-->array print; //arpnl-->array print new line
public static void nl(Object o) throws IOException{out.write((o+"\n").getBytes());}
p... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 7c7cdb0aa4dd71c4d10290a8e973187b | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.Scanner;
public class Policarp { //task 1282A
public static void main(String[] args) {
Scanner sca = new Scanner(System.in);
int t =sca.nextInt();
int[][] data = new int[t][4];
for (int i = 0; i < t; i++) {
data[i][0] = sca.nextInt();
dat... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 6610783a3da3f99608870d57705a6974 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.math.BigInteger;
import java.util.*;
import java.util.function.BiFunction;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t>0){
int x = sc.nextInt();int y = sc.nextInt();
... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 5abc6c5ebcfc8f4db5163e7dc2958bcd | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.*;
import java.util.*;
public class TemporarilyUnavailable {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(f.readLine());
int t = Integer.parseInt(s... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | c390ee5f13e103b88692aba9d31e9feb | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author ky112233
*/
public class Main {
public static void main(String[] args) {
InputStream ... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 0bee1f13f7c22fafcf2841990d522ffa | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main implements Runnable
{
boolean multiple = true;
void solve() throws Exception
{
int s = 0, e = 0;
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int r = sc.next... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 1b75c6458e6695e6be0f480303616b14 | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.util.*;
public class b
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
int i;
for(i=0;i<t;i++)
{
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int r=sc.nextInt();
int d=0;
int temp;
if(a>b)
{
tem... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 71d063649e7f7a295652af95ebc21e6f | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Almas Turganbayev
*/
public class Main {
public static void main(String[] args) {
Inp... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | 206489c6ab10315c12c79f2649a22ebe | train_002.jsonl | 1577198100 | Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int ПУТИН_ПОМОГИ = nextInt();
for (int navalniy = 0; naval... | Java | ["9\n1 10 7 1\n3 3 3 0\n8 2 10 4\n8 2 10 100\n-10 20 -17 2\n-3 2 2 0\n-3 1 2 0\n2 3 2 3\n-1 3 -2 2"] | 1 second | ["7\n0\n4\n0\n30\n5\n4\n0\n3"] | NoteThe following picture illustrates the first test case. Polycarp goes from $$$1$$$ to $$$10$$$. The yellow area shows the coverage area of the station with a radius of coverage of $$$1$$$, which is located at the point of $$$7$$$. The green area shows a part of the path when Polycarp is out of coverage area. | Java 11 | standard input | [
"implementation",
"math"
] | 783772cb7a54bf65f648d3f8b7648263 | The first line contains a positive integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. In the following lines are written $$$t$$$ test cases. The description of each test case is one line, which contains four integers $$$a$$$, $$$b$$$, $$$c$$$ and $$$r$$$ ($$$-10^8 \le a,b,c \le 10^8$$$, $$$0 \le r \le... | 900 | Print $$$t$$$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement. | standard output | |
PASSED | b68f01bdc36a99c4f9a3579ea192f632 | train_002.jsonl | 1530808500 | Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.There are $$$n$$$ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $$$i$$$-th position. Thus each of $$$n$$$ posit... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
InputStream is;
BufferedReader bufferedReader;
PrintWriter out;
String INPUT = "";
int row[] = { -1, 0, 1, 0 };
int column[] = { 0, 1, 0, -1 };
void solve() {
int n = ni();
int m = ni();
for (int i = 0 ;... | Java | ["5 3\n1 3\n2 4\n2 5", "6 3\n5 6\n1 4\n4 6"] | 1 second | ["01100", "110010"] | NoteIn the first example, Sonya can put roses in the first, fourth, and fifth positions, and lilies in the second and third positions; in the segment $$$[1\ldots3]$$$, there are one rose and two lilies, so the beauty is equal to $$$1\cdot 2=2$$$; in the segment $$$[2\ldots4]$$$, there are one rose and two lilies, so ... | Java 8 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | cac8ca5565e06021a44bb4388b5913a5 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1\leq n, m\leq 10^3$$$) — the number of flowers and visitors respectively. Each of the next $$$m$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1\leq l_i\leq r_i\leq n$$$), meaning that $$$i$$$-th visitor will visit all flowers from $$$l_i$$$ to $... | 1,300 | Print the string of $$$n$$$ characters. The $$$i$$$-th symbol should be «0» if you want to put a rose in the $$$i$$$-th position, otherwise «1» if you want to put a lily. If there are multiple answers, print any. | standard output | |
PASSED | 83217b60949899e20099676fb508db7d | train_002.jsonl | 1530808500 | Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.There are $$$n$$$ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $$$i$$$-th position. Thus each of $$$n$$$ posit... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.*;
public class Main
{
public static void main(String[] args)throws IOException
{
FastReader in=new FastReader(System.in);
StringBuffer st=new StringBuffer();
int n=in.nextInt... | Java | ["5 3\n1 3\n2 4\n2 5", "6 3\n5 6\n1 4\n4 6"] | 1 second | ["01100", "110010"] | NoteIn the first example, Sonya can put roses in the first, fourth, and fifth positions, and lilies in the second and third positions; in the segment $$$[1\ldots3]$$$, there are one rose and two lilies, so the beauty is equal to $$$1\cdot 2=2$$$; in the segment $$$[2\ldots4]$$$, there are one rose and two lilies, so ... | Java 8 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | cac8ca5565e06021a44bb4388b5913a5 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1\leq n, m\leq 10^3$$$) — the number of flowers and visitors respectively. Each of the next $$$m$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1\leq l_i\leq r_i\leq n$$$), meaning that $$$i$$$-th visitor will visit all flowers from $$$l_i$$$ to $... | 1,300 | Print the string of $$$n$$$ characters. The $$$i$$$-th symbol should be «0» if you want to put a rose in the $$$i$$$-th position, otherwise «1» if you want to put a lily. If there are multiple answers, print any. | standard output | |
PASSED | 5bd43bc9335c0956cd20720d5844d6f5 | train_002.jsonl | 1530808500 | Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.There are $$$n$$$ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $$$i$$$-th position. Thus each of $$$n$$$ posit... | 256 megabytes | import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class Solution
{
static class InputReader
{
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
public InputReader(InputSt... | Java | ["5 3\n1 3\n2 4\n2 5", "6 3\n5 6\n1 4\n4 6"] | 1 second | ["01100", "110010"] | NoteIn the first example, Sonya can put roses in the first, fourth, and fifth positions, and lilies in the second and third positions; in the segment $$$[1\ldots3]$$$, there are one rose and two lilies, so the beauty is equal to $$$1\cdot 2=2$$$; in the segment $$$[2\ldots4]$$$, there are one rose and two lilies, so ... | Java 8 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | cac8ca5565e06021a44bb4388b5913a5 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1\leq n, m\leq 10^3$$$) — the number of flowers and visitors respectively. Each of the next $$$m$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1\leq l_i\leq r_i\leq n$$$), meaning that $$$i$$$-th visitor will visit all flowers from $$$l_i$$$ to $... | 1,300 | Print the string of $$$n$$$ characters. The $$$i$$$-th symbol should be «0» if you want to put a rose in the $$$i$$$-th position, otherwise «1» if you want to put a lily. If there are multiple answers, print any. | standard output | |
PASSED | 023d4aecfcabfc90cb9a172d8c388cca | train_002.jsonl | 1530808500 | Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.There are $$$n$$$ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $$$i$$$-th position. Thus each of $$$n$$$ posit... | 256 megabytes | import java.util.*;
public class MainClass{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int n = in.nextInt(), m = in.nextInt();
for(int i= 0; i<m; i++) in.nextInt();
for(int i = 0; i<n; i++)System.out.print(i%2);
}
} | Java | ["5 3\n1 3\n2 4\n2 5", "6 3\n5 6\n1 4\n4 6"] | 1 second | ["01100", "110010"] | NoteIn the first example, Sonya can put roses in the first, fourth, and fifth positions, and lilies in the second and third positions; in the segment $$$[1\ldots3]$$$, there are one rose and two lilies, so the beauty is equal to $$$1\cdot 2=2$$$; in the segment $$$[2\ldots4]$$$, there are one rose and two lilies, so ... | Java 8 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | cac8ca5565e06021a44bb4388b5913a5 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1\leq n, m\leq 10^3$$$) — the number of flowers and visitors respectively. Each of the next $$$m$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1\leq l_i\leq r_i\leq n$$$), meaning that $$$i$$$-th visitor will visit all flowers from $$$l_i$$$ to $... | 1,300 | Print the string of $$$n$$$ characters. The $$$i$$$-th symbol should be «0» if you want to put a rose in the $$$i$$$-th position, otherwise «1» if you want to put a lily. If there are multiple answers, print any. | standard output | |
PASSED | 7261fc3802c448a3042c99579de76e1c | train_002.jsonl | 1530808500 | Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.There are $$$n$$$ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $$$i$$$-th position. Thus each of $$$n$$$ posit... | 256 megabytes | import java.util.*;
public class SonyaAndExhibition{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int n = in.nextInt(), m = in.nextInt();
for(int i= 0; i<m; i++){
in.nextInt();
}
for(int i = 0; i<n; i++){
System.out.pri... | Java | ["5 3\n1 3\n2 4\n2 5", "6 3\n5 6\n1 4\n4 6"] | 1 second | ["01100", "110010"] | NoteIn the first example, Sonya can put roses in the first, fourth, and fifth positions, and lilies in the second and third positions; in the segment $$$[1\ldots3]$$$, there are one rose and two lilies, so the beauty is equal to $$$1\cdot 2=2$$$; in the segment $$$[2\ldots4]$$$, there are one rose and two lilies, so ... | Java 8 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | cac8ca5565e06021a44bb4388b5913a5 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1\leq n, m\leq 10^3$$$) — the number of flowers and visitors respectively. Each of the next $$$m$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1\leq l_i\leq r_i\leq n$$$), meaning that $$$i$$$-th visitor will visit all flowers from $$$l_i$$$ to $... | 1,300 | Print the string of $$$n$$$ characters. The $$$i$$$-th symbol should be «0» if you want to put a rose in the $$$i$$$-th position, otherwise «1» if you want to put a lily. If there are multiple answers, print any. | standard output | |
PASSED | 0a09559fadd6f5d9a3729534c08ba1e7 | train_002.jsonl | 1530808500 | Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.There are $$$n$$$ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $$$i$$$-th position. Thus each of $$$n$$$ posit... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args) throws java.lang.Exception {
Reader pm =new Reader();
//Scanner pm = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int t = 1;
while(t-- ... | Java | ["5 3\n1 3\n2 4\n2 5", "6 3\n5 6\n1 4\n4 6"] | 1 second | ["01100", "110010"] | NoteIn the first example, Sonya can put roses in the first, fourth, and fifth positions, and lilies in the second and third positions; in the segment $$$[1\ldots3]$$$, there are one rose and two lilies, so the beauty is equal to $$$1\cdot 2=2$$$; in the segment $$$[2\ldots4]$$$, there are one rose and two lilies, so ... | Java 8 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | cac8ca5565e06021a44bb4388b5913a5 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1\leq n, m\leq 10^3$$$) — the number of flowers and visitors respectively. Each of the next $$$m$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1\leq l_i\leq r_i\leq n$$$), meaning that $$$i$$$-th visitor will visit all flowers from $$$l_i$$$ to $... | 1,300 | Print the string of $$$n$$$ characters. The $$$i$$$-th symbol should be «0» if you want to put a rose in the $$$i$$$-th position, otherwise «1» if you want to put a lily. If there are multiple answers, print any. | standard output | |
PASSED | 0feb7c8779501c15776fbb22e2b65b6f | train_002.jsonl | 1530808500 | Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.There are $$$n$$$ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $$$i$$$-th position. Thus each of $$$n$$$ posit... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class CF81 {
final static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
final static PrintWriter pw = new PrintWriter(System.... | Java | ["5 3\n1 3\n2 4\n2 5", "6 3\n5 6\n1 4\n4 6"] | 1 second | ["01100", "110010"] | NoteIn the first example, Sonya can put roses in the first, fourth, and fifth positions, and lilies in the second and third positions; in the segment $$$[1\ldots3]$$$, there are one rose and two lilies, so the beauty is equal to $$$1\cdot 2=2$$$; in the segment $$$[2\ldots4]$$$, there are one rose and two lilies, so ... | Java 8 | standard input | [
"constructive algorithms",
"implementation",
"greedy",
"math"
] | cac8ca5565e06021a44bb4388b5913a5 | The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1\leq n, m\leq 10^3$$$) — the number of flowers and visitors respectively. Each of the next $$$m$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1\leq l_i\leq r_i\leq n$$$), meaning that $$$i$$$-th visitor will visit all flowers from $$$l_i$$$ to $... | 1,300 | Print the string of $$$n$$$ characters. The $$$i$$$-th symbol should be «0» if you want to put a rose in the $$$i$$$-th position, otherwise «1» if you want to put a lily. If there are multiple answers, print any. | standard output | |
PASSED | 3a0200cc38397ea91ea5cac6a560e347 | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author EigenFunk
*/
public class Main {
public static void main(String[] args) {
InputStream... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | 288fa923c411024c261ef72cab597f86 | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.io.*;
import java.util.*;
public class cf1299_Div1_A {
public static void count(int val, int[] bits) {
for (int i = 0; i < 32; i++) {
if ((val & (1 << i)) > 0)
bits[i]++;
}
}
public static void main(String[] args) throws IOException {
FastScanner in = new FastScanner();
... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | f52a17b5cb07adb77ff6d0c3b44bef76 | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | 4d3192e6e355198e7af04e4bd0e787ee | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | d7b2ac4b4a2d2893d26e7f0abe0a06b9 | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.util.*;
import java.io.*;
public class Anu_Has_A_Function {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | 979e1fba9da1129cf5e56072e5d0091b | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelp... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | 9baa1963cd5d2640aaf4ed1d3252e98e | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
static int f(int x, int y) {
return (x | y) - y;
}
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner();
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | ff12904e264cbb2310accf415aa07e8d | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf1299a {
public static void main(String[] args) throws IOException {
int n = ri(), a[] = ria(n), bits[] = new int[31], cur[] = new int[31], score[] = new int[n], mask[] = new int[31];
... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | e85554090f6948c49454fa256b061004 | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.function.LongBinaryOperator;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedOutp... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | 6ecc78c1bf07bef800732a763cac2b88 | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.util.*;
public class AnuHasAFunction {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int l = s.nextInt();
int[] arr = new int[l];
int[] cnt = new int[32];
int[] idx = new int[32];
for (int i = 0; i < l; i++) {
ar... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | d09f3515e20f3c08d2e640003c60815b | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.util.*;
import java.io.*;
public class C618
{
public static void main(String [] args)
{
MyScanner sc = new MyScanner();
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int n = sc.nextInt();
ArrayList <Integer> arr = new ArrayList <Integer> ();... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | ac1129b0f803a737840d75c7665b8f19 | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import java.util.*;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
try {
int n = scanner.nextInt();
int[] a = new int[n];
int[] c = new int[32];
for (int i=0; i<n; i++) {
a[i]... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | 4a17035c02a789d6b615ee809a6ed949 | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | import javax.swing.*;
import java.awt.desktop.SystemSleepEvent;
import java.util.*;
import java.io.*;
public class Main {
public static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedRead... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | 814f1e0110e7f964cf5775ef3364b803 | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
public static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) throws IOException {
int n = scanner.nextInt();
int[] v = new int[n];
int[] bin = new int[32];
for (int i = 0; i < n; ++i) {... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output | |
PASSED | 352c21e94f88b9a810f91220f548a421 | train_002.jsonl | 1581257100 | Anu has created her own function $$$f$$$: $$$f(x, y) = (x | y) - y$$$ where $$$|$$$ denotes the bitwise OR operation. For example, $$$f(11, 6) = (11|6) - 6 = 15 - 6 = 9$$$. It can be proved that for any nonnegative numbers $$$x$$$ and $$$y$$$ value of $$$f(x, y)$$$ is also nonnegative. She would like to research more a... | 256 megabytes | //package com.company;
import java.io.*;
import java.util.*;
public class Main {
public static class Task {
public void solve(Scanner sc, PrintWriter pw) throws IOException {
int n = sc.nextInt();
int[] numbers = new int[n];
for (int i = 0; i < n; i++) {
... | Java | ["4\n4 0 11 6", "1\n13"] | 1 second | ["11 6 4 0", "13"] | NoteIn the first testcase, value of the array $$$[11, 6, 4, 0]$$$ is $$$f(f(f(11, 6), 4), 0) = f(f(9, 4), 0) = f(9, 0) = 9$$$.$$$[11, 4, 0, 6]$$$ is also a valid answer. | Java 11 | standard input | [
"greedy",
"math",
"brute force"
] | 14fd47f6f0fcbdb16dbd73dcca8a782f | The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le 10^9$$$). Elements of the array are not guaranteed to be different. | 1,500 | Output $$$n$$$ integers, the reordering of the array with maximum value. If there are multiple answers, print any. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.