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 | 38dda0a2828dbb7ac3b77826054df0e4 | train_001.jsonl | 1539269400 | There is a toy building consisting of $$$n$$$ towers. Each tower consists of several cubes standing on each other. The $$$i$$$-th tower consists of $$$h_i$$$ cubes, so it has height $$$h_i$$$.Let's define operation slice on some height $$$H$$$ as following: for each tower $$$i$$$, if its height is greater than $$$H$$$,... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
public class Main implements Runnable {
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilt... | Java | ["5 5\n3 1 2 2 4", "4 5\n2 3 4 5"] | 2 seconds | ["2", "2"] | NoteIn the first example it's optimal to make $$$2$$$ slices. The first slice is on height $$$2$$$ (its cost is $$$3$$$), and the second one is on height $$$1$$$ (its cost is $$$4$$$). | Java 8 | standard input | [
"greedy"
] | 676729309dfbdf4c9d9d7c457a129608 | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$n \le k \le 10^9$$$) β the number of towers and the restriction on slices, respectively. The second line contains $$$n$$$ space separated integers $$$h_1, h_2, \dots, h_n$$$ ($$$1 \le h_i \le 2 \cdot 10^5$$$) β the initial heig... | 1,600 | Print one integer β the minimum number of good slices you have to do to make all towers have the same heigth. | standard output | |
PASSED | 0f85c869b23aeb929fb1909542f250bc | train_001.jsonl | 1539269400 | There is a toy building consisting of $$$n$$$ towers. Each tower consists of several cubes standing on each other. The $$$i$$$-th tower consists of $$$h_i$$$ cubes, so it has height $$$h_i$$$.Let's define operation slice on some height $$$H$$$ as following: for each tower $$$i$$$, if its height is greater than $$$H$$$,... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Has... | Java | ["5 5\n3 1 2 2 4", "4 5\n2 3 4 5"] | 2 seconds | ["2", "2"] | NoteIn the first example it's optimal to make $$$2$$$ slices. The first slice is on height $$$2$$$ (its cost is $$$3$$$), and the second one is on height $$$1$$$ (its cost is $$$4$$$). | Java 8 | standard input | [
"greedy"
] | 676729309dfbdf4c9d9d7c457a129608 | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$n \le k \le 10^9$$$) β the number of towers and the restriction on slices, respectively. The second line contains $$$n$$$ space separated integers $$$h_1, h_2, \dots, h_n$$$ ($$$1 \le h_i \le 2 \cdot 10^5$$$) β the initial heig... | 1,600 | Print one integer β the minimum number of good slices you have to do to make all towers have the same heigth. | standard output | |
PASSED | 55f7141f71dac37a033dadbb54475121 | train_001.jsonl | 1539269400 | There is a toy building consisting of $$$n$$$ towers. Each tower consists of several cubes standing on each other. The $$$i$$$-th tower consists of $$$h_i$$$ cubes, so it has height $$$h_i$$$.Let's define operation slice on some height $$$H$$$ as following: for each tower $$$i$$$, if its height is greater than $$$H$$$,... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class first {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int hight[] = new int[n];
for(int i=0;i<n;i++... | Java | ["5 5\n3 1 2 2 4", "4 5\n2 3 4 5"] | 2 seconds | ["2", "2"] | NoteIn the first example it's optimal to make $$$2$$$ slices. The first slice is on height $$$2$$$ (its cost is $$$3$$$), and the second one is on height $$$1$$$ (its cost is $$$4$$$). | Java 8 | standard input | [
"greedy"
] | 676729309dfbdf4c9d9d7c457a129608 | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$n \le k \le 10^9$$$) β the number of towers and the restriction on slices, respectively. The second line contains $$$n$$$ space separated integers $$$h_1, h_2, \dots, h_n$$$ ($$$1 \le h_i \le 2 \cdot 10^5$$$) β the initial heig... | 1,600 | Print one integer β the minimum number of good slices you have to do to make all towers have the same heigth. | standard output | |
PASSED | 2d6e2a80e1b550ea530a204f45d52fc8 | train_001.jsonl | 1539269400 | There is a toy building consisting of $$$n$$$ towers. Each tower consists of several cubes standing on each other. The $$$i$$$-th tower consists of $$$h_i$$$ cubes, so it has height $$$h_i$$$.Let's define operation slice on some height $$$H$$$ as following: for each tower $$$i$$$, if its height is greater than $$$H$$$,... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Abhas Jain
*/
public class... | Java | ["5 5\n3 1 2 2 4", "4 5\n2 3 4 5"] | 2 seconds | ["2", "2"] | NoteIn the first example it's optimal to make $$$2$$$ slices. The first slice is on height $$$2$$$ (its cost is $$$3$$$), and the second one is on height $$$1$$$ (its cost is $$$4$$$). | Java 8 | standard input | [
"greedy"
] | 676729309dfbdf4c9d9d7c457a129608 | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$n \le k \le 10^9$$$) β the number of towers and the restriction on slices, respectively. The second line contains $$$n$$$ space separated integers $$$h_1, h_2, \dots, h_n$$$ ($$$1 \le h_i \le 2 \cdot 10^5$$$) β the initial heig... | 1,600 | Print one integer β the minimum number of good slices you have to do to make all towers have the same heigth. | standard output | |
PASSED | a0d5a829c8be8bb2877b4f1f02faafbe | train_001.jsonl | 1539269400 | There is a toy building consisting of $$$n$$$ towers. Each tower consists of several cubes standing on each other. The $$$i$$$-th tower consists of $$$h_i$$$ cubes, so it has height $$$h_i$$$.Let's define operation slice on some height $$$H$$$ as following: for each tower $$$i$$$, if its height is greater than $$$H$$$,... | 256 megabytes | import java.util.*;
import java.io.*;
public class third{
public static void main(String[] args)throws IOException {
FastReader in=new FastReader(System.in);
int n=in.nextInt();
int k=in.nextInt();
long arr[]=new long[n];
long t,max;
int i,j;
for(i=0;i<n;i++)
arr[i]=in.nextInt();
Arrays.sort... | Java | ["5 5\n3 1 2 2 4", "4 5\n2 3 4 5"] | 2 seconds | ["2", "2"] | NoteIn the first example it's optimal to make $$$2$$$ slices. The first slice is on height $$$2$$$ (its cost is $$$3$$$), and the second one is on height $$$1$$$ (its cost is $$$4$$$). | Java 8 | standard input | [
"greedy"
] | 676729309dfbdf4c9d9d7c457a129608 | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$n \le k \le 10^9$$$) β the number of towers and the restriction on slices, respectively. The second line contains $$$n$$$ space separated integers $$$h_1, h_2, \dots, h_n$$$ ($$$1 \le h_i \le 2 \cdot 10^5$$$) β the initial heig... | 1,600 | Print one integer β the minimum number of good slices you have to do to make all towers have the same heigth. | standard output | |
PASSED | 3debd849256d38111bb3febbee7f4338 | train_001.jsonl | 1539269400 | There is a toy building consisting of $$$n$$$ towers. Each tower consists of several cubes standing on each other. The $$$i$$$-th tower consists of $$$h_i$$$ cubes, so it has height $$$h_i$$$.Let's define operation slice on some height $$$H$$$ as following: for each tower $$$i$$$, if its height is greater than $$$H$$$,... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
FastReader scn;
PrintWriter out;
String INPUT = "";
void solve() {
int n = scn.nextInt(), k = scn.nextInt(), nax = (int) 2e5 + 5, max = 0;
long[] arr = new long[nax];
arr[0] = n;
for(int i = 0; i < n; i++) {
int x = scn.nextInt();
max = Math.max... | Java | ["5 5\n3 1 2 2 4", "4 5\n2 3 4 5"] | 2 seconds | ["2", "2"] | NoteIn the first example it's optimal to make $$$2$$$ slices. The first slice is on height $$$2$$$ (its cost is $$$3$$$), and the second one is on height $$$1$$$ (its cost is $$$4$$$). | Java 8 | standard input | [
"greedy"
] | 676729309dfbdf4c9d9d7c457a129608 | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$n \le k \le 10^9$$$) β the number of towers and the restriction on slices, respectively. The second line contains $$$n$$$ space separated integers $$$h_1, h_2, \dots, h_n$$$ ($$$1 \le h_i \le 2 \cdot 10^5$$$) β the initial heig... | 1,600 | Print one integer β the minimum number of good slices you have to do to make all towers have the same heigth. | standard output | |
PASSED | 8565a9294703d5cf916aee92019b003a | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 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 IOExc... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | dca701525616001f5aca947190c740ab | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
String s[]=bu.readLine().split(" ");
int n=Integ... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | aa77f161536122d1b000c85b307d2399 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class SolutionD extends Thread {
static class FastReader {
BufferedReader br;
St... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 7293a328fc81ccd27e47124544c6d07b | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.TreeSet;
public class D {
public static void main(String[] args) {
Scanner sc = new Scanner(Sy... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 90f7ed2a15a6e5a7965bee1117c88043 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.util.*;
public class Solution
{
public static void main(String []args)
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int q = sc.nextInt();
Integer arr[] = new Integer[n];
for(int i = 0 ; i < n ; i++)
... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 60f23e61b0ab7cb522f9a03e09a346e5 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
imp... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | e8584b460ec20855ea049144d55da39c | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes |
import java.io.*;
import java.util.*;
public class d
{
public static void print(String str,long val){
System.out.println(str+" "+val);
}
public long gcd(long a, long b) {
if (b==0L) return a;
return gcd(b,a%b);
}
public static void debug(long[][] arr){
int len = ... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | d9ca3b1f44fec2c95eb71bf94ded3921 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.PrintWriter;
import java.io.Writer;
import java.util.*;
public class T4 extends PrintWriter {
public T4() {
super(System.out);
}
public static void main(String[] args) {
T4 t4 = new T4();
t4.main();
t4.flush();
}
public void main() {
Scanner ... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 450747ce3fec13dcf0a781f2bef1fef7 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.PrintWriter;
import java.io.Writer;
import java.util.*;
public class T4 extends PrintWriter {
public T4() {
super(System.out);
}
public static void main(String[] args) {
T4 t4 = new T4();
t4.main();
t4.flush();
}
public void main() {
Scanner ... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | ef68aa8cad80b4b10826775061d0239d | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF1418D extends PrintWriter {
CF1418D() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1418D o = new CF1418D(); o.main(); o.flush();
}
TreeMap<Integer, Integer> m = new TreeMap<>();
void add(int d) {
m.... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 4fae656e82477496b1403ab5e5860672 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.util.*;
public class T4 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = 1;
for (int i=0;i<n;i++) {
mainPrint(s);
}
// MyAVLTree myAVLTree = new MyAVLTree();
// long time =System.currentTimeMillis();
//
//... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | f7a54cb1a45f956d993e64fad7ab3a17 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.util.*;
public class T4 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = 1;
for (int i=0;i<n;i++) {
mainPrint(s);
}
// MyAVLTree myAVLTree = new MyAVLTree();
// long time =System.currentTimeMillis();
//
// ... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | a5257de23c49a4cbc66f71358baa8f23 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.PrintWriter;
import java.io.Writer;
import java.util.*;
public class T4 extends PrintWriter {
public T4() {
super(System.out);
}
public static void main(String[] args) {
T4 t4 = new T4();
t4.main();
t4.flush();
}
public void main() {
Scanner ... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 01d6f96a5be8dfe59b9182106ca1aee8 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
public class Solve8 {
public static void m... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | c861c119f2d77080ab1d359b4e1be43f | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
InputStream is;
PrintWriter out;
String INPUT = "";
int MAX = (int) 1e5, MOD = (int)1e9+7;
void solve(int TC) {
int n = ni(), q = ni();
TreeSet<Integer> P = new TreeSet<>();
TreeSet<int[]> gap = new TreeSet<>(new Com... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 3bea95a51a29ddb0b368e474a349a39f | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
InputStream is;
PrintWriter out;
String INPUT = "";
int MAX = (int) 1e5, MOD = (int)1e9+7;
void solve(int TC) {
int n = ni(), q = ni();
TreeSet<Integer> P = new TreeSet<>();
TreeSet<int[]> gap = new TreeSet<>(new Com... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 08b46d3c16174e3d5148bbb8d95fbb0a | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF1418D extends PrintWriter {
CF1418D() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1418D o = new CF1418D(); o.main(); o.flush();
}
TreeMap<Integer, Integer> m = new TreeMap<>();
void add(int d) {
m.pu... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 68e2e91cca81dc2ee51302a9d14715a9 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.TreeSet;
public class Main {
TreeMap<Integer, Integer> cnt = new TreeMap<>();
TreeSet<Integer> visited = new TreeSet<>();
public static void main(String[] args) {
new Main().run();
}
void solv... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 1d852a962293bc81dc3fd3bfa2e1b2f3 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.util.*;
import java.io.*;
public class D{
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | cc7a218cf8b9126dbc3eaae7d98ec4b4 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes |
// Problem: D. Trash Problem
// Contest: Codeforces - Educational Codeforces Round 95 (Rated for Div. 2)
// URL: https://codeforces.com/contest/1418/problem/D
// Memory Limit: 256 MB
// Time Limit: 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
import java.io.*;
import java.util.*;
public cla... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 7226c34b021f809382c00b0dfbeda236 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.*;
import java.util.*;
public class D_TrashProblem {
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... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 44d372dca0695995653ea3f890bf145a | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf1418d {
public static void main(String[] args) throws IOException {
int n = rni(), q = ni(), p[] = ria(n);
rsort(p);
TreeMap<Integer, Integer> diff = new TreeMap<>();
... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 29b118fc535b3e3c1a13c698c2b956d3 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | //package edu95;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
public class D {
static Random rand;
static boolean CONSTRUCTIVE = false;
static long MOD = (long) 1e9 + 7;
static long BIG = (long) 2e9;
static class Multiset<T extends Comparable<T>> {
SortedMap<T... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 45d59d1b3a2afd0c80c91e99577e18d1 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | //package edu95;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
public class D {
static Random rand;
static boolean CONSTRUCTIVE = false;
static long MOD = (long) 1e9 + 7;
static long BIG = (long) 2e9;
public static void solve(Reader in, PrintWriter out) {
int n... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | 0406a857adee32f156360999ee8fd2e4 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.DataInputStream;
import java.io.Flushable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.AbstractCollection;
import java.util.AbstractMap;
import java.util.Ar... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | acbcda797f1304fd0e2a30e501a59019 | train_001.jsonl | 1600094100 | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates.Let's define a total cleanup as the following process. The goal of this process is t... | 256 megabytes | import java.util.*;
import java.io.*;
public class A {
static final FastReader in = new FastReader();
static final PrintWriter out = new PrintWriter(System.out);
static TreeSet<Pair> lset = new TreeSet<>();
static TreeSet<Integer> set = new TreeSet<>();
static void add(int x) {
Integer lower = set.lower(x), h... | Java | ["5 6\n1 2 6 8 10\n1 4\n1 9\n0 6\n0 10\n1 100\n1 50", "5 8\n5 1 2 4 3\n0 1\n0 2\n0 3\n0 4\n0 5\n1 1000000000\n1 1\n1 500000000"] | 3 seconds | ["5\n7\n7\n5\n4\n8\n49", "3\n2\n1\n0\n0\n0\n0\n0\n499999999"] | NoteConsider the first example.Initially, the set of piles is $$$[1, 2, 6, 8, 10]$$$. The answer before the first query is $$$5$$$ because you can move all piles from $$$1$$$ to $$$2$$$ with one move, all piles from $$$10$$$ to $$$8$$$ with $$$2$$$ moves and all piles from $$$6$$$ to $$$8$$$ with $$$2$$$ moves.After th... | Java 11 | standard input | [
"data structures",
"implementation"
] | ef6535b1788c59146d5782041188920d | The first line of the input contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 10^5$$$) β the number of piles in the room before all queries and the number of queries, respectively. The second line of the input contains $$$n$$$ distinct integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le 10^9$$$), where $$$... | 2,100 | Print $$$q+1$$$ integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of $$$q$$$ queries. | standard output | |
PASSED | b27c17e82552cd69bba98fd1ae1198c0 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | // Working program using Reader Class
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class xor
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
priv... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 50c56fba63638d7201b21c8c359faccc | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | //package codeforces;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
public class D281 {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.pars... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 4033729a13748e151a4604fbe72925aa | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class MXSEC {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] ip = br.readLine().split(" ");
long[] ary = new long[n];
... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 4b10be28482ab91c1081f58e73c01f93 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.util.Scanner;
import java.util.Stack;
public class MaximumXorSecondary {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int ans = -1;
Stack<Integer> s = new Stack<>();
int[] arr = new int[n];
for(int i=0; i<n; i++) {
arr[i] =... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | a5c273e72bf6874702996488dd91a4fd | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.*;
import java.util.*;
public final class Maxxor
{
static class Input
{
BufferedReader br;
StringTokenizer st;
public Input()
{
br=new BufferedReader(new InputStreamReader(System.in));
}
String next()
{
while(st==null||!st.hasMoreElements())
{
try
{
st=new StringTo... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | e6f12f38a6a7087dbab7efb0e3d8f8be | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 66ea86d1eb57fbd9fef86abaf8129f99 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Code0108 {
static long answer(int a[]){
List<Integer> one = new ArrayList<>();
int n = a.length;
int len[] = new int[a.length];
int maxlen = 0;
for (int i = 0; i < n; i++) {
int x = a[i];
int c = 0;... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 3f7fbfc35e5b4ac1623c5d3bb2930d6c | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Stack;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int size = Integer.parseInt(br.readLine());
int[] array = getIntArr... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 3112ecd2620de78681abb40f9200e15a | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.util.*;
import java.util.Scanner;
public class Code {
public Code(){}
public static void main(String args[]){
Scanner X=new Scanner(System.in);
int N=X.nextInt();
int n=0,stack[]=new int[100005],ans=0;
for (int i=1;i<=N;i++){
int x=X.nextInt();
while (n>0&&x>stack[n]) {ans=Math.max(ans,x^... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 73046d0eadedd70f4f074394102d022f | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
public static void main (String[] args) throws java.lang.Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] arr = new int[n];
String[] brr = br.readLine().split(" ");
f... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | d115457b91a2389d51cc1b8b020fb92f | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.*;
import java.util.Stack;
public class Main
{
public static void main(String args[])
{
InputReader in=new InputReader(System.in);
int n=in.readInt();
int arr[]=new int[n];
int arr1[]=new int[n];
for(int i=0;i<n;i++)
{
arr1[n-1-i]=arr[i]=in.readInt();
}
System.out.println(Math.ma... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 7d12563e6046a424bee68accd84edb03 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.*;
import java.util.*;
public class test {
int INF = (int)1e9;
int MOD = 1000000007;
void solve(InputReader in, PrintWriter out) throws IOException {
int n = in.nextInt();
int max = 0;
Stack<Integer> stack = new Stack<>();
for(int i=0; i<n; i++) {
... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | a25304c6d112e7fc8a30f9056b9efdd3 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayDeque;
public final class Solution {
public static void main(String[] args) throws IOException {
solution();
}
public static int LINE_LENGTH = 1000000;
//No need of nextLine after... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 685ade5142dfe9561fb531e26c04762f | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.*;
import java.util.*;
public class MaximumXorSecondary {
public static void main(String[] args){
FastReader reader = new FastReader();
int len = reader.nextInt();
List<Integer> list = new ArrayList(len);
for(int i = 0; i< len; i++){
list.add(reader.nex... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 93cec2ae8fe25d53ce12bae69e648157 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
import java.util.StringTokenizer;
public class Xor {
private static long max = 0;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(n... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 6048a09f626609fdbe9680e5c80d9203 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;
public class Xor {
private static long max = 0;
private static long max2 = 0;
public static void main(String[] args) throws IOE... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | c525771b134400eaddeff80a827dae70 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
public static final int max = Integer.MAX_VALUE;
public static void main (String[] args) throws IOException{
FastReader f=new FastReader();
int n = f.nextInt();
int[] a = new int[n];
for (int i=0;i<n;i++) a[i] = f.nextInt();
... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 58abc7c7cf0462efaebf3e42389fb55a | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
a[i]=sc.nextInt();
Stack s=new Stack();
s.push(a[0]);
long ans=0;
... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 801e29247acd5bb2c7bcbfd2794d7982 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.io.*;
public class Solution {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
In... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 49ad907fd5e74605298414a8f954d4b6 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.util.Scanner;
import java.util.Stack;
public class MaxXORSecondary {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++) {
a[i]=in.nextInt();
}
Stack<I... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 2e08c5334da669928bc0323f5c8820b2 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes |
import java.util.Scanner;
import java.util.Stack;
public class Main {
public static void main(String args[]){
Scanner s = new Scanner(System.in);
String str = s.nextLine();
int N = Integer.parseInt(str);
str = s.nextLine().trim();
String[] str2 = str.split(" ");
int... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | cdbb83abcdf79aaf685d545ceb0a4aad | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]){
InputReader in = new InputReader();
PrintWriter out = new PrintWriter(System.out);
Task solver = new Task();
solver.solve(1, in, out);
out.close();
}
static int mod = (in... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | f7cdf29d3e3d795bb64fc4c1b3515e36 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
public class Main {
static String[] data;
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | e608c865a60bb5c9276106c5726e75dd | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
public class Main {
static String[] data;
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 2115d5250b6ea511b83c4ebd327172e9 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
public cl... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | a84625669d8ed0487eb48ac15ed89ff5 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.util.*;
import java.io.*;
public final class Solution
{
static int maxSecXor(int []arr,int n)
{
Stack<Integer> fwd=new Stack<>();
int res=Integer.MIN_VALUE;
fwd.push(0);
for(int i=1;i<n;i++)
{
while(!fwd.isEmpty()&&arr[fwd.peek()]<arr[i])
... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 57529b71967af0c64830457f0df69ff9 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 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 | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 0cf6de3fd1843f1f6f5ea3898c44f65b | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Stack;
import java.util.StringTokenizer;
public class MaxXorSeconday {
static int n;
static int arr[];
static int rev[];
public static long solve(i... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 9c4b1668dd8b4edecbf0311ee0d19345 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 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. */
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import ... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | b572dac60f3bee4379151b6c88c92fc0 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes |
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Stack;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ListIterator;
import java.util.Scanner;
p... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | bb5eb9b07da1965c55ed47690e902f80 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
import java.util.StringTokenizer;
/**ID: sinbadc1
LANG: JAVA
TASK: wormhole
*/
public class Main{
public static void main(String[] args)throws IOException{
BufferedReader br=new BufferedRead... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 98642150cb79b4c05f8999e9380d15ca | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.*;
import java.text.DecimalFormat;
import java.util.*;
public class Solution
{
public static void main(String[] args)
{
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
//--------Solution----------------------------------------... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 7f1ce6c7b18e5aca969dd30e32418b96 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String arg[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] ip = br.readLine().split(" ");
int[] arr = ... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | e372204cfe45df22c83c566a9964370f | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
import java.util.StringTokenizer;
public class MaximumXor {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | c92df7f520a842b7498207b8e95f3b21 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Stack;
import java.util.StringTokenizer;
public class MaximumXorSecondry {
static Inpu... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 4b1faa68b03c6c676e09020ec94c9330 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class j6 implements Runnable {
long md=1000000007;
long power(long x, long y, long p)
{
long res = 1;
x=x % p;
while (y > 0)
{
... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | a67db297024050afbb0fdcc2a0cfee81 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | //package practice;
import java.util.*;
public class Main
{
public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] arr = new int[n];
for(int i=0; i<n; i++)
{
arr[i] = scan.nextInt();
... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 52e9adfb8d092e0df475a8727e73a3e5 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.util.*;
import java.io.*;
public class a {
static long mod = 1000000007;
public static void main(String[] args) throws IOException
{
input.init(System.in);
PrintWriter out = new PrintWriter(new PrintStream(System.out));
//input.init(new FileInputStream(new File("input.txt")));
//PrintWriter out = ... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 55c7e692f9ec573f28aa13c371656048 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.util.Scanner;
import java.util.Stack;
public class MaxXOR {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Scanner sc = new Scanner (System.in);
int n = sc.nextInt();
long arr[] = new long[n];
for(int i=0; i<n; i++) {
arr[i] = sc.nextLong();
}
lon... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | ba89fad48418b42daf9589e66a3439de | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastReader f = new FastReader();
solve(f);
}
private static void solve(FastReader scr) {
int n = scr.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | ad8e005e33b9446fd3fa66f4465de2c0 | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Stack;
import java.util.StringTokenizer;
public class MaximumXorSecondary implements Closeable {
private InputReader in = ... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 5500ba0926b5a4fe5a8a2bc3193af64b | train_001.jsonl | 1362929400 | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1,βx2,β...,βxk (kβ>β1) is such maximum element xj, that the following inequality holds: .The lucky number of the sequence of distinct positive integers x1,βx2,β...,βxk (kβ>β1) is the ... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
// int t = sc.n... | Java | ["5\n5 2 1 4 3", "5\n9 8 3 5 7"] | 1 second | ["7", "15"] | NoteFor the first sample you can choose s[4..5]β=β{4,β3} and its lucky number is (4Β xorΒ 3)β=β7. You can also choose s[1..2].For the second sample you must choose s[2..5]β=β{8,β3,β5,β7}. | Java 8 | standard input | [
"two pointers"
] | c9b9c56d50eaf605e7bc088385a42a1d | The first line contains integer n (1β<βnββ€β105). The second line contains n distinct integers s1,βs2,β...,βsn (1ββ€βsiββ€β109). | 1,800 | Print a single integer β the maximum lucky number among all lucky numbers of sequences s[l..r]. | standard output | |
PASSED | 8a4c8317cfb04d0d86d18f1f6b0d8f9c | train_001.jsonl | 1387893600 | You are given a matrix consisting of digits zero and one, its size is nβΓβm. You are allowed to rearrange its rows. What is the maximum area of the submatrix that only consists of ones and can be obtained in the given problem by the described operations?Let's assume that the rows of matrix a are numbered from 1 to n fr... | 512 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import static java.lang.Integer.parseInt;
import static java.lang.Math.max;
import java.util.Arrays;
import java.util.StringTokenizer;
public class MaximumSubmatrix2 {
public static void main(String[] args) throws Exception {
BufferedReader... | Java | ["1 1\n1", "2 2\n10\n11", "4 3\n100\n011\n000\n101"] | 2 seconds | ["1", "2", "2"] | null | Java 8 | standard input | [
"dp",
"implementation",
"sortings"
] | 0accc8b26d7d684aa6e60e58545914a8 | The first line contains two integers n and m (1ββ€βn,βmββ€β5000). Next n lines contain m characters each β matrix a. Matrix a only contains characters: "0" and "1". Note that the elements of the matrix follow without any spaces in the lines. | 1,600 | Print a single integer β the area of the maximum obtained submatrix. If we cannot obtain a matrix of numbers one, print 0. | standard output | |
PASSED | e92e792ec13f8e1639cb24af2bf6f406 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes |
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import ... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 34aa380c76e2bf9bd3a9f3bdf04f4783 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
Ta... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | b586dccc8d54ef73a1cb78b6860bb8fc | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class A {
static final int[] dx = {0, 0, -1, 1}... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 542ed4dd01d44456067af46e94378f10 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Scanner;
import java.util.Queue;
import java.util.LinkedList;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Mouna Cheikhna
... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 16999ecfa69b37fef4b6fe5ea8cec5e5 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import javafx.util.Pair;
import java.util.*;
public class Main {
static int[] dx = {1, -1, 0, 0};
static int[] dy = {0, 0, 1, -1};
static int n, m;
static char[][] map;
static int[][] count;
static Queue<Pair<Integer, Integer>> queue = new LinkedList<>();
public static void main(String... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 59a8b35263f3a717c6d7873caf986bfe | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes |
// ~/BAU/ACM-ICPC/Teams/A++/BlackBurn95
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
st... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | f20feedbbcd0341bd90ec272baca7cf0 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class DrazilTiles {
int[] dx = new int[]{-1, 0, 0, 1};
int[] dy = new... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | afa0752498df781dc6d010a8b05b106c | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class DrazilTiles {
int[] dx = new int[]{-1, 0, 0, 1};
int[] dy = new... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 00df45f027c4720a51ddb5ce75bb21b7 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.*;
import java.text.DecimalFormat;
import java.util.*;
public class Main {
static int mod = (int)1e9+7;
static int N = (int)2e3+10;
static int ci[] = {1, 0, -1, 0};
static int cj[] = {0, 1, 0, -1};
int n, m;
char[][] a = new char[N][N];
int[][] deg = new int[N][N];
void fill(int i, int j) ... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 4ef3aa1c3e36ca0f885f938814b75108 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.*;
import java.util.*;
public class F{
public static void main(String[] args)throws Throwable {
MyScanner sc=new MyScanner();
PrintWriter pw=new PrintWriter(System.out);
n=sc.nextInt();
m=sc.nextInt();
V=n*m;
a=new char [n][m];
for(int i=0;i<n... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 985cd072bd50f9dc79bda996dfd14883 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main implements Runnable {
private boolean is_good(int x, int y){
if(x >= 0 && x < r && y >= 0 && y < c && map[x][y] == '.')
return true;
else
return false;
}
private void set(in... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | f4f307b5cd819617f3c88dd3e993f257 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.StringTokenizer;
public class _515D {
static int n, m;
... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | b50b2ca186fc7c800866e1026fc67cfc | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.InputStream;
import java.io.FilterInputStream;
import java.util.NoSuchElementException;
import java.io.BufferedInputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.io.IOException;
/**
* Built using CHelper plug-in
* Actual solution is at the top
... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 914565a9d743f3cacdf89b90d8586324 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.*;
import java.util.*;
public class SolveContest {
private BufferedReader in;
private PrintWriter out;
public SolveContest() {
try {
in = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter(new FileWriter("output.txt"),true);
so... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 245648a370a2de22d594d1cae49445fe | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.math.*;
import java.io.*;
import java.util.*;
public class C515D{
static char[][] ar;
static int i, j;
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new OutputStreamWri... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 10d6bdb19f16a17d0f4d4278a39d95eb | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.util.*;
/**
* Created by liqiu on 2/4/15.
*/
public class D {
static int n, m;
static char[][] maze;
static int[][] deg;
static char[][] tile = { {'v','^'}, {'^','v'}, {'>', '<'}, {'<','>'}};
static int[] dx = {-1, 1, 0, 0};
static int[] dy = {0, 0, -1, 1};
public static void ... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 4f7387ea21e25291736ec0b6e6fc7ff7 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;
public class C515D {
private Strin... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | d0dff1bc17ec32f67858f97df7db0dc3 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;
public class C515D {
private Strin... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 8fe0efde3daeb2e7890acf3a5669db9a | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Priorit... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 3f62a91728124c3974eafc4f591ca621 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class D
{
public static int cover(int i,int j)
{
int n=a.le... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | a38d5537bf29e6b96620cbfa39977c98 | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Priorit... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 0f3397e24cb6d002dc35a4a935cc31ce | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.util.*;
import java.io.*;
public class D {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
int m = sc.nextInt();
char[][] map = new char[n][m];
for(int i = 0; i < n; i++) {
map[i] = sc.next().toCharArray();
}
int[][] dir = {{0,1},{0,-1},{... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | ba42921f3c07f6d89d8955c35bb7778c | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes |
import java.awt.Point;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class DrazilAndTiles {
static int n;
static int m;
static int[] r = { 1, -1,... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 8746b17ad1c9976194490783565d4b7c | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.io.*;
import java.util.*;
public class a {
public static void main(String[] args) throws IOException {
input.init(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = input.nextInt(), m = input.nextInt();
int[][] degs = new int[n][m];
int[]... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output | |
PASSED | 2d2b43d0a9578e3c4483754d74c8566c | train_001.jsonl | 1424190900 | Drazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."But Drazil d... | 256 megabytes | import java.util.LinkedList;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Collection;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Queue;
import java.io.IOException;
import java.util.StringTokenizer;
/**
* Built using CHelpe... | Java | ["3 3\n...\n.*.\n...", "4 4\n..**\n*...\n*.**\n....", "2 4\n*..*\n....", "1 1\n.", "1 1\n*"] | 2 seconds | ["Not unique", "<>**\n*^<>\n*v**\n<><>", "*<>*\n<><>", "Not unique", "*"] | NoteIn the first case, there are indeed two solutions:<>^^*vv<>and^<>v*^<>vso the answer is "Not unique". | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 9465c37b6f948da14e71cc96ac24bb2e | The first line contains two integers n and m (1ββ€βn,βmββ€β2000). The following n lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied. | 2,000 | If there is no solution or the solution is not unique, you should print the string "Not unique". Otherwise you should print how to cover all empty cells with 1βΓβ2 tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format exa... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.