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
56ca7d6b26115533bca1903b6ae14fed
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.Arrays; public class B { static BufferedReader ins = new BufferedReader(new InputStreamReader(System.in)); static StreamTokenizer in = new StreamTokenizer(ins); static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); static int[] a = new i...
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 8
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
8d47413d8d13d0a1bad20121bacaf550
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.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B1_Tokitsukaze_and_Good_01_String_easy_version { static Scanner in = new Scanner(); static PrintWriter out = new PrintWriter(Sy...
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 8
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
7e29430449b976b3dfb01c0d534c0a27
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 Solution{ public static void main(String[] args) throws IOException { BufferedReader re = new BufferedReader(new InputStreamReader(System.in)); int testCase = Integer.parseInt(re.readLine()); StringBuilder ans = new...
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 8
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
f10b37b391bc1dbd7932e1e03319b932
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 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\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 8
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
acde84c7ef989fcadb04268da7521ef0
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.math.BigInteger; import java.util.*; import java.util.function.BinaryOperator; import java.util.stream.Collectors; public class Main { private final static long mod = 1000000007; private final static int MAXN = 1000001; private static long power(long x, long...
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 8
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
0937055a4b6f4a98b0ad5203bf5e61e2
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
// Online Java Compiler // Use this editor to write, compile and run your Java code online import java.util.*; public class HelloWorld { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t--!=0){ int n=sc.nextInt(); ...
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 8
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
1ec11a0c0404fcd05576f2b3e42cf086
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.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Random; import java.util.Stack; import java....
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 8
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
ab454c594abfefd319cad0876c6aaed8
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 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\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 8
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
d145ec06eac06d170942e2301cc477e1
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.IOException; import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.InputMismatchException; import java.util.List; public class TokitsukazeandGood { static InputReader inputReader=new InputReader(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 8
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
fbc7c40136af3ea32c6b31828662565c
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.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\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 8
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
29014fbf5f339cbd2956e67c486568a8
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.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\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 8
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
56901968c25d07c0f81fa774f364b399
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 k { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt...
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 8
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
9c367bffe7bd6aa56a3ab1214ec80a82
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 main2{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int count = 0;count<t;count++){ int n = sc.nextInt(); sc.nextLine(); String s = sc.nextLine(); boolean h = true; 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 8
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
f1410578f60ef129877a7af601304adb
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 { static PrintWriter pw; static Scanner sc; static pair[][] memo; static int end; static ArrayList<Integer> size; static int inf = (int) 1e9; static int get(int st) { return st == 2 ? -1 : st; } static pair dp(int st, int i) { if (i ==...
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 8
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
3e6184c2869814e7cebcbf6af6159b1e
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 { //--------------------------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\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 8
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
e4d1547a130727c7bb3fde9fd29b49f1
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 { //--------------------------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\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 8
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
e753860d84ea1a105125f91fda2b1777
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.InputStreamReader; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.*; public class Codeforces { static long mod= 10000_0000_7; static int dp[][]; public static void main(String[] args) throws Excepti...
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 8
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
cfdad86591e613156b16d3012d894833
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.InputStreamReader; import java.util.Scanner; import java.util.*; import java.lang.Math; import java.util.StringTokenizer; public class B { public static void main(String[] args){ int b, t; char a[]; String 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 8
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
355ff5d6cd3221e05cbf4217936329ca
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.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import static java.lang.System.out; public class pre54 { static class FastReader { BufferedReader br; StringTokenizer st; public FastR...
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 8
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
af0fa38d2fa2406a977e870eac235462
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.lang.*; import java.io.InputStreamReader; import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java.math.BigInteger; pu...
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 8
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
c043fe4375b6569549b93d00d2cfe4a7
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.lang.*; import java.io.InputStreamReader; import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java.math.BigInteger; pu...
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 8
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
9a11af0c12b3cfbf2da69bcce5edd5aa
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.ArrayList; import java.util.List; import java.util.StringTokenizer; public class Template { private static StringTokenizer st; private static BufferedReader br; private static PrintWriter pw; public static void main(String[] args) throws IOException { ...
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 8
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
4003c42343dab03d063dc6b08ac3adcb
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 B1_1678 { public static void main(String[] args) { /* * 1 14 10011011001001 */ FastReader sc = new FastReader(); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); ...
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 8
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
872041138e6dc08fb8d8908ad1e15999
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 TokitsukazeAndGood01StringEasyVersion { 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\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 8
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
76decf1812b0b139b6ce722609d72a4e
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
// letsgoooooooooooooooooooooooooooooooo import java.util.*; import java.io.*; public class Solution{ static int MOD=1000000007; static PrintWriter pw; static FastReader sc; static class FastReader { BufferedReader br; StringTokenizer st; public FastR...
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 8
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
77a7753571f78f6c780fb88d80e1cc6f
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(); sol...
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 8
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
bbffb6173a69d7323914f3a958e0c183
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
//package com.company; import java.util.*; public class Practice { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { int n = sc.nextInt(); String s = sc.next(); char[] arr = s.toCh...
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 8
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
3b2f46293126959609bb315142358ef2
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.InputStreamReader; import java.io.PrintWriter; public class B2 { public static void main(String[] args) throws IOException { BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(System...
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 8
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
30b6996f1eee12a07a971b65839f2f1c
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 static java.lang.System.out; public class app { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n=sc.nextInt(); String s=sc.next(); ArrayLis...
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 8
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
408d5585c2d44039aeb6360eb8c39803
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.*; public class tr1 { static PrintWriter out; static StringBuilder sb; static long mod = 998244353; static int m, id, c; static ArrayList<int[]>[] ad; static HashMap<Integer, Integer>[] going; static long inf = Long.MAX_VALUE; sta...
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 8
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
07866ea355803194bb9cb2b037a2e05b
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.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\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 8
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
d44cc55d11d09efe6e8f03a4802ddbcc
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 implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args) { new Thread(null, new Main(), "", 256 * (1L << 20)).start(); } public ...
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 8
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
5d6aea65adca80bb8edb619b466fce72
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 static java.lang.Math.*; import static java.util.Map.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.lang.System.*; public class Main { public void tq() throws Exception { st=new StringTokenizer(bq.rea...
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 8
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
ab31cb0ac2eacc667f9f6ab6694bf358
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 { 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); int t = Integer.parse...
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 8
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
d5d79a3163d28a01af5d2a65235c48bb
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.ArrayList; import java.util.List; public class MainB { public static void main(String[] args) throws IOException { // System.setIn(new FileInputStream("input.txt")); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.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 8
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
20b409eedeb86298bc4d921cde9a57a9
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.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws IOExce...
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 8
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
b9a263b28d07d9da9453e504ae0cf1a1
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.invoke.ConstantBootstraps; // import java.math.BigInteger; // import java.beans.IndexedPropertyChangeEvent; import java.io.*; @SuppressWarnings("unchecked") public class Main implements Runnable { static FastReader in; static PrintWriter out; static int b...
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 8
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
2df021ec0b2783bc4cd8b6a0c4371521
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 { static Scanner sc; static PrintWriter pw; public static void main(String[] args) throws IOException { sc = new Scanner(System.in); pw = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); cha...
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 8
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
b3f82bba206f20563a2777d6cca364ee
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.math.BigInteger; import java.util.*; import java.io.*; public class Vaibhav { static long bit[]; static boolean prime[]; static class Pair implements Comparable<Pair> { long x; int y; Pair(long x, int y) { this.x = x; this.y ...
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 8
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
e2de77926808afb528767ba0d4caf170
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
//package kg.my_algorithms.Codeforces; import java.io.*; import java.util.*; /* */ public class Solution { public static void main(String[] args) throws IOException { BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out)); FastReader fr = new FastReader(); ...
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 8
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
58c18afdc0051470041750c7a40612a0
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.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.StringTokenizer; public class Tokitsukaze_and_Good_01String_easy_version { static class Reader { final private int BUFFER_SIZE = 1 << 16; ...
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 8
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
97bfe76565cdb1699f9eaa55d41599f4
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
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java.util.Arrays; /* 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 { // ...
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 8
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
57fa633ea63c55d557cba4ecc66b7b27
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.Arrays; import java.util.Scanner; public class Main { public static int[] arr = new int[1000000]; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t>0) { int n = scanner.nextI...
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 8
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
a43a763f7973d5a9d56d23ecf3d4a4a3
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 sc = new Scanner(System.in); int testCount = Integer.parseInt(sc.nextLine()); int[] result = new int[testCount]; for (int i = 0; i < testCount; i++) { int stringLen = Integer.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 8
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
6c8a917119cdb0eb61f79950cd69cb89
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) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt();//用例个数 while(n!=0){ int ans = 0; int len=sc.nextInt();//s长度 String s=sc.next(); for (int i = 0; i < len-1; i++) { ...
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 8
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
18c8952c640152b823782b1659da68b1
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 GoodString { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-->0){ int n = in.nextInt(); String s = in.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 8
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
565a5f2b775411e212b910d655f697c5
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
/* 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\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 8
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
18ddf94e5dfeea972528ea8b6a77d47f
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.*; 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\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 8
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
1967c93b8cd1bc001dea0e6f70ecc750
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 Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(System.out); int t=Integer.parseInt(br.readLine()); while(t-->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 8
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
ee197a80f6bf975773952da3cd81ca67
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.InputStreamReader; import java.util.*; public class Main { public static void main(String args[]) { FastScanner input = new FastScanner(); int tc = input.nextInt(); work: while (tc-- > 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 8
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
9c646fdbaa169e93adc295b655168d42
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.io.Writer; impo...
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 8
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
9b36c7f60b0d811c38b89cf8af70e175
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
//package com.company; import java.util.*; import java.io.*; public class TokitsukazeEasy { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while(--t >= 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 8
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
05e0e58ac8230e2c525d5dcb49e08781
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is a...
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 8
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
1869bd5642a8f2eecef91b32e803ef57
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 B { private static FastReader fr; private static OutputStream out; private static int mod = (int)(1e9+7); private void solve() { int t = fr.nextInt(); while(t-- > 0) { int n = fr.nextInt(...
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 8
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
ea40962a1489dfe06d00008e1ff8d3d5
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 GoodString{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = Integer.parseInt(sc.nextLine()); for(int i = 0 ; i < t ; i++) { int len = Integer.parseInt(sc.nextLine()); String num = sc.nextLine(); ...
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 8
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
767641e19093fe6d34768f18fdb4b9a4
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 sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { int n = sc.nextInt(), cnt = 0; char c[] = sc.next().toCharArray(); for(int i=0; i<c.length; i+=2) if(c[i] != c[i+1]) cnt+...
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 8
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
a2f008a7efba09fd28c496abde8fca66
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; //1。Tokitsukaze and Good 01-String (简易版) //1110111000 //(3 1) (2 0) (2 1) (3 0) public class Tokit { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); for (int i = 0; i < n; i++) { int x=scan.nextInt(); String s=scan.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 8
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
9b266579ea22c4d4a0926a4ed09c2d02
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 _1678B1 { FastScanner scn; PrintWriter w; PrintStream fs; int MOD = 1000000007; int MAX = 200005; long mul(long x, long y) {long res = x * y; return (res >= MOD ? res % MOD : res);} long power(long x, long y) {if (y < 0) return...
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 8
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
6c770f6cd9cf3f8af1fe9e59b08b804b
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
// Problem: B1. Tokitsukaze and Good 01-String (easy version) // Contest: Codeforces - Codeforces Round #789 (Div. 2) // URL: https://codeforces.com/contest/1678/problem/B1 // Memory Limit: 256 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org) import java.util.*; public class My_t...
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 8
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
acbe5f60690d121f9fec715976ba6ba9
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
// * * * 2100 * * * // import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class A { static class Pair { int x; int y; Pair(int x, int y) { this.x = x; this.y = y; } ...
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 8
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
76f81f6a0dc44b8800b59fc2c6459662
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.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Priorit...
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 8
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
76eddbf16d5dee442b316cdde0cfee44
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.*; 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\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 8
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
2775928fb412b67ef6dbe009b69f5627
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 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\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 8
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
765a1d582d45ab95e0dd032fa4f9be49
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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; import java.uti...
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 8
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
8d4244912c49c8f6d1def41e0242b89d
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.InputStreamReader; import java.util.StringTokenizer; public class GoodStringEasy { public static void main(String[] args) { FastReader in = new FastReader(); int t = in.nextInt(); for (int i = 0; i < t;...
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 8
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
79d19cb6ced429aac665f221215bf18f
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; /** * @Author LWX * @date 2022/5/11 21:43 */ public class Tokitsukaze_and_Good_01_String_easy_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\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 8
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
0c5c047ed129b8c28ca5f008071be695
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 B1_1678 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t=0; t<T; t++) { in.nextInt(); char[] S = (in.next() + ' ').toCharArray(); int answer ...
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 8
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
3c6ec352e9ec93fec4775a96455c246d
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
//package december; import java.util.*; import java.io.*; public class codeforces1678B { public static void main (String [] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int numCases = Integer.parseInt(br.readLine()); for (int rep = 0; rep<numCases...
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 8
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
42d5d8efb4019766274a67643a9cc241
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 scanner = new Scanner(System.in); int t = scanner.nextInt(); for(int i = 0; i < t; i++){ int n = scanner.nextInt(); String s = scanner.next(); System.o...
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 8
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
a0cd5729beb992c833c3ee02147dbcd8
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 Five { private static int find(String s) { List<Integer> res = new ArrayList<>(); int cnt=1; for(int i=1;i<s.length();i++) { if(s.charAt(i)==s.charAt(i-1)) cnt++; else { ...
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 8
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
78dc027ff5783242b329823fa4c6e79e
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
//package com.company; import java.awt.*; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.net.InetAddress; import java.text.CollationKey; import java.util.*; public class Main implements Runnable { int size[]; static int e9 = 1000000007; int max ...
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 8
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
328edaab4929a2945ad2239256a1f585
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; public class ProblemB { public static void solve(Scanner sc) { int n = sc.nextInt(); sc.nextLine(); String s = sc.nextLine(); List<Integer> list = new ArrayList<>(); int cntOfContiStr = 0; for (int i = 0; i < n - 1; i+...
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 8
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
44b15243abedadf758dd0cbcce89a6fb
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
/* !!!!Hello World,Prakhar here!!!! codechef handle prakhar_3011 codeforces handle prakhar_30 trying to get good at CP PEACE OUT......... */ /* 11 10 01 10 00 */ import java.io.*; import java.util.*; public class goodstring { public static void main(String[] args) { FastScanner 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 8
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
41bed42171a990fbb47b83c56f9e7f7b
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 out = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); char[] c = sc.next().toCharArray(...
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 8
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
eaba3c2907e820d9efb474fe76aa611c
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
//package Div2.B; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class TokitsukazeAndGood01StringEasy { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader...
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 8
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
78d6bda0827386a464778fb2a2de0306
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) { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); int T = in.nextInt(); for(int ttt = 1; ttt <= T; ttt++) { int n = in.nextInt(); ...
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 8
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
69aa220b27cfc3106f9506a4ff2b8b57
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.awt.datatransfer.StringSelection; import java.util.*; import javax.management.Query; import java.io.*; public class practice { static String s; static int n,k; static int[] a; static long[][] memo; static HashMap<Long,Integer>hm; public static void main(String[] args) ...
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 8
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
9d8da834da3786c9194c45aabec92d36
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.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B1_Tokitsukaze_and_Good_01_String_easy_version { static Scanner in = new Scanner(); static PrintWriter out = new PrintWriter(Sy...
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 8
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
47bba199bff717ca57539fb93b647805
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 CF_1678B1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); char s[] = sc.next().toCharArray(); int ans =0; for(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 8
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
24a20a6510138e3213f533656642c52a
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.IOException; import java.io.InputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.util.*; import static java.util.Arrays.*; public class CodeforcesTemp { public static void main(String[] args) throws IOException { ...
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 8
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
3a3c0c0f236533064bd2b53e5d39f083
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 sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); String s = sc.next(); List<Integer> list = 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 8
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
5d3e6d947f2b573ed3d5be24a5ae9c37
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 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\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 8
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
f4bb70b3443abb1cc1c08f1e8b117786
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 codeMaster { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int tc = sc.nextInt(); while(tc-->0){ int n = sc.nextIn...
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 8
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
5d86be94dc404bddf240a20b6be77a58
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.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\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 8
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
a25b6dcb79cebc4bcc7700883d8e2779
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
/** * @Jai_Bajrang_Bali * @Har_Har_Mahadev */ /* Created by IntelliJ IDEA. * Author: Sanat Kumar Dubey (sanat04) * Date: 02-05-2022 * Time: 19:43 * File: B.java */ import java.util.Scanner; public class B { public static void main(String[] args) { Scanner sc = new Scan...
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 8
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
39e759b193fb54984e1228d7f0dab186
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
// package faltu; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.Map.Entry; public class Main { public static int upperBound(long[] arr, long m, int l, int r) { while(l<=r) { int mid=(l+r)/2; if(arr[mi...
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 8
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
1d5c05f53563e2db20ec52808dc1bce7
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 B1{ public static int solve(String str){ ArrayList<Integer> arr=new ArrayList<>(); int count=1; for(int i=0;i<str.length()-1;i++){ char ch1=str.charAt(i); char ch2=str.charAt(i+1); if(ch1!=ch2){ ...
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 8
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
54a95b0614423cab91315a29c3522ca4
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 test { public static void main(String[] args) { Scanner scn=new Scanner(System.in); int n=scn.nextInt(); while(n>0){ int len=scn.nextInt(); String str=scn.next(); char[] arr=new char[len]; ...
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 8
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
cf9fb66f7322cd437136c5a377cfeea4
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) { // write your code here Scanner in = new Scanner(System.in); while (in.hasNext()) { int n = in.nextInt(); for (int i = 0; i < n; i++) { int m = in.nextInt();...
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 8
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
01e3730305113d170b08e8c7c3c92996
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 Solution{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String str; int t, row, ops; char last; for(int i = 0; i < n; i++){ t = sc.nextInt(); sc.nex...
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 8
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
45c0fe0f5e6b677dd6d4b2a56637a51d
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 forces { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int flag = 1; // int n = sc.nextInt(); int n = sc.nextInt(); String str =...
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 8
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
fb1993d73a822f06715b87a162e72d7d
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
/* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template */ import java.lang.invoke.MethodHandles; import java.util.Scanner; import javax.swing.text.PasswordView; import ja...
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 8
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
81cea9a08fe16dfcb0a7466075b21547
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 { 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\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 8
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
c096b1b8c6d96c6397703288035aabe4
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.*; import static java.lang.Math.*; import static java.lang.System.out; public class Main { static class Reader{ BufferedReader br; StringTokenizer st; public Reader(boolean f) throws IOException{ if(f) { ...
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 8
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
f08ae876ec05b0553b42631cea1a1039
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
//CP-MASS import java.util.*; import java.io.*; public class Codechef{ static FastReader in=new FastReader(); static final Random random=new Random(); static long mod=1000000007L; static HashMap<String,Integer>map=new HashMap<>(); public static void main(String args[]) throws IO...
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 8
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
71fd48abacae88905aa6194c5a091ea4
train_108.jsonl
1652020500
Tokitsukaze has a sequence $$$a$$$ of length $$$n$$$. For each operation, she selects two numbers $$$a_i$$$ and $$$a_j$$$ ($$$i \ne j$$$; $$$1 \leq i,j \leq n$$$). If $$$a_i = a_j$$$, change one of them to $$$0$$$. Otherwise change both of them to $$$\min(a_i, a_j)$$$. Tokitsukaze wants to know the minimum number of...
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
["3\n3\n1 2 3\n3\n1 2 2\n3\n1 2 0"]
1 second
["4\n3\n2"]
NoteIn the first test case, one of the possible ways to change all numbers in the sequence to $$$0$$$:In the $$$1$$$-st operation, $$$a_1 &lt; a_2$$$, after the operation, $$$a_2 = a_1 = 1$$$. Now the sequence $$$a$$$ is $$$[1,1,3]$$$.In the $$$2$$$-nd operation, $$$a_1 = a_2 = 1$$$, after the operation, $$$a_1 = 0$$$....
Java 11
standard input
[ "implementation" ]
ad242f98f1c8eb8d30789ec672fc95a0
The first line contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the length of the sequence $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
800
For each test case, print a single integer — the minimum number of operations to change all numbers in the sequence to $$$0$$$.
standard output
PASSED
51b46caa66a0398d07c4e44f3a2f2ae2
train_108.jsonl
1652020500
Tokitsukaze has a sequence $$$a$$$ of length $$$n$$$. For each operation, she selects two numbers $$$a_i$$$ and $$$a_j$$$ ($$$i \ne j$$$; $$$1 \leq i,j \leq n$$$). If $$$a_i = a_j$$$, change one of them to $$$0$$$. Otherwise change both of them to $$$\min(a_i, a_j)$$$. Tokitsukaze wants to know the minimum number of...
256 megabytes
import java.util.*; import java.lang.*; public class Main{ public static String s; public static int n; public static void main(String args[]){ Scanner inp=new Scanner(System.in); int t=inp.nextInt(); for(int i=0;i<t;i++){ int count=0,a=0,b=0,coun=0; /*n=in...
Java
["3\n3\n1 2 3\n3\n1 2 2\n3\n1 2 0"]
1 second
["4\n3\n2"]
NoteIn the first test case, one of the possible ways to change all numbers in the sequence to $$$0$$$:In the $$$1$$$-st operation, $$$a_1 &lt; a_2$$$, after the operation, $$$a_2 = a_1 = 1$$$. Now the sequence $$$a$$$ is $$$[1,1,3]$$$.In the $$$2$$$-nd operation, $$$a_1 = a_2 = 1$$$, after the operation, $$$a_1 = 0$$$....
Java 11
standard input
[ "implementation" ]
ad242f98f1c8eb8d30789ec672fc95a0
The first line contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the length of the sequence $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
800
For each test case, print a single integer — the minimum number of operations to change all numbers in the sequence to $$$0$$$.
standard output
PASSED
713995cf2b5cef522cb67ed03492a860
train_108.jsonl
1652020500
Tokitsukaze has a sequence $$$a$$$ of length $$$n$$$. For each operation, she selects two numbers $$$a_i$$$ and $$$a_j$$$ ($$$i \ne j$$$; $$$1 \leq i,j \leq n$$$). If $$$a_i = a_j$$$, change one of them to $$$0$$$. Otherwise change both of them to $$$\min(a_i, a_j)$$$. Tokitsukaze wants to know the minimum number of...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class ContestAns{ public static void main(String[] args){ Scanner scin = new Scanner(System.in); int t = scin.nextInt(); while (t-->0){ int times = scin.nextInt(); int[] a = new int[times]; ...
Java
["3\n3\n1 2 3\n3\n1 2 2\n3\n1 2 0"]
1 second
["4\n3\n2"]
NoteIn the first test case, one of the possible ways to change all numbers in the sequence to $$$0$$$:In the $$$1$$$-st operation, $$$a_1 &lt; a_2$$$, after the operation, $$$a_2 = a_1 = 1$$$. Now the sequence $$$a$$$ is $$$[1,1,3]$$$.In the $$$2$$$-nd operation, $$$a_1 = a_2 = 1$$$, after the operation, $$$a_1 = 0$$$....
Java 11
standard input
[ "implementation" ]
ad242f98f1c8eb8d30789ec672fc95a0
The first line contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the length of the sequence $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
800
For each test case, print a single integer — the minimum number of operations to change all numbers in the sequence to $$$0$$$.
standard output
PASSED
9727a0c10d5a0672a4fa455939c4bcfd
train_108.jsonl
1652020500
Tokitsukaze has a sequence $$$a$$$ of length $$$n$$$. For each operation, she selects two numbers $$$a_i$$$ and $$$a_j$$$ ($$$i \ne j$$$; $$$1 \leq i,j \leq n$$$). If $$$a_i = a_j$$$, change one of them to $$$0$$$. Otherwise change both of them to $$$\min(a_i, a_j)$$$. Tokitsukaze wants to know the minimum number of...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class ContestAns { public static void main(String[] koolProgrammer){ Scanner scin = new Scanner(System.in); int t = scin.nextInt(); while (t-->0){ int times = scin.nextInt(); int[] a = new int[times...
Java
["3\n3\n1 2 3\n3\n1 2 2\n3\n1 2 0"]
1 second
["4\n3\n2"]
NoteIn the first test case, one of the possible ways to change all numbers in the sequence to $$$0$$$:In the $$$1$$$-st operation, $$$a_1 &lt; a_2$$$, after the operation, $$$a_2 = a_1 = 1$$$. Now the sequence $$$a$$$ is $$$[1,1,3]$$$.In the $$$2$$$-nd operation, $$$a_1 = a_2 = 1$$$, after the operation, $$$a_1 = 0$$$....
Java 11
standard input
[ "implementation" ]
ad242f98f1c8eb8d30789ec672fc95a0
The first line contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the length of the sequence $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
800
For each test case, print a single integer — the minimum number of operations to change all numbers in the sequence to $$$0$$$.
standard output
PASSED
9d5ae94fe93ac1f1e636be1b49377851
train_108.jsonl
1652020500
Tokitsukaze has a sequence $$$a$$$ of length $$$n$$$. For each operation, she selects two numbers $$$a_i$$$ and $$$a_j$$$ ($$$i \ne j$$$; $$$1 \leq i,j \leq n$$$). If $$$a_i = a_j$$$, change one of them to $$$0$$$. Otherwise change both of them to $$$\min(a_i, a_j)$$$. Tokitsukaze wants to know the minimum number of...
256 megabytes
//package javaapplication1; import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int t = in.nextInt(); // Scanner has functions to read ints, longs, strings, chars,...
Java
["3\n3\n1 2 3\n3\n1 2 2\n3\n1 2 0"]
1 second
["4\n3\n2"]
NoteIn the first test case, one of the possible ways to change all numbers in the sequence to $$$0$$$:In the $$$1$$$-st operation, $$$a_1 &lt; a_2$$$, after the operation, $$$a_2 = a_1 = 1$$$. Now the sequence $$$a$$$ is $$$[1,1,3]$$$.In the $$$2$$$-nd operation, $$$a_1 = a_2 = 1$$$, after the operation, $$$a_1 = 0$$$....
Java 11
standard input
[ "implementation" ]
ad242f98f1c8eb8d30789ec672fc95a0
The first line contains a single positive integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. For each test case, the first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 100$$$) — the length of the sequence $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$...
800
For each test case, print a single integer — the minimum number of operations to change all numbers in the sequence to $$$0$$$.
standard output