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
747c553b8fa44c2d6dffdb6a39f36cdd
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.*; import java.util.*; public class C { static int[] dr1 = {0,1}; static int[] dc1 = {1,0}; static int[] dr2 = {0,-1}; static int[] dc2 = {-1,0}; public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.par...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 & 1\\ 0 & 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 & 0 & 0\\ 0 & 0 & 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 & 0 & 1 & 1 & 1 & 1 & 1\\ 0 & 1 & 1 & 0 & 1 & 1 & 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
383b6d4cebdee89839861430669f7b60
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.util.*; import java.io.*; public class C{ private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); public static void main (String[] args) throws java.lang.Exception { int t = ...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 & 1\\ 0 & 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 & 0 & 0\\ 0 & 0 & 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 & 0 & 1 & 1 & 1 & 1 & 1\\ 0 & 1 & 1 & 0 & 1 & 1 & 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
7f25cb4ec2109f00b7522054c4007903
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int[][] canExit; static int[][] vis; static class Pair{ int x, y; Pair(int i, int v){ x=i; y=v; } } static void solve() throws Exception { int n, m; n = sc.nextInt(); ...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 & 1\\ 0 & 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 & 0 & 0\\ 0 & 0 & 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 & 0 & 1 & 1 & 1 & 1 & 1\\ 0 & 1 & 1 & 0 & 1 & 1 & 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
e33a49239d6974fa33f57c32a44fb0fd
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
//package div2_646; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(ne...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 & 1\\ 0 & 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 & 0 & 0\\ 0 & 0 & 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 & 0 & 1 & 1 & 1 & 1 & 1\\ 0 & 1 & 1 & 0 & 1 & 1 & 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
e7793a8e39eb55361f83d97ef2b527b2
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.util.Scanner; public class palindromePaths { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int T=sc.nextInt(); for(int t=0;t<T;t++){ int N=sc.nextInt(),M=sc.nextInt(); int[][] paths=new int[N][M]; for(int n=0;n<N;n...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
1363848468d1dc90e16f96cae8203f62
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-- > 0) { int n = scan.nextInt(), m = scan.nextInt(); int[] zeros = new int[n+m-1], ones = new int[n+m-1];...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
40c1c92b4c6856755d1e48fda6f5c1a1
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; public class c { public static void main(String[] args) throws Exception { in = n...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
01035f4c1bc7744537043722dd1961a1
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import javax.sound.sampled.ReverbType; import java.util.*; import java.io.*; public class Main { static Arr...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
7dab0f84f88256c2ccc8acc5a3695ba7
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.*; import java.util.*; public class Palinpath { static int count=0; public static void run(int arr[][], int n, int m) { for(int i=0;i<(n+m-1)/2;i++) { int count0=0,count1=0; for(int j=0;j<n;j++) { for(int k=0;k<m;k++) { if(k+j==i||k+j==n+m-2-i) { if(arr[j][k]==0) ...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
4c76d095ea49ee6188dd94b441e2cf30
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
6c787b2fa7339335218a575f9ab9a3df
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class practice { static class InputReader { private InputStream stream; private byte[] buf = new byte[8192]; private int curChar; private int snumChars; private SpaceCharFilter filter; public InputRea...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
87b69a9891b2fdc9a22f442a54a0c432
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class d extends PrintWriter{ static BufferedReader s = new BufferedReader(new InputStreamReader(System.in)); // static Scanner s=ne...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
ac92bd3246c6f4a2bd925cf867c6f780
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.*; public class TestClass { static final class InputReader { private final InputStream stream; private final byte[] buf = new byte[1024]; private int curChar; private int numChars; public InputReader...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
554453034c67a1f1813df8af78b4dd16
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.util.*; import java.io.*; import java.util.HashSet; public class STRING{ public static void main(final String args[]) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(Syst...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
a89950a6196f8ff61cec2de5b218c781
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.util.*; import java.io.*; import java.util.HashSet; public class STRING{ public static void main(final String args[]) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(Syste...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
b85ba74e6e2460428b97c6bb5688f020
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public final class C { public static void main(String[] args) { final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); final int t = in.nextInt(); for (int tt = 0; tt...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
3e038e2339ab8008c91b7939bc92d192
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class C_ { static Scanner sc; static PrintWriter out; static int[][] a; static boolean[][] done; static int ans; static void main()throws Exception{ int n=sc.nextInt(),m=sc.nextInt(); a = new int[n][m]; done = new boolean[n][m]; for(int i...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
4baaf7fc45e5c7d47f590fa66fc7b251
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br; public static void main(String[] args) throws Exception { br = new BufferedReader(new InputStreamReader(System.in)); int tc = 1; tc =cinI(); while (tc-- > 0) { // int n = cinI(); ...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
93ff16ed605fef3cc0885ceea627d04e
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeMap; public class c { static FastReader fs = new FastReader(); public static void main(String[] args) { ...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
5563cccf6314b288fe8f5cf175c17d0f
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.*; import java.text.*; import java.util.*; import java.math.*; public class C { public static void main(String[] args) throws Exception { new C().run(); } public void run() throws Exception { FastScanner f = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int asdf = f.nextInt...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
1cbbb1bdca15c789c0cf293ab2e462c7
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
// package cp; import java.io.*; import java.util.*; public class Cf_three { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); Readers.init(System.in); int t=Readers.nextInt(); for (int ii = 0; ii < t; ii++) { int n=Readers.nextInt(); int m=Reader...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
4846139baa8ca730be692ab3b6b87de9
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.StringTokenizer; public class Task3 { public static void main(String[] args) throws IOException { new Task3().s...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
8cf00966f43e4e36af43a59aae56cd4d
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
// package com.company.codeforces; import java.util.HashMap; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner input=new Scanner(System.in); int t=input.nextInt(); while (t-->0){ int n=input.nextInt()-1; int m=input.nextInt()-...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
67c1dc6bab2f264cbd5e67636e5a4d93
train_001.jsonl
1591886100
You are given a matrix with $$$n$$$ rows (numbered from $$$1$$$ to $$$n$$$) and $$$m$$$ columns (numbered from $$$1$$$ to $$$m$$$). A number $$$a_{i, j}$$$ is written in the cell belonging to the $$$i$$$-th row and the $$$j$$$-th column, each number is either $$$0$$$ or $$$1$$$.A chip is initially in the cell $$$(1, 1)...
256 megabytes
import java.io.BufferedReader; import java.io.EOFException; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.UncheckedIOException; import java.lang.reflect.Array; import java.lang.reflect.Field; import java.util.ArrayDeque; import java.util.ArrayList; import java...
Java
["4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 1 1 1 1 0 1\n3 5\n1 0 1 0 0\n1 1 1 1 0\n0 0 1 0 0"]
1.5 seconds
["0\n3\n4\n4"]
NoteThe resulting matrices in the first three test cases: $$$\begin{pmatrix} 1 &amp; 1\\ 0 &amp; 1 \end{pmatrix}$$$ $$$\begin{pmatrix} 0 &amp; 0 &amp; 0\\ 0 &amp; 0 &amp; 0 \end{pmatrix}$$$ $$$\begin{pmatrix} 1 &amp; 0 &amp; 1 &amp; 1 &amp; 1 &amp; 1 &amp; 1\\ 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 &amp; 0\\ 1 &am...
Java 11
standard input
[ "greedy", "math" ]
b62586b55bcfbd616d936459c30579a6
The first line contains one integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 30$$$) — the dimensions of the matrix. Then $$$n$$$ lines follow, the $$$i$$$-th line contains $$$m$$$ integers $$$a_{i, 1}$$$, $$...
1,500
For each test case, print one integer — the minimum number of cells you have to change so that every path in the matrix is palindromic.
standard output
PASSED
891bfb65be27f0c753351a90dfb9e419
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.*; import java.util.*; public class Test4 { public static void main(String [] args)throws Exception { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); String line = read.readLine(); int n = line.length(); boolean flag = true; for(int i=0;i<n/2-1;i++) { ...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
2a4cd1fc0cf680c51ab5923a8572a32e
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.*; import java.io.*; public class P1113D { private static void solve() { String s = next(); char[] c = s.toCharArray(); int[] cnt = new int[26]; for (int i = 0; i < c.length; i++) { cnt[c[i] - 'a']++; } boolean good = true; for (int i = 0; i < 26; i++) { i...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
9915588fdcbec0ae7c50570c073313ca
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at ...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
551ae711214f2ec6fe7b5fd6ca5da7c8
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { System.out.println(new Solution().solve()); } private String solve() { Scanner in = new Scanner(System.in); String s = in.next(); int n = s.length(); if (n == 1) return "Impo...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
e7e5ffd0bcde3221d5f3b9ba806ab531
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.*; import java.util.*; import java.lang.StringBuilder; public class Main { public static void main(String[] args) { MyScanner myScanner = new MyScanner(); PrintWriter printWriter = new PrintWriter(new BufferedOutputStream(System.out)); new Solver().solve(myScanner, printWriter); printWriter.clo...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
e19792dd4547b4ebda1be3e0cb73f41d
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringJoiner; import java.util.StringTokenizer; import java.util.function.Function; public class MainD { static String S; public static void main(String[] args) { FastScanner sc = new FastScanner(System.in); S = sc.next(); S...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
4b6f96d884f952aa439401f46670422e
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
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
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
c25238872ef6f3d55acf44377e7ce5fd
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.StringTokenizer; imp...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
ff5f11b034e1136cfbb6de00629efa2b
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.HashSet; import java.util.Set; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.LinkedList; import java.util.Scanner; import jav...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
94c94b4d432b9e818aef3820360ad524
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.*; import java.util.*; public class div539D { BufferedReader in; PrintWriter ob; StringTokenizer st; public static void main(String[] args) throws IOException { new div539D().run(); } void run() throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); ob = new PrintW...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
a6bdc311d6eca2a995eff4d0b6ba927f
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String S=sc.next(); char[] arr=S.toCharArray(); int n=arr.length; int ans=0; char ch=arr[0]; for(int i=0;i<n/2;i++) if(arr[i]!=ch) ans=-1; if(ans==0) { System.out.p...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
acfd473c081a28ee6a61e2c269f48c22
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); if(s.length() < 3) System.out.print...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
bb283fcc8ba97608992d4082a51f8370
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class D implements Runnable { FastReader scn; PrintWriter out; String INPUT = ""; void solve() { String str = scn.next(); char[] arr = str.toCharArray(); int n = arr.length; RollingHashFactory rhf = new RollingHashFactory(2, n, new ...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
6669690b53f04fe97eb848b4ce4f7c12
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class D{ static class FastReader { BufferedReader br; StringTokenizer st; public FastRead...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
7da929b97037d24d92471caca721532c
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author cunbidun */ public class M...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
6402a8ef50cb8904ac878ee3c9cd453b
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
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
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
2d230b03bea8402649ff33b2d3ab0b76
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ private static boolean isPalindrome(StringBuffer buffer){ for(int i=0, j=buffer.length()-1; i<j; i++, j--){ if(buffer.charAt(i) != buffer.charAt(j)) return false; } return true; } priva...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
bf4c30f15b1bde070e60801ad91c4a0a
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner reader = new Scanner(System.in); String s = reader.next(); if(anyAnswer(s)){ System.out.println(process(new StringBuilder(s)) ? 1 : 2); } else { System.out.println("Imp...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
07b635d193e6dbfcc2c6fd4d5fea1cb7
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.*; import java.util.*; public class SashaAndOneMoreName { public static void main (String [] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = in.readLine(); if (possible(line)) { StringBuffer sb = new StringBuffer(line); fo...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
d1aed896a718d28819bf4c6cb583ddb5
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.*; public class ACM { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); if (s.length() == 1) { System.out.print("Impossible"); } else { if (checkSame(s.substring((s.length() + 1) / 2))) { ...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
4d7cac2f039225a67918c0672e6ff2ba
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.UncheckedIOException; import java.nio.charset.Charset; import java.util.StringTokenizer; import ja...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
cc35d6d902274abd8a74b346d2283cf6
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /* BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); Integer.parseInt(st.nextToken()); Long.parseLong(st.nextToken()); Scanner sc = new Scanner(System.in); */ public class issam3...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
8c23b660e7821d625ed378d1cfbb023b
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; /** * @author madi.sagimbekov */ public class C1113D { private static ...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
a2e6323b05c9f607dd90fe60ca2c1cbf
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.*; import java.io.*; public class Main { static int n, numDist = 0; static String in; static char[] arr; static int[] freq = new int[26]; public static void main (String[] args){ Scanner sc = new Scanner(System.in); in = sc.next(); arr = in.toCharArray(); n = arr.le...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
016548929fc13e36535a330b6d7d8906
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /* BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); Integer.parseInt(st.nextToken()); Long.parseLong(st.nextToken()); Scanner sc = new Scanner(System.in); */ public class issam3...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
2f1ebb430b2895b10bc84b93c80b863c
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.Scanner; public class oneMore { public static void main(String[] args) { Scanner scan=new Scanner(System.in); String s=scan.next(); //ewwwwwwwwwww no please no hashing :( //1 cut try all cutting places //2 cuts try removing prefix/suffix, it will work iff they are not palindromes //else ...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
684a17b6d5c2195877da66c2ba14e3a1
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.Scanner; public class SashaAndOneMoreName { public static void main(String[] args) { //answer is always at most 2 (or inf) Scanner sc = new Scanner(System.in); char[] str = sc.nextLine().toCharArray(); int n = str.length; sc.close(); //check if impo...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
9e50fc7641020cedb6367ae4b7377985
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.util.*; public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int n = s.length(); boolean pos = false; for (int i = 0; 2*(i+1) <= n; i+...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
c2fcf8113f859ec695f092ee0bfd5496
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
/* * * @Author Ajudiya_13(Bhargav Girdharbhai Ajudiya) * Dhirubhai Ambani Institute of Information And Communication Technology * */ import java.util.*; import java.io.*; import java.lang.*; public class Code29 { public static boolean ispalindrome(String s) { int len = s.length(); int i...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
f4e3124b67260307e96e539d488cdf71
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
//package baobab; import java.io.*; import java.util.*; public class D { public static void main(String[] args) { Solver solver = new Solver(); } static class Solver { IO io; public Solver() { this.io = new IO(); try { solve(); ...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
e507fbf2fc02bb028ff6c6c33481515d
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author JENISH */ public class Ma...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
69c226bb0fc2287e34b70f1d53b9c4d5
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.*; import java.util.*; public class tr2 { public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); PrintWriter out=new PrintWriter(System.out); String h=sc.nextLine(); int le=h.length(); HashSet <Character> hs=new HashSet(); int i=0; int j=le-1; // S...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
798fab5aeaa3b487dcc6f6594488c564
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.BufferedReader; // import java.io.FileInputStream; // import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.ArrayList; import java.util.P...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
ae852d3776343367531239ba838db68a
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.BufferedReader; // import java.io.FileInputStream; // import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.ArrayList; import java.util.P...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
e04f4b90776132009cf0767a13428764
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 megabytes
import java.io.*; import java.util.InputMismatchException; import java.util.Random; /** * @author tainic on Feb 16, 2019 */ public class D { private static boolean LOCAL; static { try { LOCAL = "aurel".equalsIgnoreCase(System.getenv().get("USER")); } catch (Exception e){} } private static f...
Java
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
bbfca9fd99ce6e48dfe2ff0bf058c18f
train_001.jsonl
1550334900
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
256 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
["nolon", "otto", "qqqq", "kinnikkinnik"]
1 second
["2", "1", "Impossible", "1"]
NoteIn the first example, you can cut the string in those positions: no|l|on, and then unite them as follows on|l|no. It can be shown that there is no solution with one cut.In the second example, you can cut the string right in the middle, and swap peaces, so you get toot.In the third example, you can't make a string, ...
Java 8
standard input
[ "constructive algorithms", "brute force", "strings" ]
ffdef277d0ff8e8579b113f5bd30f52a
The first line contains one string $$$s$$$ ($$$1 \le |s| \le 5\,000$$$) — the initial name, which consists only of lowercase Latin letters. It is guaranteed that $$$s$$$ is a palindrome.
1,800
Print one integer $$$k$$$ — the minimum number of cuts needed to get a new name, or "Impossible" (without quotes).
standard output
PASSED
43236566189c39bf27ce1d1cc4e53fe7
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static void main(String[] arg) { FastScanner scan = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
af1e48a55ed1a37909bf6b53b2600206
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Phone { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int x = Integer.parseInt(br.readLine()); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
4e50cdebae7e387c7cf37cddf44ee7a5
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class B_25_Phone_Numbers { public static void main(String[] args){ Scanner input=new Scanner(System.in); @SuppressWarnings("unused") int n=input.nextInt(); String s=input.next(); String news=""; while(s.length()>3){ news=news+s.substring(0, 2)+"-"; s=s.substring(2); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
814f071b795f4fd33fcd265767d41658
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.*; import java.util.*; public class b25 { public static void main(String args[])throws IOException { InputStreamReader read=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(read); String s; // System.out.println("Enter"); int i,l,j,k,m,...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
ed161a4db7c5e45eac57f92be3c1ea85
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; public class Main { /** * @param args */ static int N; public static void ma...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
3ace29b16acbd3c4a732c0d391119b9f
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class Phones { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int c = 0, n = sc.nextInt(); StringBuilder sb = new StringBuilder(sc.next()); int sz = sb.length(); if (n % 2 == 0) { for (int i = 0; i < sb.length(); i += 2) { System.out.pr...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
6c88108509c9d93c63a686816fd6f46c
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.*; import java.util.*; public class phone { static BufferedReader br; static StringTokenizer st; static PrintWriter out; public static void main(String[] args) throws IOException { InputStream input = System.in; //InputStream input = new FileInputStream("fileIn.in"); OutputStream output = Syst...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
179286a89a541a571de8331f7d1b0999
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; /** * * @author 11x256 */ public class Phonenumbers { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String temp = sc.nextLine(); if (temp.length() % 2 == 0) { ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
6ab0044f2e3e49e29d9e8ff31d0575a7
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Stack; /*...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
4a60a6b8df575cb35ec11e50f1a6a7b2
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Reader.init(System.in); int n = Reader.nextInt() ; String s = Reader.next(); char [] c = s.toCharArray() ; StringBuilder res = new Strin...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
0ced827607f6f9c4553d4f32b20d2d26
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class PhoneNumbers { public static void main(String[] args) { Scanner inp = new Scanner(System.in); inp.nextLine(); String x = inp.nextLine(); String x2 = ""; if(x.length()%2!=0&&x.length()>=3){ x2=x.substring(x.length()-3); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
9a305a6708ac7ab864e9043a04c867f1
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class PhoneNumber { public static void main(String[] args) { Scanner inp = new Scanner(System.in); inp.nextLine(); String x = inp.nextLine(); String x2 = ""; if(x.length()%2!=0&&x.length()>=3){ x2=x.substring(x.length()-3); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
e2ec382c63e24a963fef7225033e79f5
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class Main { public static StringTokenizer st; public static BufferedReader scan; public static PrintWriter out; public static int gcd(int a, int b){ if(a < b)return gcd(b, a); else if(b == 0)return a; else return g...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
0230da445fccd9c13ccf335327091fd3
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CF { static InputReader in = new InputReader(System.in); public static void main(String[] args) throws IOException { int n = in.nextInt(); Str...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
f0c445056f881adea1922ef7848e1c72
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; import sun.nio.cs.Surrogate; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author youniesmahmoud */ public class phone { public static void main(String[] args) { Scanner inp = new Scanner(System.in); inp....
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
62c71f1e38eddad785240a6cbec5506d
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.awt.Point; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class Solution implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
de2a8068f2827dd7da6fe87cf6ad5dc3
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class P25B { public P25B() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String phone = sc.next(); sc.close(); int i = 0; for (; i < n - 3; i+= 2){ System.out.print(phone.substring(i, i+2) + "-"); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
142f9f346fadeb0ef31187d366a63ae3
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String res =""; int n =sc.nextInt(); String numbers = sc.next(); if(n==2||n==3)System.out.println(numbers); else { ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
938517b178fb030106a2db312b4040d3
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
ce198aa6dc72cd01097f4f1456ef543f
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String s = sc.next(); sc.close(); for(int i = 0 ; i < N ; i++){ System.out.print(s.charAt(i)); if(i % 2 != 0 && ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
30634e756ecb0c54dc9cf95cfc4d8f7a
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.*; import java.util.*; public class j { public static void main(String a[])throws IOException { BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int n=0,i=0; n=Integer.parseInt(b.readLine()); String s; s=b.readLine(); if(n%2==0) { for(i=0;i<n;i+=2) { if(i!=0) System.out.print("-"); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
c10fae5dc69202e4bb75c43c2c049ae5
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System.in ) ) ; int A = Integer.parseInt(input.readLine()) ; String X = input.readLine() ; if ( A % 2 == 0 ) for ( int i = 0 ; i < X.length(...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
850e0753ee9e0192d8732ec319ca8f3f
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class _25B { static Scanner scanner = new Scanner(System.in); static int n; static String s; public static void main(String[] args) { n = scanner.nextInt(); s = scanner.next(); for (int i=0;i<s.length();) { if (i + 3 == n) { System.out.println(s.substring(i)); i ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
2e321dd52aee4bb524908d72a32b7bd3
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.*; public class Test_Project_0001 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = sc.nextInt(); String number = sc.nextLine(); String number_s = sc.nextLine();...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
2421325eb84c595dfe05ccdd5a60e789
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class PhoneNumber { public static void main(String[] args) { Scanner input=new Scanner(System.in); int i=0, a=0; int number=input.nextInt(); String phnumber=input.next(); if(number%2==0) { System.out.print( phnumber.substri...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
b73dafe981127e80cc4434d8b29287fc
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); String str = s.next(); if (n == 3 || n == 2) System.out.println(str); else if (n % 2 == 0) { ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
7a5d4b6b3f2433389c61390641defb68
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.util.ArrayDeque; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
1d15a8a484aa010ec55242ccd5bc54c0
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** *...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
721e63ea0b841b23a82981468b8616f3
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.*; import java.io.*; public class Main { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); static StringBuilder out = new StringBuilder(); public static void main(String[] args){ solve(); return; } // the following...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
7c7222a2c19a81bec919c7ddb8f28b69
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader cin=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(cin.readLine()); char a[]=cin.readLine().toCharArray(); if(n<=3) System.out.pr...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
ed9788d5a0d3e6c87319d4d7a3a040e8
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class Main { static String s; public static void main(String[] args) { Scanner sc = new Scanner(System.in); sc.nextInt(); s = sc.next(); printGroups(0); } static void printGroups(int i) { if (s.length() - i == 2 || s.length() - i == 3) { for (int j = i; j < s.length...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
bbc663346dcbc0cf365a041e6243872f
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.*; public class b25 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String s=sc.next(); for(int i=0;i<s.length();i++) { System.out.print(s.charAt(i)); if(i%2!=0 && n-i!=2 && n-1!=i) ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
ea9a99080484321cc9df05d92ea98886
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class main { public static void main(String[] args) { try{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int digit,in=0; String numz; digit= Integer.pars...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
04d141f6f51d9c2de0bada91850c60b9
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
//package codeforce; import java.util.Scanner; /* @author Kbk*/ public class PhoneNumber { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); String str=sc.next(); String temp=""; if(str.length()%2==0){ for(int i=0;i<...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
526d8646636c256546b3740323030108
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class other { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String str = scan.next(); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
19e6967cd2245bc431987aae8973f4dc
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.util.Scanner; import java.util.Vector; public class first { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
9e0334ecbad81f68b189c305db943d00
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class PhoneNumberDivisions { public static void main(String args[]){ Scanner input=new Scanner (System.in); int n=input.nextInt(); String s=input.next(); int a[]=new int[n]; for (int i=0;i<=n-1;i++){ a[i]=s.charAt(i); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
784dcc1401e5c3876720d6857e91e56b
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class B25 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); char[] next = in.next().toCharArray(); StringBuilder str = new StringBuilder(); int index = 0; if ((n & 1) == 0) { str.append(next[index++]); str.append(n...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
d6a50edff806ff455df0c0ab2251d229
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class solver implements Runnable { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new S...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
f06338e7c4f341eb0b585043a4c6837f
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class main { public static void main(String[] args) { try{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int digit,in=0; String numz; digit= Integer.pars...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output