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
25d179fa4fa68a3cb680563a9067337b
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; public class cf { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s=new Scanner(System.in); int t=s.nextInt(); for(int i=0;i<t;i++) { int n=s.nextInt(); String st=s.next(); char[] a=st.toCharArray(); int pref=-1; int seg=0; ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
a0813ac9be7c57cfe484fa2207e67f5f
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.BigInteger; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
a588404de7bc1b96536b7f91848f4c9d
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
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.*; public class Round_789 { static BufferedReader sc = new BufferedReader(new InputStreamReader(System.in)); st...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
792fbaa17c5d683c797289cdabb99dd7
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
// Working program using Reader Class import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Scanner; import java.util.StringTokenizer; import java.util.Collections; import java.util.*; public...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
38a1ec378fa78f1826bfa21214e0482a
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
/* 5 10 1110011000 8 11001111 2 00 2 11 6 100110 Can divide each string into n/2 segments of size two each, every segment that looks like '10' or '01' needs to be flipped to become '11' or '00' */ import java.util.*; import java.io.*; public class Main{ public static int n; public static int[...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
f3c1327418cc10f34a123e8d87124aae
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.lang.*; public class Solution{ static int mod=(int)1e9+7; static int mod1=998244353; static FastScanner sc = new FastScanner(); static StringBuffer ans; static long ct; public static...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
33512f6a0e90fc1e6a31ba5049ebf456
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
/* "Everything in the universe is balanced. Every disappointment you face in life will be balanced by something good for you! Keep going, never give up." Just have Patience + 1... */ import java.util.*; import java.lang.*...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
2799d1ae3df5f60483192faf9283ccb9
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; public class Solution { static Scanner sc = new Scanner(System.in); public static void solver() { int n = sc.nextInt(); String s = sc.next(); int oddSeg= 0, evenSeg = 0, l = -1; for(int i = 0; i < n; i+=2){ if(s.charAt(i) != s.charAt(...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
ee19300543887fdee07ae889205a5463
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
// Java is like Alzheimer's, it starts off slow, but eventually, your memory is gone. import java.io.*; import java.util.*; public class Aqueous { static MyScanner sc = new MyScanner(); static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) { int t = sc.nextInt...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
1f3b0611394714e0a9b427cd40c0755c
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Good01String { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static String next() throws IOExce...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
ccbf5d8de6f1c1203102b59ed5713def
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ FastReader fr=new FastReader(); PrintWriter pw=new PrintWriter(System.out); int tt=fr.nextInt(); while(tt-->0){ int n=fr.nextInt(); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
852ded1dbacbafe37ba4c379ea31846d
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int mod = (int)1e9+7; static boolean[] prime = new boolean[1]; static int[][] dir1 = new int[][] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; static int[][] dir2 = new int[][] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
8c1b9ce73d9ecc605c9b6a08374bafe2
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
///package solution; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Solution implements Runnable { public void solve() throws Exception { int testCase = sc.nextInt(); while (testCase-- > 0) { int n = sc.nex...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
cd3089471f71caef1f7e0fe790a653fb
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class G { static FastScanner fs = new FastScanner(); static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder(""); static Scanner scn = new Scanner(System.in); public static void main(String[] ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
053cb72cab77b67a29ac35a5105f6da1
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static long mod = (int)1e9+7; // static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
e81a05082feca350cd734cf06ad75b5e
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; public class E { public static HashMap<Integer, Integer> sortByValue(HashMap<Integer, Integer> hm) { List<Map.Entry<Integer, Integer> > list = new LinkedList<Map.Entry<Integer, Integer> >(hm.entrySet()); Collections.sort(list, new Comparator<Map.Entry<Integer, Integer> >() { ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
3060abc1daa022a301cfdec472708a0f
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class TokitsukazeAndGood01StringHardVersion{ public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t=sc.nextInt(); while (t-->0){ int n...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
dc210f7fde7b0b142ed0072833663486
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
// import static java.lang.System.out; import static java.lang.Math.*; import static java.lang.System.*; import java.lang.reflect.Array; import java.util.*; import java.io.*; import java.math.*; public class Main { static FastReader sc; static long mod = ((long) 1e9) + 7; static long lmax=...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
27d4e813c6ed1eb54071c384d7b4bc7d
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.util.stream.IntStream; import java.util.stream.Stream; public class Main { public static void main(String[] args) { in = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); try { ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
3837c353be6e201d1df59a6125e2b2b3
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class codeforces_789_B2 { private static void solve(FastIOAdapter in, PrintWriter out) { int n = in.nextInt(); char[] s = in.next().toCharArray(); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
8cf89f2ed250a79f5b185ccdb7995d97
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
//package com.company; import java.math.BigInteger; import java.util.*; import java.lang.*; import java.io.*; public class Main { public static FastScanner fs = new FastScanner(); public static Scanner sc = new Scanner(System.in); public static PrintWriter out = new PrintWriter(System.out); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
d90a0aa3a0bf6df614728df64797f0eb
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(S...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
e41f78cb8acfcf0bb3d0753088885455
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; //need to be careful about negative sum resulting negative mod. public class Solution { static long mod = 1000000007; static long inv(long a, long b) {return 1 < a ? b - inv(b % a, a) * b / a : 1;} static long mi(long a) {return inv(a, mod);} static InputRea...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
a0d38adbc567ecfde473045c39d45aff
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Practise{ static boolean palindrome(String s,int i,int j) { if(j==s.length())return false; while(i<j) { if(s.charAt(i)!=s.charAt(j))return false; i++;j--; } return true; } static int valid(String s,int i) { ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
b805ea558d0036b8cda977c911c4d11c
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import static java.lang.Math.*; public class Main { static double pi = 3.141592653589; static int mod = (int) 1e9 + 7; public static void main(String[] args) throws IOException { int qwe = in.nextInt(); while (qwe-- > 0...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
3e6bbd87a35e805f62a0e0d228c64a00
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
/*----------- ---------------* Author : Ryan Ranaut __Hope is a big word, never lose it__ ------------- --------------*/ import java.io.*; import java.util.*; public class Codeforces1 { static PrintWriter out ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
e2b868bb9a2debf10fcc870cd6e65853
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
// Java is like Alzheimer's, it starts off slow, but eventually, your memory is gone. import java.io.*; import java.util.*; public class Aqueous { static MyScanner sc = new MyScanner(); static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) { int t = sc.nextI...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
556c801eb50dcc86621b1127238f597e
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.StreamTokenizer; import java.math.BigInteger; import static java.lang.Math.*; import static java.lang.System.*; import java.util.*; public class Main { static pub...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
e42dcfd343f70d62c415cad977a6697b
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class C { public static void main(String[] args) { FastScanner sc = new FastScanner(); int T = sc.nextInt(); while (T-- > 0){ int n...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 11
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
17ab59136de0a452023e897367b68623
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class TokitsukazeAndGood01StringHardVersion { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; public static void main(String[] args) throws IOException { int t = readInt(); while (t-- > 0) { ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
b937adf878d2aca1bcc549b79a64fdc5
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Main { //--------------------------INPUT READER---------------------------------// static class fs { public BufferedReader br; StringTokenizer st = new StringTokenizer(""); public fs() { this(System.in); } public fs(I...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
16976122978508e8fba901660975c52f
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; /** * * @Har_Har_Mahadev */ /** * Main , Solution , Remove Public */ public class B { public static void process() throws IOException ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
9e172aa8a00ca74c0782c56cfef4d12d
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main{ static int mod = (int)1e9+7; static PrintWriter out; static String[] memo; ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
166a749b2964248977c36d3f15c16f55
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class GoodStrHard { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for (int i = 1; i <= t; i++) { ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
e45a1a6b327a0f4a0a817f2c954c0457
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.lang.Math; import java.util.*; import java.util.regex.Pattern; import javax.swing.text.DefaultStyledDocument.ElementSpec; public final class Solution { private static class FastScanner { private final int BUFFER_SIZE = 1 << 16; private DataInputStream din; priv...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
d52970155a7f38042b66f81c85b8d915
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.lang.Math; import java.util.*; import java.util.regex.Pattern; import javax.swing.text.DefaultStyledDocument.ElementSpec; public final class Solution { private static class FastScanner { private final int BUFFER_SIZE = 1 << 16; private DataInputStream din; priv...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
7a0784fcd7e31bf90b7277c052c2ab41
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t,n; t = sc.nextInt(); for(int i = 0; i < t; i++){ n = sc.nextInt(); String A = sc.next(); boolean one = false; boolean zero = fa...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
8614169901bd085ef10b5510056a4518
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
//package december; import java.util.*; import java.io.*; public class codeforces1678B2 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int numCases = Integer.parseInt(br.readLine()); for (int rep...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
0ebcaae053d30901d43a3655a3ae1124
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputReader s = new InputReader(System.in); int t = s.nextInt(); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
dc91cae2b38d2a6c18d444688a6e7d4f
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputReader s = new InputReader(System.in); int t = s.nextInt(); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
d79e9cd98f654f7a8e9db8643da0362a
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Main { public static int inf = (int)1e9+7; public static int mod = (int)1e9+7; public static void main(String[] args) throws IOException, InterruptedException { BufferedWriter writer = new BufferedWriter(new Ou...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
cda45363a2c1a0c3b38ea6739a533fb9
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.PrintWriter; import java.lang.*; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class A_769 { static PrintWriter out = new PrintWriter(System.out); static ArrayList<ArrayList<Integer>> ans; static ArrayList<...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
4e6bb54902e6f65eba911b1543fea526
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codechef { /* FastReader class to work with input */ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
3c66f5ae2ad1fee3f40ce2757a850c80
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java....
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
e5c742be95c221c32350137b1aae94b1
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; import java.util.function.DoubleToLongFunction; public class Codeforces789{ static long mod = 1000000007L; static MyScanner sc = new MyScanner(); static void solve() { int n = sc.nextInt(); int arr[] = sc.readIntArray(n); int z = 0; ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
1ba8d97065ab52f7db34ac0141fecde5
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static long INF = 2000000000000000010l; static int fx[][] = {{-1,0},{0,1},{1,0},{0,-1},{-1,-1},{1,1},{1,-1},{-1,1}}; public static void main(String[] args) throws IOException { int t=1; t = cin.nextInt(); while (t-- > 0)...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
a63e15d0fac830296b568c1e9dd9d035
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
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(); for (int i = 0; i < N; i++) { int num = sc.nextInt(); sc.nextLine(); String str = sc.nextLine(); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
50dd85ee2655aa7d12b6d6452d66c87f
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int times = scanner.nextInt(); while (times-- > 0){ int n = scanner.nextInt(); String s = scanner.next(); char last2 = ' '; ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
c74b7142ed64a296ce3f3ac8e487298d
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.Scanner; /** * @Author LWX * @date 2022/5/11 23:15 */ public class Tokitsukaze_and_Good_01_String_hard_version { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); for (int i = 0; i < n; i++) { ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
4339623c540f0bd07e7a78bbb04709ce
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.stream.IntStream; import java.util.Arrays; import java.io.ByteArrayOutputStream; import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.IOException; import...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
9b2e5777686608805c7daea314b67eef
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.rmi.Remote; import java.util.*; public class Full { static BufferedReader bf; static PrintWriter out; public static void main (String[] args)throws IOException { bf = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
9df88db75913c2aad8ce394a654ff474
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B2_Tokitsukaze_and_Good_01_String_hard_version { static Scanner in = new Scanner(); static PrintWriter out = new PrintWriter(Syst...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
406c9156be20f280bfa3f21cb8658d73
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { // try { // System.setIn(new FileInputStream("input.txt")); // System.setOut(new PrintStream(new FileOutputStream("output.txt"))); // } catch (Exception e) { // System.err.println("Error"); // }...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
ec5514cd6e30ef86fa04cdaf01fe7992
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String args[]) throws IOException { // Your code goes here BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.readLine()); while(t-->0){ int n=Integer.parseInt(br.read...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
54735bb0c4d73d4b56b170d0da634812
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class CodeForces { /*-------------------------------------------EDITING CODE STARTS HERE-------------------------------------------*/ public static void solve(int tCase) throws IOException { int n = sc.nextInt(); char[] str = sc.next().toCharArray(); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
2c61a25eac4f05d98f69cd25dc3dd013
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public final class Main { //int 2e9 - long 9e18 static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)}; static...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
1c019212b834682ddef5a3bf1036f761
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
/* I am dead inside Do you like NCT, sKz, BTS? 5 4 3 2 1 Moonwalk Imma knock it down like domino Is this what you want? Is this what you want? Let's ttalkbocky about that :() */ import static java.lang.Math.*; import java.util.*; import java.io.*; public class x1678B { static final int INF = Integer...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
f6d782a19a5ce010d95123fcf6d43f04
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; public class cf { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s=new Scanner(System.in); int t=s.nextInt(); for(int i=0;i<t;i++) { int n=s.nextInt(); String st=s.next(); char[] a=st.toCharArray(); int pref=-1; int seg=0; ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
e06a49f0329c6f0598cffda871935a40
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; import java.lang.reflect.Array; public class CodeForces { class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { try { br = new BufferedReader(new FileReader("input.txt")); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
8ee50e2590aa221ca71a4b03fc58b8b1
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
// Problem: B2. Tokitsukaze and Good 01-String (hard version) // Contest: Codeforces - Codeforces Round #789 (Div. 2) // URL: https://codeforces.com/contest/1678/problem/B2 // Memory Limit: 256 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org) import java.util.*; public class Myte...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
bd72c3bd2cb3497c8eca204c9587bd76
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Scanner; public class CodeForces { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); StringBuilder sb = new StringBuilder(); wh...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
ef0a8279a23e972d15cf3bc0e49f2fe9
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static FastReader sc=new FastReader(); // static long dp[][]; // static boolean v[][][]; // static int mod=998244353;; // static int mod=1000000007; static long oset[]; static int oset_p; static long mod=...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
b1d237d44461ff282c4dfcb75b82afa8
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; import java.util.*; public class Main { public static int n,t; public static void main(String[]args) throws IOException { Scanner scan = new Scanner(System.in); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
11515764fbbcf3ab4fe82baf441a6107
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B2_Tokitsukaze_and_Good_01_String_hard_version { static Scanner in = new Scanner(); static PrintWriter out = new PrintWriter(Syst...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
a569bf7db11fa4251dc091b834911706
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int w = sc.nextInt(); while (w-- > 0) { int n = sc.nextInt(), index = 0, len = 0; char[] c...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
9419c2ef4d7c78f78718cce81bcff043
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int T=sc.nextInt(); while(T-->0) { int n=sc.nextInt(); char[] str=(" "+sc.next()).toCharArray(); int ans1=0,ans2=0; ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
1a55ba00b095fbd15314c26e93417a8d
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) { new B().run(); } BufferedReader br; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); class pair { int F, S; pair(int f, int s) { ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
6c3a6b0d0a1d663ae69fbea2ca12769d
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Main { static long cr[][]=new long[1001][1001]; //static double EPS = 1e-7; static long mod=998244353; static long val=0; static boolean flag=true; public static void main(String[] args) { FScanner sc = new FScanner(); //Arrays.fill(prime, tr...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
350a51a5c1fba8839732936ddacd6dbe
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long startTime = System.currentTimeMillis(); // for global initializations and methods starts here // global initialisations and methods end here static void run() { boolean tc = true; //AdityaFastIO r = n...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
948fdea71b76cc944f9a0f270c7048f5
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; // Map.Entry<Integer,String>dum; //res=(num1>num2) ? (num1+num2):(num1-num2) /* Name of the class has to be "Main" only if the class is public. */ public class Pupil { static FastReader sc = new FastReader(); public stati...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
11e565b8f7c06b0c95e70330a85518f9
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; import java.util.concurrent.ThreadLocalRandom; public class c731{ pub...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
c0fc7365894972407167ac8c2e2b29ad
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); Task solver = new Task(); solver.solve(in.nextInt(), in, out); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
ccb14ee2bd59cb2eca02159371e94153
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; /* * Author: Atuer */ public class Main { // ==== Solve Code ====// static int INF = 2000000010; public static void csh() { } public static void main(String[] args) throws IOException { // csh(); int t = in.nextInt(); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 8
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
d57c77ff1a5cb387b8b32c5b456f9989
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class TokitsukazeAndGoodString_Hard { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int testcases = sc.nextInt(); StringBuilder sb = new StringBuilder(); while (testcases-->0)...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 17
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
c03ef10b5f146bc0fd8c0dd9b0f7f9fc
train_108.jsonl
1652020500
This is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
/** * @author luke_nguyen * @link https://codeforces.com/contest/1709/problem/E */ import java.util.Scanner; import java.io.BufferedWriter; import java.io.OutputStreamWriter; import java.io.IOException; public class codeforces_1678B2 { public static void main(String[] args) throws IOException { Scanner scanne...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3 2\n0 3\n0 1\n0 1\n3 1"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively, the number of subsegments of it is $$$2$$$. There a...
Java 17
standard input
[ "dp", "greedy", "implementation" ]
8c7844673f2030371cbc0cb19ab99b35
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
1,800
For each test case, print a single line with two integers — the minimum number of operations to make $$$s$$$ good, and the minimum number of subsegments that $$$s$$$ can be divided into among all solutions with the minimum number of operations.
standard output
PASSED
a065d3512f41f527eadd42dcc1a9a042
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int t = Integer.parseInt(br.readLine()); while(t-->0){ Strin...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
b38c0c2af7f1dcb9ac47dcd6fc232a9e
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int t = Integer.parseInt(br.readLine()); while(t-->0){ Strin...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
aa4217b4b94e8a7543f5c9fd85cef23e
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { Scanner scn = new Scanner(System.in); int tc = scn.nextInt(); while (tc != 0) { int n = scn.nextInt(); String s = scn.next(); int...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
22b820c9a471ddd29a8ac321e0117b36
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class Main extends PrintWriter { Main() { super(System.out); } static boolean cases = true; // Solution void solve(int t) { int n = sc.nextInt(); char a[] = sc.readCharArray(n); ArrayList<Integer> al = new ArrayList<>(); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
bf6f444e62ce677ffc3d2a4599498d01
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class Main extends PrintWriter { Main() { super(System.out); } static boolean cases = true; // Solution void solve(int t) { int n = sc.nextInt(); char a[] = sc.readCharArray(n); int size = 1; int ans = 0; int ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
1903e0fc0392ca039e129d4317fd9224
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ public static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
ed89d34e291be8e42eebdd08dbccbb8e
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class MyProgram { public static void main(String[] args) throws FileNotFoundException { //Scanner sc = new Scanner(new File("text.txt")); Scanner sc = new Scanner(System.in); int counter = sc.nextInt(); for(int i = 0; i < coun...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
3257d98501a8990dd34cee304e9389ef
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.*; public class coding { public static void main(String args[] ) throws Exception { Scanner s...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
d80418a51e714f88efb8749d7cfa41bf
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; /** * BadAndGoodStrings */ public class BadAndGoodStrings { public static List<Integer> divider(String test_case) { List<Integer> res = new ArrayList<>(); int current = -1; int currentLen = 0; ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
f10507449d23b00774172c745dd77fcd
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner obj = new Scanner(System.in); int t = obj.nextInt(); while(t-->0){ int n = obj.nextInt(); String str = obj.next(); int count = 0; ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
c18ee664d488551c9115c510a1ed63fe
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int T = s.nextInt(); for(int t=0;t<T;t++) { String ip; int n, r = 0; n = s.nextInt(); ip = s.next(); for(int i=0;i<n;i+=2) { if(ip.charAt(i+1) == ip.charA...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
e2a63606b833964757bc41f8e23faede
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; public class E { // public static HashMap<Integer, Integer> sortByValue(HashMap<Integer, Integer> hm) // { // // List<Map.Entry<Integer, Integer> > list = // new LinkedList<Map.Entry<Integer, Integer> >(hm.entrySet()); // // Collections.sort(list, new Comparator<Map.Entry<Integer, Integ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
22371aaa890f1434dd2d35b470cdde18
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); for (int i = 0; i < n; i++) { test(sc, p...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
c8a1350e52f21c58bc50f50e2fcc8fd3
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class B2 { static class Scan { private byte[] buf=new byte[1024]; private int index; private InputStream in; private int total; public Scan() { in=System.in; } public int scan()throws...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
5d61613a37a9f576db86085bb76a2c0d
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class ProgramJava { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int m = 1; m<=T; m++){ int n = sc.nextInt(); String str = sc....
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
fb956b43d162cabd0014710f1b7bf10b
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; import java.io.*; public class practice { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new BufferedWriter(new PrintWriter(System.out))); S...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
1ac8e27a6b7a4142e51a4dfe91835568
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class prefixremoval { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); String s = in.nextLine(); int t = Integer.parseInt(s); StringBuilder ans = new StringBuilder(); ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
3c2bec81fe611122053f78603386a830
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.nio.file.FileAlreadyExistsException; import java.util.*; public class roughCodeforces { public static boolean isok(long x, long h, long k){ long sum = 0; if(h > k){ long t1 = h - k; long t = t1 * k; sum += (k * (k + 1)) / 2; su...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
8235f8a3a6842b35ffad4727d557745d
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.util.*; public class Main { public static <Sting> void main(String args[]) { Scanner sc = new Scanner(System.in); int test = sc.nextInt(); while(test != 0){ int len = sc.nextInt(); String str = sc.next(); ArrayList<Integer> ans = ne...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
6a1dc072833db85e456292fc271ecb56
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
/** * @author egaeus * @mail sebegaeusprogram@gmail.com * @veredict Not sended * @problemId 1678B1 * @problemName Tokitsukaze and Good 01-String (easy version) * @judge http://codeforces.com/ * @category adhoc * @level easy * @date Thu May 12 2022 */ import java.io.*; import static java.lang.Int...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
6f0b06363e90200ec4f1c803132133ea
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ public static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
39ba3847b3a197f80fc93bb88db818ce
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int mod = (int)1e9+7; static boolean[] prime = new boolean[1]; static int[][] dir1 = new int[][] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; static int[][] dir2 = new int[][] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
968dcb8b4b3e85c8b766222880e42b23
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int mod = (int)1e9+7; static boolean[] prime = new boolean[1]; static int[][] dir1 = new int[][] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; static int[][] dir2 = new int[][] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
a6ec05f79dbac56b728ec0eff6146ca2
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.util.stream.IntStream; import java.util.stream.Stream; public class Main { public static void main(String[] args) { in = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); try { ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output
PASSED
2bdfc8a7ce63b1bfc0515ff2c3460096
train_108.jsonl
1652020500
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even.Now Tokitsukaze divides $$$s$$$ into the mi...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.util.stream.IntStream; import java.util.stream.Stream; public class Main { public static void main(String[] args) { in = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); try { ...
Java
["5\n10\n1110011000\n8\n11001111\n2\n00\n2\n11\n6\n100110"]
1 second
["3\n0\n0\n0\n3"]
NoteIn the first test case, one of the ways to make $$$s$$$ good is the following.Change $$$s_3$$$, $$$s_6$$$ and $$$s_7$$$ to '0', after that $$$s$$$ becomes "1100000000", it can be divided into "11" and "00000000", which lengths are $$$2$$$ and $$$8$$$ respectively. There are other ways to operate $$$3$$$ times to ma...
Java 11
standard input
[ "implementation" ]
aded139ff4d3f313f8e4d81559760f12
The first contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 10\,000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^5$$$) — the length of $$$s$$$, it is guaranteed that $$$n$$$ is even. The second line contains a binary string ...
800
For each test case, print a single line with one integer — the minimum number of operations to make $$$s$$$ good.
standard output