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
a3dfb1ce88741e3d9dd08f181455a512
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.*; import java.util.*; /** * Created by imahmoud on 5/13/17. */ public class C { static class Writer { private DataOutputStream dataOut; public Writer(){ PrintStream out = new PrintStream( System.out ); dataOut = new DataOutputStream(out); } ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 < ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
e24ab15fa42efd4e4a7c6ef84eb7412a
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main (String[] args) throws java.lang.Exception { Output out = new Output(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; st = new StringTokenizer(br.readLi...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 < ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
bb33e0956591b8b6eee8fa72de66a36b
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList;...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 < ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
21447af328a3d788c4fef33504f041ad
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import ja...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 < ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
720d9d0d60afdc1b6ca6aa58054d83bc
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Stri...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 < ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
44a958fd04b6bcf9cca6c0ea2c6e786c
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import javax.smartcardio.CommandAPDU; import java.io.* ; import java.lang.reflect.Array; import java.util.* ; import java.math.* ; public class Main { static BufferedReader reader; static StringTokenizer tokenizer; static void init(InputStream input) { reader = new BufferedReader(new InputStrea...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 < ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
7fde511ba8c60cd5fcf8c7a626b3c21c
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 < ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
f02639a391265d0c51da2de94e35c258
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.HashMap; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; i...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 < ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
1f1b2bfd74d9578d153338fe946a6ecb
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.TreeMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.i...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 < ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
59b684e627371b70cd7373c3b8f45c11
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); PrintWriter pw=new PrintWriter (System.out); int n=sc.nextInt(); Integer[]a=new Integer[n]; TreeSet<Integer> set=new TreeSet(); for(int i=0;i<n;i++...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
e9a19cc1bc303555f5bf373f0c79c4dc
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.util.regex.*; public class Aim4c { static Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in))); static Reader fastInput = new Reader(); public static void main(String[] args) throws IOException { in...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
edec3714323e3f2c75ba182433c38d3b
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.*; import java.util.*; public class Major { static boolean visited[]; static int pos[]; static int cnt; static StringBuilder var; static void dfs(int idx){ visited[idx] = true; ++cnt; var.append(idx + " "); if(visited[pos[idx]])return; else dfs...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
72f0eae9f9c85e7d0360b2bd7b651d4e
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.*; import java.util.*; public class Major { static boolean visited[]; static int pos[]; static int cnt; static StringBuilder var; static void dfs(int idx){ visited[idx] = true; ++cnt; var.append(idx + " "); if(visited[pos[idx]])return; else dfs...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
4fe1bc4229c943ddec971383becb086d
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() throws FileNotFoundException { boolean test=false; In...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
8b4be1611efdf96517fcaa4258d24b0a
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
/* * DA-IICT * Author: Jugal Kalal */ import java.util.*; import java.io.*; import java.math.*; public class Hackerearth{ static long mod=(long)Math.pow(10,9)+7l; public static void main(String args[]) { new Thread(null, new Runnable() { public void run() { try{ ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
072a276fbcbff5a25f9d61447d88a9b9
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; /** * http://codeforces.com/problemset/problem/844/C */ public class SortSub { InputStream is; PrintWriter out; String INPUT = ""; long mod = 1000000007; ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
f6fc8b9b5e1ce90f4728c7e958b8bf25
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; import java.util.StringTokeni...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
ea1fc4b3cf8caf5360b5e5f93ee8300c
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.Arrays; import java.util.Random; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.u...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
c162e83809a5e924390c42a782b0b87c
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.util.*; import java.awt.List; import java.io.*; import java.lang.*; public class code1 { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(System.out); //Code starts.. int n = in.nextInt(); int[] a...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
7d35e8d6fb34d61feb7dedd2c7ae08e2
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.lang.reflect.Array; import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class main implements Runnable { static ArrayList<Integer> adj[]; ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
461e2512582c0a5a682b2dea4fceca13
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.List; import java.util.InputMismatchException; import java.io.IOException; import java.util.Comparator; import java.io.InputStream; import java.util.ArrayList; /** ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
1001d4e7d48521715c92ff7aab2dd632
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); HashMap<Integer, Integer> original = new HashMap<Integer, Integer>(); int[] a = new int[n]; for (int i = 0; i < n; i++) ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
076d921e42bb37ec4d56e517697c6362
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
/** * Date: 14 Mar, 2018 * Link : * * @author Prasad-Chaudhari * @email prasadc8897@gmail.com */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; public class New_File_3 { public static void main (String[] ar...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
3115be85344138969932111b8efea0e6
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.Writer; im...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
9beea1a56b95ab9f75b933e3420cf9ab
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.*; import java.util.*; public class problem { static Node node[]; static boolean visited[]; static List<List<Integer>> allList = new LinkedList<>(); static List<Integer> list = new LinkedList<>(); static class Node { List<Integer> next = new LinkedList<>(); } static v...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
d33df59781f13bd8b25cc5c419c0f0fc
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.util.*; import java.io.*; public class C { Reader in; PrintWriter out; int i = 0, j = 0; void solve() { //START// int n = in.nextInt(); int[] arr = new int[n]; int[] arrOrder = new int[n]; int[] order = new int[n]; boolean[] don...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
6236bc00440691d7c184ab371b0bedb8
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.math.BigInteger; import java.util.StringTokenizer; import java.util.*; import java.io.*; public class Wtf { public static void main(String[] args) throws IOException { Ifmo ifmo = new Ifmo(); } } class Ifmo { ArrayList<Integer> Graph[]; int n, l, m, timer; char[][] field; ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
ab7201e5b5439b76184519c923b4e81b
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
/* * * @Author Ajudiya_13(Bhargav Girdharbhai Ajudiya) * Dhirubhai Ambani Institute of Information And Communication Technology * */ import java.util.*; import java.io.*; import java.lang.*; public class Code210 { public static int max = 1000005; public static TreeSet<Integer> visited = new TreeSet<>(); ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
03f8f714a6206be2a1b505e37e1e3da1
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Solution { InputReader in; PrintWriter out; public Solution() { in = new InputReader(System.in); out = new PrintWriter(System.out); solve(); out.close(); } // Start of Solution public void s...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
720f7d759a18fac7350f5acf5c1ce948
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import javafx.util.Pair; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.*; import static java.util.Collections.sort; public class Solution { private FastScanner in; private PrintWriter out; ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
893bed662db00e4cfdf40d05828fc51d
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.io.BufferedReader; impo...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
c60cef35f3286667ff62dbc6959fdf25
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
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.Scanner; public class AIMR4C { public static void main(String[] args) throws IOException { Buffere...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
af0eeed31c400126f0f66ad7919c1d73
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Map; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
4c8f2c24a4873ef3d027db68fe46479b
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; 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.StringTokenizer; public class C_AIM_Round_4_Div2 { public sta...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
c7d0d2d0a928d027df042fb70113906c
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
ae425b3a27328e82deda12685f4cfd70
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
//package leto; import java.io.*; import java.util.*; import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class force_education_2 { FastScanner in; PrintWriter out; static ArrayList<Integer>[] gr, ans; static int[] a, cnt; static ArrayList<Integer> del; static int maxN = 1...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
c8aeaaf7cc21780cb425878c886c4b06
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); HashMap<Integer, Integer> original = new HashMap<Integer, Integer>(); int[] a = new int[n]; for (int i = 0; i < n; i++) { ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
789c73402391b650a70bad452b30950d
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; /* public class _844C ...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
da16a72e4c78457f8165d866ebba95e7
train_003.jsonl
1503592500
You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.Sorting integers in a subsequence is a...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class Main{ //SOLUTION BEGIN //Into the Hardware Mode void pre() throws Exception{} void solve(int TC) throws Exception{ int n = ni(); long[] a = new long[n]; TreeSet<Long> s = new TreeSet<>(); for(int i = 0...
Java
["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62"]
1 second
["4\n2 1 3\n1 2\n2 4 6\n1 5", "1\n6 1 2 3 4 5 6"]
NoteIn the first sample output:After sorting the first subsequence we will get sequence 1 2 3 6 5 4.Sorting the second subsequence changes nothing.After sorting the third subsequence we will get sequence 1 2 3 4 5 6.Sorting the last subsequence changes nothing.
Java 8
standard input
[ "dfs and similar", "math" ]
159365b2f037647fbaa656905e6f5252
The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence. The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.
1,400
In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements. In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 &lt; ci ≤ n), then ci integers l1, l2, ..., lci (1...
standard output
PASSED
e20bcfe2490a51eb41cea0f2ac981c62
train_003.jsonl
1387380600
Inna, Dima and Sereja are in one room together. It's cold outside, so Sereja suggested to play a board game called "Babies". The babies playing board is an infinite plane containing n blue babies and m red ones. Each baby is a segment that grows in time. At time moment t the blue baby (x, y) is a blue segment with ends...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; public class E { static int[] Bx, By, Rx, Ry; static int n, m; public static boolean can(int t) { segment[] vert = new segment[n]; segment...
Java
["2 2\n2 2\n5 5\n3 7\n5 1", "3 2\n2 2\n3 2\n6 2\n4 2\n5 2"]
6 seconds
["3", "1"]
null
Java 6
standard input
[ "geometry", "dsu", "implementation", "data structures", "binary search" ]
6ee9ea1c487b349017d9f11a411ccfff
The first line of the input contains two integers n and m (1 ≤ n, m ≤ 2000). Next n lines contain the coordinates of the blue babies. The i-th line contains integers xi, yi — a baby's coordinates. Next m lines contain the coordinates of m red babies in the similar form. All coordinates of the input don't exceed 106 in ...
2,600
In the single line print a single integer — the answer to the problem. If the rectangle never appears on the plane, print "Poor Sereja!" without the quotes.
standard output
PASSED
63c87385425a61211f7002c858bd0e7d
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.Scanner; public class TicketGame { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); int a = 0; int b = 0; int c1 = 0; int c2 = 0; for(int i=0;i<s.length()...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
a7d84a0f2cfaf07be7e90c7d2bc69f06
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.Scanner; public class r585d { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); int slota=0, slotb=0; int suma=0, sumb=0; char[] a=scan.next().toCharArray(); for(int i=0;i<n/2;i++) { if(a[i]=='?') slota++; else suma+=(int)(a[i]-'0...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
2206fa86735b582d1590dbe86ad5b0db
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.*; /** * Built using CHelper plug-in * Actual solution is at the t...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
29d693d0ff571c45af0ccef4a1043636
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
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.io.Writer; import java.io.OutputStream...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
d7451b4a74cb4fead194ea094a2f304d
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Jenish */ public class Ma...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
bbe883dd790e4c911e56e55d763e74cb
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import javafx.util.Pair; import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ Locale.setDefault(Locale.US); //----------------CODE HERE------------------- int n; n = sc.nextInt(); ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
5995fb83b01e0d3ff16d145010c47efb
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.util.Comparator.*; public class Main { FastScanner in; PrintWriter out; ArrayList<Integer>[] graph; ArrayList<GraphPair>[] weightedGraph; ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
33f974b7ff6277827cf64d627c90af8b
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
ec98a44adbf139a6b67019d1e2e975a5
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; import java.io.*; public class codeforces { static class Student{ int x,y; Student(int x,int y){...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
5aade4fc5a620536deb92646ef5d359c
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.Scanner; public class que4 { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); String s = scn.next(); int suml = 0; int cl = 0; int sumr = 0; int cr = 0; for (int i = 0; i < s.length() / 2; i++) { char v = s.charAt(i); if (v ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
b91512156e2bdf1780e444f8fd06ca0d
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.*; import java.util.*; import static jdk.nashorn.internal.objects.Global.print; /** * A simple template for competitive programming problems. */ public class Banana { final InputReader in = new InputReader(System.in); final PrintWriter out = new PrintWriter(System.out); void solve() { ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
67096c0fbd80fa849308a980e7142139
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.*; import java.util.*; public class Main{ static StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out)); static BufferedReader buff=new BufferedReader(new InputStreamReader(System.i...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
370e4d33c298e9bf6efaf924c67f7973
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.*; import org.omg.CORBA.IdentifierHelper; import java.io.*; public class codeforces { public static void main(String[] args) throws Exception { int n=sc.nextInt(); String s=sc.next(); long sum1=0; long sum2=0; int c1=0; int c2=0; for(int i=0;i<n;i++) { if(i<(n+1)/2) { if(s.char...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
cca11eeac56cde0c96163e8c86e1ea6e
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class mainD { public static PrintWriter out = new PrintWriter(System.out); public static FastScanner enter = new FastScanner(System.in); public static void main(String[] args) throws IOException { solve(); out.close(); } ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
595b4f2d4d7c6cfcb843b40f913c05a3
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Solution { static PrintWriter out; static class MyScanner { BufferedReader br; StringTokenizer st; MyScanner(){ br = new BufferedReader(new InputSt...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
4f0abee5072dcea3bd9ce440c6ae1eac
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.Scanner; public class CodeForces1215D { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt() / 2; String s = in.next(); int k = 0; int l = 0; int sum = 0; for (int i = 0; i < s.length(); i++) { ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
c528dc1edde27740e720d5eba3134590
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
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.io.Writer; import java.io.OutputStreamWriter; import java.io.Input...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
ea4f598209470383b27a03e306f0ff22
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Round585Div2D { public static void main(String[] args) { // TODO Auto-generated metho...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
c2bde063239d207bb2756f007221ac5a
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.*; import java.util.*; public class D { static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); static MyScanner sc; static { try { sc = new MyScanner(); } catch (FileNotFoundException e) { e.printStackTrace(); } } ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
89c91f197fcc57c26c2f7ecb567d4cb2
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { static final long MOD = 998244353; //static final long MOD = 1000000007; static boolean[] visited; public static void main(String[] args) throws IOException { FastScanner sc = new FastScanner(); int N = sc.nextInt();...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
da920ea5e28a5f53a80c6223800c25d0
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outp...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
f8f1d2b04181b772af05bd5be2e82981
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** If I'm the sun, you're the moon Because when I go up, you go down ******************************* I'm working for the day I will surpass you https://www.a2oj.com/Ladder16.html */ impor...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
00f13713a80661ab26dd6ca61e93577b
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { Read.init(System.in); int T = 1; // T = Read.nextInt(); while (T != 0) { int n=Read.nextInt(); char []str=Read.next().toCharArray()...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
314a0cc55cdf10d3eb7760e08867fa79
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * @author khokharnikunj8 */ public class Main { public static void main(String[] args) { ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
ed6b49f61d5bdebfd14dd57f44435bed
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.*; import java.util.Random; import java.util.StringTokenizer; public class D { //Solution by Sathvik Kuthuru public static void main(String[] args) { FastReader scan = new FastReader(); PrintWriter out = new PrintWriter(System.out); Task solver = new Task(); int t...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
d4823106987b0d5b4871222ddb651029
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); String str=s.next(); int left=0; int right=0; int suml=0; int sumr=0; for(int i=0;i<n/2;i++) { if(str.charAt(i)=='?') { left++; }...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
c43b1ae8664ccdd5d505e06468dcec0b
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author KharYusuf */ public class ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
6174aa957aad895688dc7b7b39ae0667
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.*; import java.util.*; public class asdf { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); String s = br.readLine(); int leftcount = 0; int rightcount = 0; int leftq...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
86c20522b6b580e6f380e8b40082db11
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.*; import java.io.*; public class CFA { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; private static final long MOD = 1000L * 1000L * 1000L + 7; private static final int[] dx = {0, -1, 0, 1}; private static final int[] dy = {1, 0, -1, 0}; private ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
cce628d2b3f77b180b0c412741412118
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; import java.util.Vector; publi...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
cf0472d9964dbd3f0b239117171bc472
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
49a9706b682bf90432eacc6a6747d48e
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
fa7d7396a1be4829c241d57557f548e4
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
// No sorceries shall previal. // import java.util.Scanner; import java.io.PrintWriter; import java.util.*; import java.util.Arrays; public class InVoker { public static void main(String args[]) { Scanner inp = new Scanner(System.in); PrintWriter out= new PrintWriter(System.o...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
d73aa79d610c8e885430fa66f14e0499
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.awt.geom.*; import static java.lang.Math.*; public class Main implements Runnable { boolean multiiple = false; void solve() throws Exception { int n = sc.nextInt(); int L = 0, R = 0, ml = 0, mr = 0; String s = sc...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
4ed412cb448c1768ceb8262e2bd26e36
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
//package com.company; import java.util.*; public class Main { //static int n; public static void main(String[] args) { // write your code here Scanner s = new Scanner(System.in); int n=s.nextInt(); char []a =s.next().toCharArray();long s1=0;int b1=0;long s2=0;int b2=0;int ans=-1; for(int i=0;i<...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
629c0ab101626d9e2ea2e31e78fba265
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String s = in.next(); int a = 0; int b = 0; int _a = 0; int _b = 0; for (int i = 0; i < n / 2; i++) { ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
2522692a1584b68d0dcd4765c996edc4
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.*; import java.math.*; public class Main { InputStream is; PrintWriter out; String INPUT = ""; //class Declaration static class pair implements Comparable < pair > { long ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
2939e03d198bb1f677be758c4bbeb8c6
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class SepLong { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new Buff...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
0469c3d2e0867a99a0468274cc9729d1
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.InputMismatchException; import java.util.List; public class Main { ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
df12bea4d617abb39e453c8f4cf39ada
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod=1000000007; long gcd(long a,long b) { return b==0?a:gcd(b,a%b);...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
8539281de93289bc7eb5a362a515b487
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.io.*; import java.nio.CharBuffer; import java.util.NoSuchElementException; public class P1215D { public static void main(String[] args) { SimpleScanner scanner = new SimpleScanner(System.in); PrintWriter writer = new PrintWriter(System.out); int n = scanner.nextInt(); ...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
bccb4a6d43a66beaf7467394d3d8841f
train_003.jsonl
1568543700
Monocarp and Bicarp live in Berland, where every bus ticket consists of $$$n$$$ digits ($$$n$$$ is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been erased is even.Monocarp and Bicarp have decided to play a game wit...
256 megabytes
import java.lang.*; import java.util.*; import java.io.*; public class Main { void solve() { int n=ni(); char s[]=ns().toCharArray(); int S1=0,S2=0,c1=0,c2=0; for(int i=1;i<=n;i++){ if(i<=n/2){ if(s[i-1]=='?') c1++; else S1+=s[i-1]...
Java
["4\n0523", "2\n??", "8\n?054??0?", "6\n???00?"]
1 second
["Bicarp", "Bicarp", "Bicarp", "Monocarp"]
NoteSince there is no question mark in the ticket in the first example, the winner is determined before the game even starts, and it is Bicarp.In the second example, Bicarp also wins. After Monocarp chooses an erased digit and replaces it with a new one, Bicap can choose another position with an erased digit and replac...
Java 8
standard input
[ "greedy", "games", "math" ]
028882706ed58b61b4672fc3e76852c4
The first line contains one even integer $$$n$$$ $$$(2 \le n \le 2 \cdot 10^{5})$$$ — the number of digits in the ticket. The second line contains a string of $$$n$$$ digits and "?" characters — the ticket which Monocarp and Bicarp have found. If the $$$i$$$-th character is "?", then the $$$i$$$-th digit is erased. Not...
1,700
If Monocarp wins, print "Monocarp" (without quotes). Otherwise print "Bicarp" (without quotes).
standard output
PASSED
75950dade748d15789e54f35383820dd
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.*; import java.util.*; public class wowFactor { public static long totalW(String str) { long count = 0; for (int i = 0; i < str.length()-1; i++) { if (str.substring(i,i+2).equals("vv")) { count++; } } return count; } public static void main(String[] args) throws IOException { ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
ffe5a670cbd5dbfc1bde417409f378a6
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.*; import java.util.*; import java.nio.file.*; import static java.lang.Math.*; public class B { public static void main(String[] args) throws Exception { String s = s(); int n = s.length(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = s.charAt(i) == 'v' ? 1 : 0; } int[] w =...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
e395e56d55129e0cf7feaff907a316bc
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.math.RoundingMode; import java.security.KeyStore.Entry; import java.text.DecimalFormat; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.net.ssl.SSLContext; public class Main { static long mod=(long)(1e+9 +...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
ef6c82b3964642e101443d9777aab878
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; /** * Built using CHelper plug-in * Actual solution is at the top */ public class WOWFactor { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = n...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
3a7f4b72fafdb25b12033c78fe3dcf2e
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.*; import java.util.*; public class TaskB { void run() { FastReader in = new FastReader(System.in); // FastReader in = new FastReader(new FileInputStream("input.txt")); PrintWriter out = new PrintWriter(System.out); // PrintWriter out = new PrintWriter(new FileOutputSt...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
faa558ceaa2d61e25b72ec6b7ea5f449
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class WOW { public static void main(String[] args) { Scanner nik = new Scanner(System.in); String s = nik.next(); s += 'o'; long c1 = 0; long oc = 0; ArrayList<pair> a1 = new ArrayList<>(); for (int i = 0; i < s.length(); i++) { char c ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
f856f0064c32a62576278ff70f76037b
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { String wow = new Scanner(System.in).nextLine(); long[] cumSum = new long[wow.length()]; cumSum[0] = 0; for (int i = 1; i < wow.length(); i++) { cumSum[i] = cumSum[i - 1]; ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
6c3f8ce551a8864b08ae25a44056e633
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Arrays; import java.util.PriorityQueue; import java.util.Random; import java.util.StringTokenizer; import java.util.concurrent.ThreadLocalRandom; public class Main2 { static i...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
0548fd8cee69c4c07bff0987aced4822
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Formatter; import java.util.Locale; import java.util.Scanner; /** * @author edemairy */ public class Main { private int nbTC; private StringBuil...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
830725111e5ae367ca2bf464786e2265
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Formatter; import java.util.Locale; import java.util.Scanner; /** * @author edemairy */ public class Main { private int nbTC; private StringBui...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
9f219b6afe1d993a364bc2a7b71dd288
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /** * created by vidyut on 2019-05-12 **/ public class B { public static void main(String[] args) throws Exception { InputReader in = new InputReader(System.in); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
9b01feff72521d3d7ed5c66dd4ba16b4
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
/* * @author derrick20 */ import java.io.*; import java.util.*; public class wow { public static void main(String args[]) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); String s = sc.next(); long[] prefix = new long[s.length...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
935e77f41dc9bff92fc507effdd38263
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.*; import java.io.*; public class B { static final boolean stdin = true; static final String filename = ""; static FastScanner br; static PrintWriter pw; public static void main(String[] args) throws IOException { if (stdin) { br = new FastScanner(); pw = new PrintWriter(new OutputStre...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
d7e32685e1c3f81cd39a81b3352b69bf
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Arrays; public class B { static char s[]; static int N; public static void main(String args[]){ new Thread(null, ()->asdf(args), "", 1<<28).start(); } static long dp[]...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
71b9132d959cf9bff3ab05c63dae66ec
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.math.BigInteger; import java.util.*; public class Main { static Scanner input = new Scanner(System.in); public static void main(String[] args) { String s = input.next(); long o =0,w=0,wow=0; for (int i = 1; i < s.length(); i++) { if(s.charAt(i)=='v...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
db3662bf59c06132c88dc9c54c294779
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner s = new Scanner(System.in); char[] n = s.nextLine().toCharArray(); long l = 0,o = 0 , r = 0; for (int i = 0 ; i < n.length - 1; i++) { if ((n[i]=='v')&&(n[i+1]=='v')) { ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
e2c74efa83b2d9522c78b189a8850283
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String ag[]) { Scanner sc=new Scanner(System.in); int i,j,k; String str=sc.next(); int N=str.length(); long dp[]=new long[N+1]; for(i=1;i<N;i++) { if(str.char...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
8d19ab26670c673ce1ca82309f69223c
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.*; public class code1{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); String s=sc.next(); char ch[]=s.toCharArray(); int a[]=new int[ch.length]; for(int i=1;i<s.length();i++) { a[i]=a[i-1]; ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output