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
49e2f7f0ebcb5c477d661cf52e8fc183
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
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
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
6722b7afc80990a295d3af5300fcaf34
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; public class DistrubedPeople { public static void main(String[] args)throws Exception { int n; int k=0; UltraFastReader input = new UltraFastReader(); n=input.nextInt(); int[] a = new int[n]; for(int i=0;i<n;i++) ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
76b538c019588367c2cc4a0523b35d51
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.*; import java.io.*; public class First { 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(); int a=0; int b=1; int c=2; ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
54cc9fa7312ae9f2f2fe020c9c32e062
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.Scanner; public class p1 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] arr = new int[n]; int count = 0; for (int i = 0; i < n; i++) { arr[i] = scan.nextInt(); if (arr[i] == 0) { count++; } } int l = n - 2; ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
3dd9519d6883b3d17bcf3eb114a9a702
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class ConcernedTenants { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); byte n = (byte) sc.nextInt(); boolean[] a = new boolean[n]; ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
1cd0e4cc0fb33be35a280e1f78d0eef2
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.io.*; import java.util.*; public class B521 { public static void main(String[] args) { FastScanner s = new FastScanner(); int n = s.nextInt(); int[] arr = new int[n+1]; for(int i = 1 ;i<n+1 ; i++) { arr[i] = (s.nextInt()); } int ans = 0; for(int i = 2;i<n;i++) { if(arr...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
a434a50e9b16a71a00ac12056923efb7
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.io.*; import java.util.*; public class yuy { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n=sc.nextInt(); int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=sc.nextInt(); int [] t=new int[n]; ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
db052b9dfb97ec8c0fcf23371094d13e
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.Scanner; public class B { public static void main (String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int [] a = new int[n]; for (int i=0; i<n;i++) { a[i] = input.nextInt(); } int cur=0; int k; ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
e7e1fead0a2edd4ae2c317a18d232364
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Scanner; import java.util.*; /** * * @author abdelmagied */ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedList; import java.util.L...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
6005cf2e250ce6dbd2ed3d3441bd3159
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.*; public class VC521B { public static boolean check(int []arr, int i) { return (arr[i] == 0 && arr[i-1] == 1 && arr[i+1] == 1); } public static ArrayList<Integer> countDisturbed(int []arr) { ArrayList<Integer> list = new ArrayList<>(); for (int i = 1; i < arr.length -1; i++) { if (check(a...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
05d1c1af34824b0efea6898669ed1913
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.*; import java.lang.*; //f public class b_0112 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int[]b= new int[a]; int count = 0; for (int i = 0; i <a ; i++) { b[i] = in.nextInt(); ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
964c925740d247791e841dbf555d726a
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.util.Scanner; /** * * @author Pc */ public class Test1 { public static Scanner in=new Scanner(System.in); public static void main(String args[]){ int j=0; int n=in.nextInt(); int t[]=new int[n]; for(int i=0;i<n;i++...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
6fa7cf483c838868d0de2c530b61b217
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.io.BufferedReader; import java.util.Arrays; import java.io.InputStreamReader; public class b{ public static void main(String[] args)throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String c[] = br.readLine().split("...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
425598208582f7ef5ac7f059a0590f18
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.Scanner; public class disturbed { static boolean check(int arr[],int i) { if(i==0)return false; if(i==arr.length-1) return false; if(arr[i]==0 && arr[i-1]==1 && arr[i+1]==1) return true; return false; } public static void main(String[] args) { Scanner sc = new Scanner(System.in...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
b902fa507cc3c77ddbeb55a2121cf556
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⡎...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
c2b247206eec13d27368c1798b4db33a
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.Scanner; /** * @author: zhaoqing * @date: 2018/9/9 * @time: 下午9:37 */ public class BDisturbedPeople { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); int a=-1; int b=-1; int c=-1; int result=0; ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
10c9eb4354e9f881b6f763d72346ecea
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class A { public static void main(String[] sachin32) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int arr[] = new int[n]; for(int i=0; i<n; i++) arr[i] = in.nextInt(); int cnt=0; ArrayList<Integer> l...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
921f9f96bef02e324d8d7eae9f12d926
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Scanner; public class ProblemB { public static void main(String[] args) throws IOException { InputStreamReader in = new InputStreamReader(System.in); BufferedReader buffer = n...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
c876e9eff3e4d31beb9abd76462334f5
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.Scanner; public class CF2 { public static void main (String [] args ) { Scanner mos = new Scanner ( System.in ) ; int a = mos.nextInt () ; int c = 0 ; int temp ; int [] b = new int [a] ; for ( int i = 0 ; i < b.length ; i ++ ) b [i] = mos.nextInt(); for ( int i = 0 ; i < b.length ...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
db45e06a3087d9f0e0d2ee0db47956df
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import static java.util.Collections.list; import java.util.List; import java.util.Scanner; /** * * @author hossam */ public class Ps { /** * @param args the command line arguments */ p...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
e8892891e8c14bc0599f10ac50777bbc
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class Fun { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Vector<Integer> list=new Vector<Integer>(); int num=sc.nextInt(); sc.nextLine(); String word=sc.nextLine();...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
81eb80859ede03d76198c4438c4b5273
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Second_Order_Statistics { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int[] input = new int[N]; for (int i = 0; i < N; i++) { input[i] = scan.n...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
7690f6be66c7dc46628de2c64e5625fa
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.PriorityQueue; import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedOutputStream; import java.util.HashSet; import java.util.Stri...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
fbd20bbd53dc9e8d1ba16f8b580dcdd7
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedOutputStream; import java.util.HashSet; import java.util.StringTokenizer; import java.io.Buff...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
354b3638b448e9c0b25662cb2a9f03f4
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Scanner; import java.util.Set; /* * To change this license header, choose License Headers in Project Properties. * To change this template f...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
54a33592c359c9582759caa0f95daa58
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main ( String args[] ) { Scanner s = new Scanner(System.in); int number = s.nextInt(); int[] secound = new int[number]; for(int i = 0 ;i <number ; i++){ ...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
b7605dc1ed9e0eb5822fa8841a23425a
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.Iterator; import java.util.Scanner; import java.util.SortedSet; import java.util.TreeSet; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn=new Scanner(System.in); int n=Integer.parseInt(scn.nextLine()); SortedSet<Integer> numbers=...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
86e9d2ca078d6a45ea24d4693e01e79a
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.Scanner; public class acm22 { public static void main(String[]args) { int hh=1; int y=0; Scanner a=new Scanner(System.in); int b=a.nextInt();//amount of numbers int[] number=new int [b]; for(int i=0;i<b;i++) { number[i]=a.nextI...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
17c072d95fbbfcd9a33ae533ed8255c0
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.Scanner; public class acm22 {//accept public static void main(String[]args) { int hh=1; int y=0; Scanner a=new Scanner(System.in); int b=a.nextInt();//amount of numbers int[] number=new int [b]; for(int i=0;i<b;i++) { number[i]...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
4588576694f1bb1eeb8b8b798308ecc2
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
//import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; //import java.io.OutputStream; import java.io.PrintWriter; //import java.util.Scanner; import java.util.Arrays; import java.util.StringTokenizer; //import jdk.nashorn.internal.runtime.reg...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
27de044b8263acd617132f43270dd19d
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class SecondOrder { public static void main(String[] args) { Scanner input = new Scanner(System.in) ; int size = input.nextInt() ; int a [] = new int [size] ; for(int i = 0 ; i < size ; i ++){ a[i] = input.nextInt() ; } if(size > 1) { Arrays...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
a823c8c495f1a41b876427fcb2c568e8
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class Solution { public static void main(String[] args) throws IOException { BufferedReader rea...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
b7198849c0919cf5086912c946002f8f
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Solution2 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int min = 101; int max = -101; ArrayList<Integer> a = new ArrayList<>(); for (int i ...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
cf3a59c540e882f41cddccc5091cbe6c
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x = input.nextInt(); int z, num1 = 0, num2 = 0; int[] arr = new int[x]; for (int i = 0; i < x; i++) { int y = input.nextInt(); ...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
1a6fdf329f46a3fd91ddbc00ae6fd02c
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.ArrayList; import java.util.Comparator; import java.util.Scanner; import javax.lang.model.type.ArrayType; public class Main { static void sapxep(int[] A, int n) { int tg; int i, j; for (i = 0; i < n; i++) { for (j = i; j < n; j++) { if (A[i] > A[j]) { tg = A[i]; A[i] = A[j];...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
a282a06967a0e4cb838c7eebf5598b69
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; /* Name of the class has to be "Main" only if the class is public. */ public class bbg { public...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
f14e51e97d0f9bd8956482f3e9d65ee5
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.*; public class SecondOrderStatistics { public static void main(String[] args) { int a[] = new int[100]; Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=0;i<n;i++) { a[i] = sc.nextInt(); } for(int i=0;i<n-1;i++...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
abb25e081bd93387150ccc67eed48ac9
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import static java.lang.System.*; import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(in); int n = sc.nextInt(); ArrayList<Integer> set = new ArrayList<Integer>(); for(int x=0;x<n;x++) { int num = sc.nextInt(); if(!set.contains(num)) set.ad...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
78341aecfe5061df6e0694db804abdbe
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.io.IOException; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.StringTokenizer; public class Mac { static String newString; public static void main (String[] args...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
19ea4d6ad73c055c56d8d9d29b16443d
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.Scanner; public class Bob { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int j; HashSet<Integer> a = new HashSet<>(); ...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
4b35251867af9f5ff503449ff7693d15
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class SecondOrderStatistics { public static void main(String[] args) { BufferedReader scan = new BufferedReader(new InputStreamReader(System.in)); String input = null; try { input = scan.readLine(); } cat...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
e4d4fc8e7887e76cdc5cd4c26864a087
train_001.jsonl
1277823600
Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; if(n == 1) { System.out.println("NO"); return; } else { int p = 1; for(int i = 0;i<n;i++) { ...
Java
["4\n1 2 2 -4", "5\n1 2 3 1 1"]
2 seconds
["1", "2"]
null
Java 8
standard input
[ "brute force" ]
930be5ec102fbe062062aa23eac75187
The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.
800
If the given sequence has the second order statistics, output this order statistics, otherwise output NO.
standard output
PASSED
f433b5fc9d2c61d6b7930e776dc22074
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; import java.math.*; public class G { public static void main(String[] args) throws IOException { //PrintWriter out = new PrintWriter(new File("out.txt")); PrintWriter out = new PrintWriter(System.out); //Reader in = new Reader(new FileInputStream("in.t...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
df03d2ae5d01c9f982a332e2708e9aed
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; public class d { static final int m = 18, a = (1 << m) - 1, b = 1 << (m - 1), c = (1 << (m - 1)) - 1; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); System.out.println("2 3"); System.out.println(a + " " + b + " 0"); S...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
06ef07f9827013670729b593567fe18f
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Main{ public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputSt...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
e500f64037266dcfb790a74df09df449
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String []args) throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false); solve(in, out); in.close(); o...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
219c241d9e0313151cbc574ac51ff7c2
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; public class EdE { static long[] mods = {1000000007, 998244353, 1000000009}; static long mod = mods[0]; public static MyScanner sc; public static PrintWriter out; public static void main(String[] omkar) throws Exception{ // TODO Auto-generated method stub sc = new MySc...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
3f6c567bb49ae0f005705f1f165c2c24
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = Integer.parseInt(sc.next()); int n = 3; int m = 3; int[][] a = new int[n+1][m+1]; a[1][1] = 262143; a[1][2] = 13107...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
6961a860f17875f6a710c499edc364e6
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; import java.security.acl.Owner; public class codeforces { public static void main(String[] args) throws Exception { int n=sc.nextInt(); int infinity=262143; int smaller_infinity=131072; int N=infinity^n; pw.println(2+" "+3); pw.println(infinity+" "+N+" "+infinit...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
d3e1fc55237a9c9352447e69756b215c
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.*; public class Main { static class UnionFind { List<I...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
313038763b2b0b0538f690d2556aaf1e
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
//make sure to make new file! import java.io.*; import java.util.*; public class D630{ public static void main(String[] args)throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int k = Integer.parseI...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
1331c8f340660d6a14b1aa4e8ff1c1af
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
/* / フフ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ム / )\⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ Y (⠀⠀| ( ͡° ͜ʖ ͡°)⠀⌒(⠀ ノ (⠀ ノ⌒ Y ⌒ヽ-く __/ | _⠀。ノ| ノ。 |/ (⠀ー '_人`ー ノ ⠀|\  ̄ _人'彡ノ ⠀ )\⠀⠀ 。⠀⠀ / ⠀⠀(\⠀ #⠀ / ⠀/⠀⠀⠀/ὣ====================D- /⠀⠀⠀/⠀ \ \⠀⠀\ ( (⠀)⠀⠀⠀⠀ ) ).⠀) (⠀⠀)⠀⠀⠀⠀⠀( | / |⠀ /⠀⠀⠀⠀⠀⠀ | / [_] ⠀⠀⠀⠀⠀[___] */ // Main Code at th...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
0ddac790701cd8b480913b9a70d2c531
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String fgfg[])throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(System.out); int k=Integer.parseInt(br.readLine()); pw.println...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
bdd63693d9e85be8019e27089f8f15e6
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.*; import java.util.*; public class tr2 { static PrintWriter out; static StringBuilder sb; static long mod = 1000000007; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); out = new PrintWriter(System.out); int k = sc.nextInt(); if (k == 0) { S...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
8bbd252d7ab2ed4c41a16c6e2e778132
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 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.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public cl...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
78a5b2e6613c38ba01b21424ea5e1aab
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
//created by Whiplash99 import java.io.*; import java.util.*; public class D { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int i,N,M; int K=Integer.parseInt(br.readLine().trim()); N=M=3; ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
5aaa05e3ab069af391d8c5d0dc743299
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
//package Round630; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; /** * @author sguar <shugangcao@gmail.com> * strive for greatness * Created on 2020-01-10 */ public class D { ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
d7d2e4ee8214ec93c91ff1a8bcbf6bad
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
ac46918a14f9645c7cd2bedf56d12ae1
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.Scanner; public class a { public static void main(String[] args) { Scanner in = new Scanner(System.in); int k = in.nextInt(); int max = 1 << 17; System.out.println("" + 2 + " " + 3); System.out.println("" + (max + k) + " " + k + " " + 0); System.out....
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
13750e03dd145020010d064b89d24c5c
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.*; import java.util.*; public class MainClass { public static void main(String[] args)throws IOException { Reader in = new Reader(); int k = in.nextInt(); StringBuilder stringBuilder = new StringBuilder(); if (k == 0) { stringBuilder.append("1 ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
9910aa63ba0e464e475d6fdc2546bbc0
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
3e2030da65bf7b128b45ce5817e3ab9f
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
c14414e7bf2b1d245371cd8806e86ed7
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 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.StringTokenizer; public class WalkOnMatrix implements Closeable { private InputReader in = new InputReader(System.in); pr...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
6246b5bcc3305c6e0db1a0a791058b7d
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.awt.*; import java.io.*; import java.util.*; public class Drogon { public static void main(String[] args) throws Exception { FastReader sc=new FastReader(); int k=sc.nextInt(); int ans[][]=new int[2][3]; ans[0][1]=(1<<17);ans[1][0]=k;ans[1][1]=(1<<17)+k; ans[0][0...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
e0a2e00636305a8beed7afd12f80f2ee
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.StringTokenizer; import java.io.PrintWriter; import java.io.*; import java.util.stream.Collectors.*; import java.lang.*; import static java.util.stream.Collectors.*; import static java....
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
afceb6d7cd2d843d0ee06cbd2de38463
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int K = ni(); out.println(2+" "+3);...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
e51c0c2d213060c4e9fddfa2e1510cb9
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); int m = 0x00020000; int[][] arr = new int[2][3]; arr[0][0] = m+k; arr[0][1] = k; arr[1][0] = m; arr[1]...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
9ae1e12a9a84f02c7ea94b3291cfe983
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.Scanner; public class Main { static int[][] charOccurences; public static void main(String args[]) { Scanner in = new Scanner(System.in); // int nbTests = in.nextInt(); // while (nbTests-- > 0) // { int k = in.nextInt(); if (k == 0) { System.out.println("1 1"); System.out.prin...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
77bd1299c53400ab78c8bcc63fe65db7
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
/*****Author: Satyajeet Singh, Delhi Technological University************************************/ import java.io.*; import java.util.*; import java.text.*; import java.lang.*; import java.math.*; public class Main{ /*********************************************Constants****************************...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
fc99114071d1f75a015ce971aa46fd0e
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 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; import java.util.*; public class Main { public ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
a72064e21f2f28a45dea40d1d04a6fe5
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; import java.security.acl.Owner; public class codeforces { public static void main(String[] args) throws Exception { int n=sc.nextInt(); int infinity=262143; int smaller_infinity=131072; int N=infinity^n; pw.println(2+" "+3); pw.println(infinity+" "+N+" "+infinit...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
ce29f9b8936ba872af328d055e70f57e
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
// coded by Krishna Sundar // import java.lang.*; import java.io.*; import java.util.*; public class Main { public void solve(Read input, Write output) throws Exception { int K = input.readInt(); output.printLine(2 + " " + 3); output.printLine(((1l<<17)+K) + " " + K + " " + 0); ou...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
2cfc6ed2b7b1705a403b2e33720e8e2c
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.Scanner; public class codeforces1332D { public static void main(String[] args) { Scanner s = new Scanner(System.in); int k = s.nextInt(); int j=k+131072; System.out.println(2+" "+3); System.out.println(j+" "+k+" "+0); System.out.println(131072+" "...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
e3de2611b68a24dce1aee4129057ddfd
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 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 Sparsh Sanchorawala */ pub...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
f23a1a530cf141f958d1129bce068305
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Round630D { public static void solve() { int k = s.nextInt(); if(k == 0) { out.println(1+" "+1); out.println(10); return; } ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
aadd295e4132617f579e8bcadaa4a899
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
// Utilities import java.io.*; import java.util.*; public class Main { static int K; public static void main(String[] args) throws IOException { INPUT in = new INPUT(System.in); K = in.iscan(); if (K == 0) { System.out.println(1 + " " + 1); System.out.println(300000); System.exit(0); } System.ou...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
12e2c000d024825c9c4f5668fec45b6e
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** If I'm the sun, you're the moon Because when I go up, you go down ******************************* I'm working for the day I will surpass you https://www.a2oj.com/Ladder16.html */ impor...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
37543c64062c163e0969b407a57a9520
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); static int MOD = 1000000007; public static void main(String[] args) throws IOException { ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
5fe1c8b1befde6dfe0c78fccdc5a2e10
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; public class Solution{ public static class pair{ int x; int y; } public static class FastScanner { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st=new StringTokenizer(""); public String next() { ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
a4f6061884cee13add4b89ffca2c4371
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; public class Main { static FastReader in=new FastReader(); static StringBuilder Sd=new StringBuilder(); static List<Integer>Gr[]; static int a[],b[]; static boolean visit[]; public static void main(String [] args) { //Dir by MohammedElkady int t=...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
f989609def79143cae1023a447f1b9b6
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
// package Div2_630; import java.io.*; import java.util.InputMismatchException; public class D implements Runnable { @Override public void run() { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int t = in.nextInt(); getRes(t, w); ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
9a0616b7a0f439258335e535f0e60dc9
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.*; import java.util.*; /** * Created by Katushka on 11.03.2020. */ public class B { static int[] readArray(int size, InputReader in) { int[] a = new int[size]; for (int i = 0; i < size; i++) { a[i] = in.nextInt(); } return a; } static long[] rea...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
4d3a0eac7569125ca0a6025313f42150
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tok = new StringTokenizer(""); String next() throws IOException { if (!tok.hasMoreToke...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
1cd048d3895cdb12a10d8de81e0d163e
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.*; import java.util.Random; import java.util.StringTokenizer; public class D { public static void main(String[] args) { FastReader scan = new FastReader(); PrintWriter out = new PrintWriter(System.out); Task solver = new Task(); int t = 1; for(int tt = 1; tt ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
8e352211d2223b0b3f571de9b1785318
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import javax.swing.*; import java.io.*; import java.util.*; import java.math.*; import static java.util.Comparator.*; public class Main { public static void main(String[] args) throws IOException { FastReader s = new FastReader(); int k=s.nextInt(); // System.out.println(Integer.toBinarySt...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
fa31873c741cb29aa7bce5c8ba83dfaf
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.function.IntConsumer; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in */ public class Main { public ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
4412a1a14b5a62a5bae8211655b734de
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.Scanner; /** * * k will be obtained by having dp solution value 0 * * * 2^10 + k 2^10 0 * k 2^10+k k */ public class c6 { public static void main(String []args) { Scanner sc=new Scanner(System.in); int k=sc.nextInt(); Syste...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
4034b90ebaec7a939cd4067acdea16a8
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import javax.print.DocFlavor; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.Inet4Address; import java.nio.charset.IllegalCharsetNameException; import java.time.temporal.Temporal; import java.util.*; import java.util.concurrent.l...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
288ab6318945cfc720806072b641e759
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; public class D_1332 { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int k = sc.nextInt(); int x = 1; while(x <= k) x <<= 1; int m = x + k; int[][] ans = new int[3][3...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
7a6fc73c97d5d6fb7c17a753f4cfb137
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.*; import java.util.*; import java.math.*; public class S{ static class Pair implements Comparable<Pair>{ int a; int b; public Pair(int x,int y){a=x;b=y;} public Pair(){} public int compareTo(Pair p1){ if(a == p1.a) return b - p1.b; return a - p1.a; } } stat...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
84203d0cfc0c9d0863876171ce939d2a
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.*; import java.io.*; public class Solution{ long rem = 998244353L; public void solve(int test, Scanner sc){ int k = sc.nextInt(); if(k == 0){ System.out.println("1 1"); System.out.println("1"); return; } int n = 2; int m = 3; int set = 0; int num = k; while(num > 0){ ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
fe02e48f5467cd2674d844dd0fd9459a
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { private static final int MAXN = 5000; private static final String NO = "No"; private static final String YES...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
a739d9aa286d9a37158610507c6d1e7d
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.util.Scanner; public class D { public static void main(String[] args) { new D(); } public D() { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); int x = 1<<17; System.out.println("2 3"); System.out.println((x+k) + " " + k + " 0"); System.out.println(x + " " + (x+k) + " " + k);...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
fb167019f717c3121760d91f2214724f
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.net.Inet4Address; import java.util.*; import java.lang.*; import java.util.HashMap; import java.util.PriorityQueue; public class Solution implements Runnable { static class pair implements Comparable { int f; ...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
363bfdae2199131cbeeaea6cb8f28d7d
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
import java.io.*; import java.text.*; import java.util.*; import java.math.*; public class D { public static void main(String[] args) throws Exception { new D().run(); } public void run() throws Exception { FastScanner f = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int n = f.nextInt(...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
ec46c470dcb03432ecac5bd5e9f4452e
train_001.jsonl
1585661700
Bob is playing a game named "Walk on Matrix".In this game, player is given an $$$n \times m$$$ matrix $$$A=(a_{i,j})$$$, i.e. the element in the $$$i$$$-th row in the $$$j$$$-th column is $$$a_{i,j}$$$. Initially, player is located at position $$$(1,1)$$$ with score $$$a_{1,1}$$$. To reach the goal, position $$$(n,m)$$...
512 megabytes
// Magic. Do not touch. import java.io.*; import java.math.*; import java.util.*; public class Main { static class FastReader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public FastReader() { this(System.in); }public FastReader(InputStream is) { mIs = is;...
Java
["0", "1"]
2 seconds
["1 1\n300000", "3 4\n7 3 3 1\n4 8 3 6\n7 7 7 3"]
NoteIn the first example, the maximum score Bob can achieve is $$$300000$$$, while the output of his algorithm is $$$300000$$$.In the second example, the maximum score Bob can achieve is $$$7\&amp;3\&amp;3\&amp;3\&amp;7\&amp;3=3$$$, while the output of his algorithm is $$$2$$$.
Java 8
standard input
[ "constructive algorithms", "bitmasks", "math" ]
fc0442e5cda2498a1818702e5e3eeec4
The only line of the input contains one single integer $$$k$$$ ($$$0 \le k \le 10^5$$$).
1,700
Output two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 500$$$) in the first line, representing the size of the matrix. Then output $$$n$$$ lines with $$$m$$$ integers in each line, $$$a_{i,j}$$$ in the $$$(i+1)$$$-th row, $$$j$$$-th column.
standard output
PASSED
ef6c8937fa7158a064f13a0e1f88c8d6
train_001.jsonl
1583573700
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by $$$2$$$) or determine that there is no such subset.Both the given array and required subset may contain equal values.
512 megabytes
import java.io.*; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.List; // Problem 398B: Painting the Wall public class P1323A { /* Template code starts here. */ public static final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(Sys...
Java
["3\n3\n1 4 3\n1\n15\n2\n3 5"]
1 second
["1\n2\n-1\n2\n1 2"]
NoteThere are three test cases in the example.In the first test case, you can choose the subset consisting of only the second element. Its sum is $$$4$$$ and it is even.In the second test case, there is only one non-empty subset of elements consisting of the first element, however sum in it is odd, so there is no solut...
Java 11
standard input
[ "dp", "implementation", "greedy", "brute force" ]
3fe51d644621962fe41c32a2d90c7f94
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$), number of test cases to solve. Descriptions of $$$t$$$ test cases follow. A description of each test case consists of two lines. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 100$$$), length of array $$$a$$$. The second lin...
800
For each test case output $$$-1$$$ if there is no such subset of elements. Otherwise output positive integer $$$k$$$, number of elements in the required subset. Then output $$$k$$$ distinct integers ($$$1 \leq p_i \leq n$$$), indexes of the chosen elements. If there are multiple solutions output any of them.
standard output
PASSED
351d87b53bb3e908c2f08c8e1cf3f239
train_001.jsonl
1583573700
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by $$$2$$$) or determine that there is no such subset.Both the given array and required subset may contain equal values.
512 megabytes
import java.util.*; public class problem1372A25 { private static Scanner sc=new Scanner(System.in); public static void main(String[] args) { int t=sc.nextInt(); while(t>0) { int n=sc.nextInt(); int[] arr=new int[n]; for (int i = 0; i <n ; i++) arr[i]=sc.nextI...
Java
["3\n3\n1 4 3\n1\n15\n2\n3 5"]
1 second
["1\n2\n-1\n2\n1 2"]
NoteThere are three test cases in the example.In the first test case, you can choose the subset consisting of only the second element. Its sum is $$$4$$$ and it is even.In the second test case, there is only one non-empty subset of elements consisting of the first element, however sum in it is odd, so there is no solut...
Java 11
standard input
[ "dp", "implementation", "greedy", "brute force" ]
3fe51d644621962fe41c32a2d90c7f94
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$), number of test cases to solve. Descriptions of $$$t$$$ test cases follow. A description of each test case consists of two lines. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 100$$$), length of array $$$a$$$. The second lin...
800
For each test case output $$$-1$$$ if there is no such subset of elements. Otherwise output positive integer $$$k$$$, number of elements in the required subset. Then output $$$k$$$ distinct integers ($$$1 \leq p_i \leq n$$$), indexes of the chosen elements. If there are multiple solutions output any of them.
standard output
PASSED
d5fc98fdf1f8a38a5da8c3bbf0b1a410
train_001.jsonl
1583573700
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by $$$2$$$) or determine that there is no such subset.Both the given array and required subset may contain equal values.
512 megabytes
import java.util.*; public class P1{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); boolean flag=false; int ans=0; int[] a=new int[n]; for (int i=0;i<n ;++i) { a[i]=sc.nextInt(); if (a[i]%2==0) { flag=t...
Java
["3\n3\n1 4 3\n1\n15\n2\n3 5"]
1 second
["1\n2\n-1\n2\n1 2"]
NoteThere are three test cases in the example.In the first test case, you can choose the subset consisting of only the second element. Its sum is $$$4$$$ and it is even.In the second test case, there is only one non-empty subset of elements consisting of the first element, however sum in it is odd, so there is no solut...
Java 11
standard input
[ "dp", "implementation", "greedy", "brute force" ]
3fe51d644621962fe41c32a2d90c7f94
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$), number of test cases to solve. Descriptions of $$$t$$$ test cases follow. A description of each test case consists of two lines. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 100$$$), length of array $$$a$$$. The second lin...
800
For each test case output $$$-1$$$ if there is no such subset of elements. Otherwise output positive integer $$$k$$$, number of elements in the required subset. Then output $$$k$$$ distinct integers ($$$1 \leq p_i \leq n$$$), indexes of the chosen elements. If there are multiple solutions output any of them.
standard output
PASSED
d06f73bdae82558e693b064bd2b95d44
train_001.jsonl
1583573700
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by $$$2$$$) or determine that there is no such subset.Both the given array and required subset may contain equal values.
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; import java.util.*; import static java.lang.System.*; /* Shortcut--> Arrays.stream(n).parallel(...
Java
["3\n3\n1 4 3\n1\n15\n2\n3 5"]
1 second
["1\n2\n-1\n2\n1 2"]
NoteThere are three test cases in the example.In the first test case, you can choose the subset consisting of only the second element. Its sum is $$$4$$$ and it is even.In the second test case, there is only one non-empty subset of elements consisting of the first element, however sum in it is odd, so there is no solut...
Java 11
standard input
[ "dp", "implementation", "greedy", "brute force" ]
3fe51d644621962fe41c32a2d90c7f94
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$), number of test cases to solve. Descriptions of $$$t$$$ test cases follow. A description of each test case consists of two lines. The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 100$$$), length of array $$$a$$$. The second lin...
800
For each test case output $$$-1$$$ if there is no such subset of elements. Otherwise output positive integer $$$k$$$, number of elements in the required subset. Then output $$$k$$$ distinct integers ($$$1 \leq p_i \leq n$$$), indexes of the chosen elements. If there are multiple solutions output any of them.
standard output