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
8d15c9ab380d31585ce0c336517a0081
train_001.jsonl
1456683000
A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and construction; it cannot produce any thimbles during this time, but ...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class VentureFD { public static void main(String[] args) throws NumberFormatException, IOException { ...
Java
["5 2 2 1 8\n1 1 2\n1 5 3\n1 2 1\n2 2\n1 4 2\n1 3 2\n2 1\n2 3", "5 4 10 1 6\n1 1 5\n1 5 5\n1 3 2\n1 5 2\n2 1\n2 2"]
4 seconds
["3\n6\n4", "7\n1"]
NoteConsider the first sample.We produce up to 1 thimble a day currently and will produce up to 2 thimbles a day after repairs. Repairs take 2 days.For the first question, we are able to fill 1 order on day 1, no orders on days 2 and 3 since we are repairing, no orders on day 4 since no thimbles have been ordered for t...
Java 8
standard input
[ "data structures" ]
d256f8cf105b08624eee21dd76a6ad3d
The first line contains five integers n, k, a, b, and q (1 ≀ k ≀ n ≀ 200 000, 1 ≀ b < a ≀ 10 000, 1 ≀ q ≀ 200 000)Β β€” the number of days, the length of the repair time, the production rates of the factory, and the number of updates, respectively. The next q lines contain the descriptions of the queries. Each query is...
1,700
For each query of the second type, print a line containing a single integer β€” the maximum number of orders that the factory can fill over all n days.
standard output
PASSED
826e491970d7e9eae64204f511cbaaa2
train_001.jsonl
1456683000
A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and construction; it cannot produce any thimbles during this time, but ...
256 megabytes
import java.io.*; import java.util.*; /** * * @author Sourav Kumar Paul (spaul100) * NIT Silchar */ public class SolveD { public static Reader in; public static PrintWriter out; public static long mod = 1000000007; public static long inf = 100000000000000000l; public static long fac[],inv...
Java
["5 2 2 1 8\n1 1 2\n1 5 3\n1 2 1\n2 2\n1 4 2\n1 3 2\n2 1\n2 3", "5 4 10 1 6\n1 1 5\n1 5 5\n1 3 2\n1 5 2\n2 1\n2 2"]
4 seconds
["3\n6\n4", "7\n1"]
NoteConsider the first sample.We produce up to 1 thimble a day currently and will produce up to 2 thimbles a day after repairs. Repairs take 2 days.For the first question, we are able to fill 1 order on day 1, no orders on days 2 and 3 since we are repairing, no orders on day 4 since no thimbles have been ordered for t...
Java 8
standard input
[ "data structures" ]
d256f8cf105b08624eee21dd76a6ad3d
The first line contains five integers n, k, a, b, and q (1 ≀ k ≀ n ≀ 200 000, 1 ≀ b < a ≀ 10 000, 1 ≀ q ≀ 200 000)Β β€” the number of days, the length of the repair time, the production rates of the factory, and the number of updates, respectively. The next q lines contain the descriptions of the queries. Each query is...
1,700
For each query of the second type, print a line containing a single integer β€” the maximum number of orders that the factory can fill over all n days.
standard output
PASSED
a6001d7e78586ba663f652e89783b411
train_001.jsonl
1456683000
A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and construction; it cannot produce any thimbles during this time, but ...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(...
Java
["5 2 2 1 8\n1 1 2\n1 5 3\n1 2 1\n2 2\n1 4 2\n1 3 2\n2 1\n2 3", "5 4 10 1 6\n1 1 5\n1 5 5\n1 3 2\n1 5 2\n2 1\n2 2"]
4 seconds
["3\n6\n4", "7\n1"]
NoteConsider the first sample.We produce up to 1 thimble a day currently and will produce up to 2 thimbles a day after repairs. Repairs take 2 days.For the first question, we are able to fill 1 order on day 1, no orders on days 2 and 3 since we are repairing, no orders on day 4 since no thimbles have been ordered for t...
Java 8
standard input
[ "data structures" ]
d256f8cf105b08624eee21dd76a6ad3d
The first line contains five integers n, k, a, b, and q (1 ≀ k ≀ n ≀ 200 000, 1 ≀ b < a ≀ 10 000, 1 ≀ q ≀ 200 000)Β β€” the number of days, the length of the repair time, the production rates of the factory, and the number of updates, respectively. The next q lines contain the descriptions of the queries. Each query is...
1,700
For each query of the second type, print a line containing a single integer β€” the maximum number of orders that the factory can fill over all n days.
standard output
PASSED
20f93ff219ecbad020d7247094b68f2d
train_001.jsonl
1456683000
A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and construction; it cannot produce any thimbles during this time, but ...
256 megabytes
import java.io.IOException; import java.util.InputMismatchException; public class FactoryRepairs { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); int N = sc.nextInt(); int K = sc.nextInt(); int A = sc.nextInt(); int B = sc.nextInt(); int Q = sc.nextInt(); StringBuil...
Java
["5 2 2 1 8\n1 1 2\n1 5 3\n1 2 1\n2 2\n1 4 2\n1 3 2\n2 1\n2 3", "5 4 10 1 6\n1 1 5\n1 5 5\n1 3 2\n1 5 2\n2 1\n2 2"]
4 seconds
["3\n6\n4", "7\n1"]
NoteConsider the first sample.We produce up to 1 thimble a day currently and will produce up to 2 thimbles a day after repairs. Repairs take 2 days.For the first question, we are able to fill 1 order on day 1, no orders on days 2 and 3 since we are repairing, no orders on day 4 since no thimbles have been ordered for t...
Java 8
standard input
[ "data structures" ]
d256f8cf105b08624eee21dd76a6ad3d
The first line contains five integers n, k, a, b, and q (1 ≀ k ≀ n ≀ 200 000, 1 ≀ b < a ≀ 10 000, 1 ≀ q ≀ 200 000)Β β€” the number of days, the length of the repair time, the production rates of the factory, and the number of updates, respectively. The next q lines contain the descriptions of the queries. Each query is...
1,700
For each query of the second type, print a line containing a single integer β€” the maximum number of orders that the factory can fill over all n days.
standard output
PASSED
11a648cab6858a01b903d205e584d4ec
train_001.jsonl
1456683000
A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and construction; it cannot produce any thimbles during this time, but ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Task...
Java
["5 2 2 1 8\n1 1 2\n1 5 3\n1 2 1\n2 2\n1 4 2\n1 3 2\n2 1\n2 3", "5 4 10 1 6\n1 1 5\n1 5 5\n1 3 2\n1 5 2\n2 1\n2 2"]
4 seconds
["3\n6\n4", "7\n1"]
NoteConsider the first sample.We produce up to 1 thimble a day currently and will produce up to 2 thimbles a day after repairs. Repairs take 2 days.For the first question, we are able to fill 1 order on day 1, no orders on days 2 and 3 since we are repairing, no orders on day 4 since no thimbles have been ordered for t...
Java 8
standard input
[ "data structures" ]
d256f8cf105b08624eee21dd76a6ad3d
The first line contains five integers n, k, a, b, and q (1 ≀ k ≀ n ≀ 200 000, 1 ≀ b < a ≀ 10 000, 1 ≀ q ≀ 200 000)Β β€” the number of days, the length of the repair time, the production rates of the factory, and the number of updates, respectively. The next q lines contain the descriptions of the queries. Each query is...
1,700
For each query of the second type, print a line containing a single integer β€” the maximum number of orders that the factory can fill over all n days.
standard output
PASSED
620f8a788a42dc41d6b43810b88029f5
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws IOException { // your code goes here BufferedReader br=new B...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
52b53a518482802ef3af8080ffb2e4a8
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; import java.text.*; /* * @IO : BufferedReader, InputStreamReader, IOException. * @Util : Scanner, Arrays, ArrayList, StringTokenizer, TreeSet. * @Util : Collections, HashMap, HashSet. * @Lang : StringBuilder, StringBuffer. * @Math : BigI...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
2f20a0b76b5185dffcc29d9472fe5815
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; import java.text.*; /* * @IO : BufferedReader, InputStreamReader, IOException. * @Util : Scanner, Arrays, ArrayList, StringTokenizer, TreeSet. * @Util : Collections, HashMap, HashSet. * @Lang : StringBuilder, StringBuffer. * @Math : BigI...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
2241adee1dd0a26f0d206f0e5b4466c1
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; import java.text.*; /* * @IO : BufferedReader, InputStreamReader, IOException. * @Util : Scanner, Arrays, ArrayList, StringTokenizer, TreeSet. * @Util : Collections, HashMap, HashSet. * @Lang : StringBuilder, StringBuffer. * @Math : BigI...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
0a79fef2ee45c80e7c64d5c1579b22c4
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; import java.io.IOException; import java.util.StringTokenizer; public class current {public static void main(String[] args) th...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
8c1d2111a656a6623cfd9299641c5d04
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; import java.io.IOException; import java.util.StringTokenizer; public class current {public static void main(String[] args) th...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
1ccdafc5c9528c63d801b4246d631b34
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Stack; import java.io.IOException; import java.util.StringTokenizer; public class current {public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bf =new BufferedReader(new InputStreamReader(Sys...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
debc8b0147d2c88dad35d8a010bc1d9e
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Stack; import java.io.IOException; import java.util.StringTokenizer; public class current {public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bz =new BufferedReader(new InputStreamReader(Sys...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
686dede7ab8a960569a472c77538736a
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { // /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ FastReader s...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
2d3d77093f1aac5195981a9ff7274998
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; public class Date { public static void main(String[]args)throws Exception{ BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); String x=bf.readLine(); if (x.length()%2!=0) System.out.print("No"); else{ Stack<Character> y=new Stack<Character>(); y.push(...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
4b29d378dfd7d182f0b0b5faaa6fcf65
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; public class Date { public static void main(String[]args)throws Exception{ BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); String x=bf.readLine(); if (x.length()%2!=0) System.out.print("No"); else{ Stack<Character> y=new Stack<Character>(); y.push(...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
746cea486bde56b8706aa3e2c9827f39
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; public class Date { public static void main(String[]args)throws Exception{ BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); String x=bf.readLine(); if (x.length()%2!=0) System.out.print("No"); else{ Stack<Character> y=new Stack<Character>(); y.push(...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
00a1bf8d8cfc288054663f7696fb8f99
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Stack; //import java.util.StringTokenizer; public class acm { public static void main(String[]args) throws Throwable{ PrintWriter out = new PrintWriter(System.out); BufferedReader...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
d559ed08e1270e4fad910a2167b475b7
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Stack; import java.util.StringTokenizer; public class acm { public static void main(String[]args) throws Throwable{ PrintWriter out = new PrintWriter(System.out); BufferedReader ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
68b62a5a234772c86a842e27a02a4469
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; import java.util.StringTokenizer; public class Main{ public static String rev(String s){ String res=""; for (int i = s.length()-1; i >=0; i--) { res+= s.charAt(i); } return res; } public ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
4a1d9bbf4628682a0d4881b4de218aec
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.util.*; import java.io.*; /* Mighty Cohadar */ public class Bravo { public static boolean solve(char[] C) { assert C.length > 0; if (C.length % 2 != 0) { return false; } Deque<Character> Q = new ArrayDeque<>(); for (int i = 0; i < C.length; i++) { if (Q.isEmpty() == false && Q.peekFirst()...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
6d0f8bc6bcb715a939aabcabe8f2e2de
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Stack; public class Main { public static void main(String [] args) throws Throwable{ PrintWriter pr = new PrintWriter(System.out); BufferedReader br = new BufferedReader(new InputStreamReader(Syste...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
32cf59184a60b28ecacd017d56357e7b
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; import java.util.Stack; public class searching { public static void main(String[] args) { Scanner sc = new Scanner (System.in); PrintWriter pw = new PrintWriter(System.out); String s = sc.next(); if(s.length() %2 != 0) System.out.println("NO"); else...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
e10a7f7f2400fff33f1445816f22a234
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class AlternatingCurrent { static long mod = (long) Math.pow(10, 9) + 7; static FastScanner f = new FastScanner(System.in); static Scanner S = new Scanner(System.in); public static void main(String[] args)throws IOException { ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
9d43660d711d1bcdaf8b9d8194624149
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.util.Scanner; import java.util.Stack; /* * Templates --------------- > bufstr --> BufferedReader for array input > pint --> Integer.parseInt > buf --> BufferedReader declaration > mio --> main throws IoException */ public class AlternatingCurrent { public static void main(String[] args) { Scanner ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
663bf1c2c13350585fd3ab45ce0555f6
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
//package stack; import java.io.*; import java.util.*; public class AC { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); System.out.println(solve(str)); } public static String solve(String ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
52a707d1dcd8b2d570f90cbe0f914f1c
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); Stack<C...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
d3f7417f4ad2e8826ec861d7c646bf08
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); S...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
d1b1daa516092361382e4cfae49c132c
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.Stack; public class AlternatingCurrent { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); Stack<Character> wire = new Stack<Character>(); wire.add(s.charAt(0)); ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
7f3f6bfb295a4fc19fa93be31812041f
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.io.*; import java.io.PrintWriter; import java.util.Stack; import java.util.StringTokenizer; public class alternatingCurrent { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new Pri...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
962e68e695f539c6a512358eaa46777c
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class CF343B { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); char p =...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
c2ce6007878f37fa4a75744d44e1b217
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(Sys...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
93b9b97405ebd6a53e525a8acc08bdb0
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Stack; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); PrintWrite...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
ce316d836965b061d2f1556b7831208e
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import static java.lang.Math.*; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.String.*; public class Main { public static void main(String[] args) ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
f4847ed6694b0ef0af739a1ffc39af11
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.Stack; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); char[] s = sc.next().toCharArray(); Stack...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
e65fb39656b0f677984d82e51f10957f
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.util.*; import java.io.*; public class a { public static void main(String[] args) throws IOException { new a(); } public a() throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); String s = in.next(); int op1 = 0; int op2 = 0; ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
5da2208962f9f6158cabb6d80773f37c
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayDeque; public final class Solution { public static void main(String[] args) throws IOException { solution(); } public static int LINE_LENGTH = 1000000; //No need of nextLine after...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
d760592b965cfbc3bbe742a6ab219fab
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; public class AlternatingCurrent{ public static void main(String[] args) throws IOException{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String input = reader.readLine(); System.out.println(canUntangle(input)); r...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
0e167e8826754ecbeca6c8a877f7d0f7
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class chef { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
30d106633b551d60fedda145704fee2b
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; public class koi { public static void main(String[] args) throws Exception { int u =0; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); String s = br.readLine(); Stack<Character> st = new Stack<Character>(); st...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
e579c32bcfdd409be7ab4f57e163bd25
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; public class koi { public static void main(String[] args) throws Exception { int u =0; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pr = new PrintWriter(System.out); String s = br.readLine(); Stack<Character> st = new Stack<Character>(); st...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
84b423efe85683b571a22ec4727d5f37
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; public class koi { public static void main(String[] args) throws Exception { int u =0; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); String s = br.readLine(); Stack<Character> st = new Stack<Character>(); st...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
e49551c5a323e31aee0ef8c3c2ab72e2
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; public class ko { public static void main(String[] args) throws Exception { int u =0; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); String s = br.readLine(); Stack<Character> st = new Stack<Character>(); st....
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
fcaf50c3386e2c732baa5b9eeeea5aa0
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.util.*; public class current{ public static void main (String[]args){ Scanner sc=new Scanner (System.in); String s=sc.next(); Stack <Character> st=new Stack <Character>(); for(int i=0;i<s.length();i++){ if(st.isEmpty()==true){ st.add(s.charAt(i)); ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
1f845327a6c89d4b0c31433ac26fbea9
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.*; import java.util.*; import java.awt.*; public class Main { public static void main(String[] args) throws Exception { FastReader sc = new FastReader(); StringBuilder sb=new StringBuilder(); String s=sc.next(); if((s.length()&1)==1){ System.out.println("N...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
b75c32a06098c3fadacaee52659b800b
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class Dep { public static void main(String[] args) throws IOException { FastReader in = new FastReader(); String n = in.next(); char ...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
a022b3e0d4cfd346d90b693a0910f331
train_001.jsonl
1379172600
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u...
256 megabytes
import java.util.Scanner; import java.util.Stack; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner obj = new Scanner(System.in); String s = obj.next(); if(s.length()%2!=0) { System.out.println("No"); return; } Stack<Character> stack = new Stack...
Java
["-++-", "+-", "++", "-"]
1 second
["Yes", "No", "Yes", "No"]
NoteThe first testcase corresponds to the picture in the statement. To untangle the wires, one can first move the "plus" wire lower, thus eliminating the two crosses in the middle, and then draw it under the "minus" wire, eliminating also the remaining two crosses.In the second testcase the "plus" wire makes one full r...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
89b4a7b4a6160ce784c588409b6ce935
The single line of the input contains a sequence of characters "+" and "-" of length n (1 ≀ n ≀ 100000). The i-th (1 ≀ i ≀ n) position of the sequence contains the character "+", if on the i-th step from the wall the "plus" wire runs above the "minus" wire, and the character "-" otherwise.
1,600
Print either "Yes" (without the quotes) if the wires can be untangled or "No" (without the quotes) if the wires cannot be untangled.
standard output
PASSED
087d2d063ae07d8e37c9b553bed58c52
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
/* *created by Kraken on 08-05-2020 at 15:28 */ //package com.kraken.cf.practice; import java.util.*; import java.io.*; public class D459 { private static int MAXN = (int) 1e6 + 5; private static long[] BIT; private static int[] l, r; private static int n; private static void add(int x) { while (x <=...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
755399d62cd17f6c1e0b8e04382d08e2
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; public class CF_459_D_PASHMAK_AND_PARMIDA_PROBLEM { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int [] a = new int [n+1]; DataCompress data = new DataCompress(); FenwickTree ft = new Fen...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
0c2dabe71fb05353d3de6596b7caaddc
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; public class CF_459_D_PASHMAK_AND_PARMIDA_PROBLEM { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long [] a = new long [n+1]; DataCompress data = new DataCompress(); SegmentTree st = new S...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
745e8bf60888df849d4cb49e84ff72e4
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; public class CF_459_D_PASHMAK_AND_PARMIDA_PROBLEM { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int [] a = new int [n+1]; DataCompress data = new DataCompress(); SegmentTree st = new Seg...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
8ea7e057ac92e5b8c0ae1664f6e219dc
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; public class CF_459_D_PASHMAK_AND_PARMIDA_PROBLEM { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int [] a = new int [n]; HashMap<Integer,Integer> map = new HashMap<>(); Map<Integer,Integer...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
f81d23936674952073e90fcda9622523
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; public class CF_459_D_PASHMAK_AND_PARMIDA_PROBLEM { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long [] a = new long [n+1]; DataCompress data = new DataCompress(); FenwickTree ft = new F...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
fc5b14f952c338b877957184f10aa6fa
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; private FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !s...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
c9e04d6ff735e315f3d89fdc40383388
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class PASHMAK_AND_PARMIDA_PROBLEM { public static long count = 0; public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] arr = new int[n]; for(int i=0;i<n;i+...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
662968592f0c248207f301aa484c0aae
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class PASHMAK_AND_PARMIDA_PROBLEM { public static long count = 0; public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] arr = new int[n]; int max = 0; for...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
02e58061218dc746401da1704f7d6362
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.HashMap; import java.util.Scanner; import java.util.StringTokenizer; public class l075 { public static void main(String[] args) throws Exception { // StringTokenizer stok = new StringTokenizer(new Scanner(new File("F:/books/input.txt")).use...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
d42e5763e9678d8a920e90e53cfd54fd
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; /** * Built using CHelper plug-in * Actual solution is at the top */ public class PashmakAndParmidaproblem { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = Syst...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
60e810f2580911f2410e51c978792ea4
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.TreeMap; public class A { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(Sy...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
5137ab40134a2b347c459c530a5e4d06
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(Sy...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
ce0c6bd5b7aa6b3ed1ab7696bb50193b
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.HashMap; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelpe...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
daa6c6598590ac0311e3d5b58b90b13b
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.HashMap; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelpe...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
2a6f256c28cd0b04c82f88935f580001
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top * @author Ba...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
3c375d45e98aa65d0d446cebc1071160
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; public class segTree { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); int[] arr = new int[n]; for(int i=0;i<n;i++) arr[i] = sc.nextInt(); Pair[] ...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
8a84e0fa1b0daa2d36fc893dcf820e8e
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferP...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
47d3360e7707b5a0fd2552c8f8b55253
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferP...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
cd8da921f33225c9014c87bf7d0a39e3
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.util.*; import java.io.*; public class PashmakParmidasProblem { public static void main(String[] args) { FastScanner scanner = new FastScanner(); PrintWriter out = new PrintWriter(System.out, false); int n = scanner.nextInt(); int[] arr = new int[n]; // TreeSet<In...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
9b7291fc245384e7cbd49ebf3ce2077f
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; // author: Prajogo Tio public class Pashmak { // at index i, static int l[]; static int r[]; static int low[]; static int high[]; static int count[]; public static void main(String[] args) { Scanner in = new Scanner(System....
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
d791d3a2adf3dfbd027e266d6d09f307
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; import java.util.TreeMap; public class A { public static void main(Stri...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
447403c7f46c90012c269b3539717f3a
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
//package CF; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; public class H { public static void main(String[] args) throws E...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
7e941f390b814479604d02c094d5baf4
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Map; import java.util.StringTokenizer; import java.util.TreeMap; public class Cf459D { FastScanner sc; int n, mv; int[] A, L, C; Map<Integer, Integer> M; BIT B; public static void main...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
67387f30845a60b8aabcb147bb8b5ae6
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; /* https://codeforces.com/contest/459/problem/D */ public class PashmakandParmidasProblem { private static int[] segmentArr; // 0 is not used...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
71707eef3e37a0c45fc892f2429144d8
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import static java.lang.Math.*; public class Main { static class Reader { private BufferedReader br; private StringTokenizer token; protected Reader(FileReader obj) { br = new BufferedReader(obj, 32768); token...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
277e2ca3a0704aa613670e8e8c528203
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import static java.lang.Math.*; public class Main { static class Reader { private BufferedReader br; private StringTokenizer token; protected Reader(FileReader obj) { br = new BufferedReader(obj, 32768); token...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
239ec9760501ca08b26d1171a424a22e
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.Tre...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
7ced6187dba85a975e4856fc5f583efa
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; public class C459D { public static void main(String[] args) { IntIO459D sc = new IntIO459D(System.in); int n = sc.nextInt(); int a[] = new int[n]; for (int i = 0; i < n;...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
5a9344988adde097ff0c1965c151e994
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.HashSet; import java.util.StringTokenizer; public class gym { static class FenwickTree { int[] ft; FenwickTree(int n) { ft = new int[n + 1]; } ...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
9659038431937ee9d514e124c41ebbdf
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import static java.lang.Math.*; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.String.*; public class Main { static int n; static int [] BIT; ...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
9166fa2b5275951855986fccf9d219d1
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.HashMap; public class Main { public static void main(String[] args) { new Thread(null, new Runnable() { public void run() { s...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
7d41c689f9b390f4ad5286cc20d16f9a
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class D459 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); int [] arr = new int [n]; for (int i = 0; i < arr.length; i++) { ...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
85058902d79b1416abf46cc5a26a0ac1
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; import java.util.TreeSet; /** * @author Don Li */ public class PashmakParmidaProblem2 { static final int ...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
c32b1c94824bcc1bf65ceae7730cae25
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; /** * @author Don Li */ public class PashmakParmidaProblem { void solve() { int n = in.nextInt();...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
83f62526d119d6caa308f1c0baabe135
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class C { static int mod = 1000000007; public static void main(String[] args) { Scanner nik = new Scanner(System.in); int n = nik.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = nik.nextInt(); } HashMap<Integer, Integ...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
e33e0a159381388d909c3ac8fac2b572
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Random; import java.util.StringTokenizer; public class P { stat...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
4a0bed8a039f2e9ce4ef5e95214a86c6
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class D { HashMap<Integer, Integer> m = new HashMap<Integer, Integer>(); class BIT { //one-indexed int[] tree; public BIT(int size) { tree = new int[size+10]; } public void upd(int k, int x) { ++k; while(k < tree....
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
21afa755a73f8bf43d872488c44f19ad
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
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.StringTokenizer; import java.util.TreeMap; public class A { static int n; static int [] BIT; public ...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
e14d30928743076bf3f40ee8ca89f58e
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new PrintStream(System.out)); int n=Integer.parseInt(f.readLine());...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
e9462e625a6a00aa061d32b6001b04f9
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ InputStream is; static PrintWriter out; String INPUT = ""; static long mod = (long)1e9+7L; static class SegmentTree{ static class Node{ int l, r, v; Node left, right; Node(int a, int b, int c){ l = a; r = b; v = c; left = null; right ...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
a7632c40eaafba6790039d5ba01923f9
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Miras */ import java.util.Scanner; import java.util.TreeMap; import java.util.Arrays; public class solve { pu...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
35641b2b6b6b72a82fa0e1f4b7bc504f
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import sun.reflect.generics.tree.Tree; import java.io.*; import java.math.*; import java.util.*; import java.lang.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int ...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
51dfdc87197066452f8cf4c6c26ddef8
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.TreeMap; public class Main1 { static PrintWriter out = new PrintWriter(System.out); static Reader input = new Reader(); static final int MAXN = (int) 1e6; static int st[], lazy[]...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
5da5cf2340bb3d997e70a964523f4e20
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
import java.io.*; import java.util.*; /** * Created by vikas.k on 25/12/16. */ public class CF261D { public static void main(String[] args){ CF261D gv = new CF261D(); gv.solve(); } private int[] rgt; private int[] fnk; int n; private void solve(){ MyScanner sc = new M...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
c2828074a0f800d7348824b52d58168d
train_001.jsonl
1408116600
Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.There is a sequence a that consists of n integers a1, a2, ..., an. Let's denote f(l, r, x) the number of indices...
256 megabytes
// package SegmentTree; import javafx.util.Pair; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; import java.util.TreeSet; public class PashmakAndParmida { public static int query(int tree[],int s,int e,int q...
Java
["7\n1 2 1 1 2 2 1", "3\n1 1 1", "5\n1 2 3 4 5"]
3 seconds
["8", "1", "0"]
null
Java 8
standard input
[ "data structures", "sortings", "divide and conquer" ]
d3b5b76f0853cff6c69b29e68a853ff7
The first line of the input contains an integer n (1 ≀ n ≀ 106). The second line contains n space-separated integers a1, a2, ..., an (1 ≀ ai ≀ 109).
1,800
Print a single integer β€” the answer to the problem.
standard output
PASSED
b1cc521dad35be16d4a417eed3051523
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.util.NoSuchElementException; public class Main { static PrintWriter out; static InputReader ir; static boolean debug = false; static void solve() { i...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
7f1a4eab64a61722884eb16a08c9d868
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { BufferedReader f = new BufferedReader(new In...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
0bc2bc604d3a1f10f499b98516c2b498
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
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.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java....
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
07a01d16aa7f9cb16cf9374a89471bf9
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
//-----Nilay Shah----0-// // A new building for SIS// import java.util.*; import java.lang.Math; import java.io.*; public class problemA { public static void main(String args[]) throws java.lang.Exception { Scanner s = new Scanner(System.in); int n = s.nextInt(); if(n<=1) { System.out.println...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
71f3fd4d191975389fd16174661efcd9
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
//package contests.CF1012; import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); ...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
36e7fd8ffb4ea947e2477a25756ed607
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.util.*; public class Solution { public static void main(String []args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); n = 2*n; long arr[] = new long[n]; for(int i = 0 ; i < n ; i++) { ...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
617c45ebcebc5884f350daf366f1ebea
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.util.*; import java.io.*; public class HelloWorld { public static void main(String []args)throws IOException { int i,j; long z=(long)Math.pow(10,9)+7; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(System.out); ...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output