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 | b5a1fcb7cfe98d6badf2301745ccd31e | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | /*
Author : Akshat Jindal
from NIT Jalandhar , Punjab , India
JAI MATA DI
*/
import java.util.*;
import java.io.*;
import java.math.*;
import java.sql.Array;
public class Main {
static class FR{
BufferedReader br;
StringTokenizer st;
public FR() {
br = new Buff... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 9112983165874b0f1fedd61780addc07 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamW... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 4ed5b585e544c9162f48e208db3bb57a | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes |
import java.io.*;
import java.util.*;
public class C {
public static void main(String[] args)
{
FastScanner sc=new FastScanner();
int t=1;
PrintWriter pw=new PrintWriter(System.out);
while(t-->0) {
int n=sc.nextInt();
int[] a=new int[n];
for(int i=0;i<n;i... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 4ff5a831f7c8a0c5262f9b4fb848993c | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.Stack;
import java.util.StringTokenizer;
import java.io.*;
public class CompressedBracketseq {
private static class MyScanner {
BufferedReader br;
StringTokeniz... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | fbc7ecde92bbeebfc658eebb464d798a | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.*;
import java.util.Scanner;
import java.util.StringTokenizer;
public class eashan{
public static boolean checker(long[] arr,long K,long diff)
{
long collect=0;
for(int i=0;i<arr.length;i++)
{
if... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | fd919890bd4e02a874077f51756fa7dd | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class q3 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] arr = new int[n];
String[] parts = br.... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | ed5eb9c684d82c75a7bead16be5a4308 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class q3 {
// public static class Pair{
// int open;
// int ans;
// Pair(int open,int ans){
// this.open = open;
// this.ans = ans;
// }
// }
public static void main(String[] args) throws Ex... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | d61edc5e04a6662cad5d64fc759fd009 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//int cases = Integer.parseInt(br.readLine());
//o:while(cases-- > 0) {
String[] str = br.readLine().s... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 3bdaef548a35c4cfb4443899c51fad4c | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class taskc {
public static void main(String[] args) {
FastScanner in = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
long a[] = new l... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 1de26d8f822a7ce30419d57302ac94d8 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
// BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=1;
// t=sc.nextInt();
/... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | cd4e3f57bbcb3102750ab75e52f2bd02 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | // Generated by Code Flattener.
// https://plugins.jetbrains.com/plugin/9979-idea-code-flattener
import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
Solution solution = new ASolution();
boolean local = System.getProperty("ONLI... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | e63c88983f96f58753c68513ed2dfd8e | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
FastIO io = new FastIO();
int test=1;
while(test>0)
{
int n=io.nextInt();
long arr[]=new long[n];
for(int i=0;i<n;i++)arr[i]=io.nextLong();
long count[]=new lo... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | e072d82be20e86f595df0842cb67c091 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes |
public class Main {
public static void main(String[] args) {
new Main();
}
public Main() {
FastScanner fs = new FastScanner();
java.io.PrintWriter out = new java.io.PrintWriter(System.out);
solve(fs, out);
out.flush();
}
public void solve(FastScanner fs, java.io.PrintWriter out) {
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 1734bff3a56926ecd643dfc40233e30e | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
static FastScanner fs = new FastScanner();
static PrintWriter pw = new PrintWriter(System.out);
static StringBuilder sb = new StringBuilder("");
static final long INF = (long) 10e12;
public static void main(String[] args) {
int n = fs.nextIn... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 64df2089ee463d9d247f2be77fea1b22 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class A3 {
void solve() {
int n = cint();
long[] a = carr_long(n);
// int n = 6;
// long[] a = new long[n];
// for (int i = 0; i < a.length; i++) {
// a[i] = new Random().nextInt(4) + 1;
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | f11c43c2d1fe97511c5f25d9c0a0ea4b | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 358524ab3297f6d4250b53a6a23d1c93 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
PrintWriter out = new PrintWriter(System.out);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tok = new StringTokenizer("");
String next() throws IOException {
if (!tok.h... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | c64815371cf15c9016d9177511e60883 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.Scanner;
/**
* @author Tay Qi Xiang
* @date 05/09/2021
*/
public class compressedBracketSequence {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 6f1fa79236a5aadb37737e77da6e73f9 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | // Problem: Compressed Bracket Sequence
// https://codeforces.com/contest/1556/problem/C
// This submission:
import java.util.*;
public class CompressedBracketSequence {
private static class BracketPair {
private final long open, close;
private BracketPair(long openInput, long closeInput) {
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 1e5a5bfdb1b27785a056f45ad1f558b9 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | // Problem: Compressed Bracket Sequence
// https://codeforces.com/contest/1556/problem/C
import java.util.*;
public class CompressedBracketSequence {
private static class BracketPair {
private long open, close;
}
// Cache for the number of valid solutions.
// The element `cache.get(i)` store... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 5decf31f362cb3862667bbe5cf502a29 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class Sol{
/*
->check n=1, int overflow , array bounds , all possibilites(dont stuck on 1 approach)
->Problem = Observation(constraints(m<=n/3 or k<=min(100,n))
+ Thinking + Technique (seg_tree,binary lift,rmq,bipart,dp,connected comp etc)
->solve or... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | f4590b69c633dd6e6829264969c0e0fe | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | //package codechef;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | fe80c2bce8eff5616b481e0a335ac097 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | /*
ID: abdelra29
LANG: JAVA
PROG: zerosum
*/
/*
TO LEARN
2-euler tour
*/
/*
TO SOLVE
*/
/*
bit manipulation shit
1-Computer Systems: A Programmer's Perspective
2-hacker's delight
*/
/*
TO W... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | ae2339228a2482f2a78c7e716b9c82db | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Practice
{
static int mod=1000000007;
static HashSet<Integer> pr;
static FastReader sc=new FastReader(System.in);
// static Reader sc=new Reader();
static PrintWriter out=new PrintWriter(System.out);
public static void main(String[] args) throws IOExc... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 70169c71a621867ea4091d412ba3c695 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
/**
* @author Mubtasim Shahriar
*/
public class CompressedBracSeq {
public static void main(String[] args) {
InputStream inpu... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 5c14ea8b3ae7d5f24b75123eb7cac48b | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class Deltix {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int t = 1;
while (t-- > 0) {
int n = sc.nextInt();
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 6a5df8b6300e5c257d21e5c0727d6078 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.List;
import java.util.*;
public class realfast implements Runnable
{
private static final int INF = (int) 1e9;
long in= 1000000007;
long fac[]= new long[1000001];
lo... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 26d8229276589e617683247d9442dd07 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class DeltixRound {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 5db8d59eb8f88d8f9beaccb6bedc263b | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Solution {
public static long gcd(long a,long b) {
if(a==0) return b;
return gcd(b%a,a);
}
public static long lcm(long a,long b) {
return (a*b)/gcd(a,b);
}
public static long [] input(BufferedReader br,int n) throws java.lang.Exception{... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 862472e16f79c1496c3e5b569ddc9cf6 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution
{
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
din ... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 45468d6c5efe02d0e4d4f8148c6c8631 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes |
import java.util.*;
public class Hello {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.nextLine());
String secondLine[] = sc.nextLine().trim().split("\\s+");
int arr[] = new int[N];
for (int index = 0; i... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 1ab24b20e7acf73fd76cc067e4e1d052 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | // ----------------------------------- Duniya Madarchod Hai -----------------------------------
import java.io.*;
import java.math.*;
import java.util.*;
public class Main
{
/*
public String wrd() throws IOException{return(read.next());}
public int ni() throws IOException{r... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | e14b9b07cada8d91e4288880b0c65850 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//int cases = Integer.parseInt(br.readLine());
//o:while(cases-- > 0) {
String[] str = br.readLine().s... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 6166331c817091daf710fce1ccb28850 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | // Problem: C. Compressed Bracket Sequence
// Contest: Codeforces - Deltix Round, Summer 2021 (open for everyone, rated, Div. 1 + Div. 2)
// URL: https://codeforces.com/problemset/problem/1556/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
import java.... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 720926bb8c3e28e5981044e3b65e9bd8 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | eb4bcc44b5036efcd326ba7befce15e0 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import java.util.*;
import java.io.*;
public class A
{
static int n;
static int[] arr;
static char[] s;
public static void main(String[] args) throws IOException
{
f = new Flas... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 5485f3d4848b5031946dcded0806d5eb | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | /*
"Everything in the universe is balanced. Every disappointment
you face in life will be balanced by something good for you!
Keep going, never give up."
*/
import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef {
public static vo... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 7071d15d524f5d6a722aee69cdc25628 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
/**
* @author Naitik
*
*/
public class Main
{
static FastReader sc=new FastReader();
static int dp[][][];
static int mod=1000000007;
static int mod1=998244353;
static int max;
static long bit[];
// static long seg[];
// ... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 9194c6909d8cd02e30b81e02ab924bc5 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.util.InputMismatchException;
public class Main {
static PrintWriter out;
static Reader in;
public static void main(String[] args) throws IOException {
input_output();
Main solver = new Main();
solver.solve();
out.clos... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 49f3fef08dd1bd2df058fd7079bd9e10 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
int n=Integer.parseInt(bu.readLine());
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 40441e4dee3c370b84ec93cdb3582d04 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
long[] ar = new long[n];
for (int i = 0; i < n; i++){
ar[i] = s.nextLong();
}
long ans = 0;
for (int... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 708dbea4b4d6e1036d22a049e6bb6321 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSe... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | fdea3341f617f85512ed1513e19c79d9 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import static java.util.Map.Entry.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
static long mod=(long) (1e9+7);
public static void main (String[] args) throws Exception
{
final lon... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | e0022c246c3df952e60b7497b87f2747 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
var sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
var c = new long[n];
for(int i = 0; i < n; i++){
c[i] = Long.parseLong(sc.next());
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 44b75d0ada8e46ff488e12e391a8f2f4 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class _1556_C {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int n = Integer.parseInt(in.readLine());
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 974a0ffce80e0c25c33fed337b9c08c4 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
int n=Integer.parseInt(bu.readLine());
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 8641cbec10efc16f4187533cf5b8dc80 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class C{
public static void main(String[] args) throws IOException {
// br = new BufferedReader(new FileReader(".in"));
// out = new PrintWriter(new FileWriter(".out"));
//new Thread(null, new (), "peepee", 1<<28).start();
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 94ca6d0ea9211d64fce7e4d9449c57a7 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf1556c_2 {
public static void main(String[] args) throws IOException {
int n = ri(), c[] = ria(n);
long bal = 0, ans = 0;
for (int i = 0; i < n; ++i) {
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 9e53e170bc74ec00d88a72176a178462 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
long[] arr = new long[n];
for(int i = 0; i < n; i++) {
arr[i] = sc.nextLong();
}
if(n % 2 == 1) n--;
long[] brr = new long[n+1];
brr[0] = 0;
Tr... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 140a0d88ce806ddd01fc317fa806bd58 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | //package com.company.codeforces.v210829;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.List;
import java.util.Se... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 88db46bd41bc54c94439f112f123fc79 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.min;
import static java.lang.System.exit;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public cla... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | edd6bc7813e3b44eeea31d4f741de73d | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.i... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 5cb18a248ef012ec1cff92df9ec7ea47 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
import java.text.*;
public class CF_1556_C{
//SOLUTION BEGIN
void pre() throws Exception{}
void solve(int TC) throws Exception{
int N = ni();
long[] C = new long[N];
for(int i = 0; i< N; i++)C[i] = nl();
long ans = 0;
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | ec87427a8a1aead7beac2a8256b2761b | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | //package deltixs2021;
import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;
public class C {
InputStream is;
FastWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int[] a = na(n);
long ans = 0;
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 11 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | b2aa070ef44e6d8912b026923a27a2ad | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | /*
Goal: Become better in CP!
Key: Consistency and Discipline
Desire: SDE @ Google USA
Motto: Do what i Love <=> Love what i do
If you don't use your brain 100%, it deteriorates gradually
*/
import java.util.*;
import java.io.*;
import java.math.*;
public class Solution {
static StringBuffe... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 23cd59e98849e5444328e658f53743b1 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | /*
Goal: Become better in CP!
Key: Consistency and Discipline
Desire: SDE @ Google USA
Motto: Do what i Love <=> Love what i do
*/
import java.util.*;
import java.io.*;
import java.math.*;
public class Coder {
static StringBuffer str=new StringBuffer();
static int n;
static long []c;
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | efa720e1ecdeae8adf74d4a6235fa1e1 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
/*
Goal: Become better in CP!
Key: Consistency!
*/
public class Coder {
static StringBuffer str=new StringBuffer();
static int n;
static long c[];
static long dp[][];
static long ap[][];
static long open[];
static long closed[... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 39cc18750c0b7eb1a907e43734362d42 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Objects;
import java.util.StringTokenizer;
public class Codeforces4 {
static class Node
{
int val;
Node left;
Node right;
public Node(int x) {
// T... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 7e23e11b39aad1ab2c9ed32ebd2ba861 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class practiceb{
static FastScanner sc;
static TreeSet<Integer> ans;
static long[] arr,dp;
static char[][] board;
static long mul,mul1;
sta... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | a73bc13d413af9143f51076b1aaa9a35 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | /*
stream Butter!
eggyHide eggyVengeance
I need U
xiao rerun when
*/
import static java.lang.Math.*;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1556C
{
public static void main(String hi[]) throws Exception
{
BufferedReader infile = new BufferedReader(new Inp... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | f3fab94b265aa75d7ddc644269df248f | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | d9dab339a2a6b33a88fb5c5080d75c46 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | /*==========================================================================
* AUTHOR: RonWonWon
* CREATED: 03.09.2021 11:21:20
/*==========================================================================*/
import java.io.*;
import java.util.*;
public class C {
public static void main(St... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 500f0bd78666b69e87128052fd6febd7 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.Random;
import java.util.Scanner;
import java.util.Stack;
public class Main {
public static void main(String[] args) {
Random random = new Random();
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] array = new int[n];
for ... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | ebfe74325d7f4c50548886a19c0bb186 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | //package com.company;
import java.util.*;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner scanner = new Scanner(System.in);
//. int t = scanner.nextInt();
//int casen = 1;
int n = scanner.nextInt();
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | a9ca925af5eaab93abba5b51ae5711fe | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.math.BigInteger;
public final class A
{
static PrintWriter out = new PrintWriter(System.out);
static StringBuilder ans=new StringBuilder();
static FastReader in=new FastReader();
static ArrayList<Pair> g[];
static long m... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | d9dd7665f6f5b97e0fbc4f3c81aff816 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public final class Solution {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
static StringTokenizer st;
public static void main(String[] args) thro... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 0b6ffdcc16578a99d579b25e61f995ec | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public final class Solution {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
static StringTokenizer st;
public static void main(String[] args) thro... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 338331776f4a40678dc595a6b5be6548 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.*;
public class Main{
static int total=0;
public static void main(String[] args) {
TaskA solver = new TaskA();
// int t = in.nextInt();
// for (int i = 1; i <= t ; i++) {
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 897fff971296fe079f5c963b80d8900e | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Arrays;
import java.util.Random;
import java.io.FileWriter;
import java.io.PrintWriter;
/*
Solution Created: 19:59:09 29/08/2021
C... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 3c525351df3027098c911419c75722ee | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
//RATING 1800
//Actually a C? but in a Deltix round, whatever that means
//ERRICHTO SOL: https://www.youtube.com/watch?v=7rtZEXAVzmk
public class D2D_CompressedBracketSeq {
static FastReader scan;
public static void main(String[] args) throws Exception{
scan = ne... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 34696f9fb86bbb8d0889e1f8782d3669 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
//--------------------------INPUT READER---------------------------------//
static class fs {
public BufferedReader br;
StringTokenizer st = new StringTokenizer("");
public fs() { this(System.in); }
public fs(I... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 3279fa98292c31ae1c4bb802332dec7b | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.s... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | b8c54414bcb36368a4588dc3934ff086 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.lang.reflect.Array;
import java.text.DecimalFormat;
import java.util.*;
import java.io.*;
public class Equal {
static class pair implements Comparable<pair> {
long level;
long count;
pair(long u, long v) {
this.level = u;
this.count = v;... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 72b97049020f0e181fc8939012f3d618 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes |
import java.util.Scanner;
public class Submit {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long[] a = new long[n+1];
for(int i=1;i<=n;i++){
a[i] = scanner.nextLong();
}
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | ad3c75783beba472076873920412adcf | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static long startTime = System.currentTimeMillis();
// for global initializations and methods starts here
// global initialisations and methods end here
static void run() {
boolean tc = false;
AdityaFastIO r = ne... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 187bf9c5a7271da3c84a090757474bd6 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
public static class F {
static StringBuilder sb;
static long fact[];
static int mod = (int) (1e9 + 7);
static int[] arr = { 0, 1, 11, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111, 1111111111 };
stati... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 594e2ca329d37472baa2fa075d75836d | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
public class c731 {
pu... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 97232e89f600ab95a3f1003f6d59aeb2 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
//--------------------------INPUT READER---------------------------------//
static class fs {
public BufferedReader br;
StringTokenizer st = new StringTokenizer("");
public fs() { this(System.in); }
public fs(I... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 1b54cb6c2d5c73f4844822df1b838e93 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[])
{
FastReader input=new FastReader();
PrintWriter out=new PrintWriter(System.out);
int T=1;
while(T-->0)
{
int n=input.nextInt();
int a[]=new... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | c197ad465ee57aba4476f58d0495597b | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.Writer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputS... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | c2d18bd145491ab46d2934063549472b | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Ishu
{
static Scanner scan = new Scanner(System.in);
static BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
static void tc() throws Exception
{
int n = scan.nextInt();
long[] c = new long[n];
int i, j;
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | b6fd44b8d7111b7991b46fdd15d4a2d4 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class C {
static class RealScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("")... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 20d697e93e62899c8f0c4b96127ef4ff | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class Practice {
public static long mod = (long) Math.pow(10, 9) + 7;
// public static long mod2 = 998244353;
// public static int ... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | dbb40ce2828b34bc5f405ba974cf8a87 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | //package contest.DeltixRoundSummer2021;
import java.io.*;
import java.util.*;
/***********************
* @oj: codeforces
* @id: hitwanyang
* @email: 296866643@qq.com
* @date: 2021/8/30 11:34
* @url: https://codeforc.es/contest/1556/problem/C
***********************/
public class C1556 {
InputS... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 34c1d0fbeefc1eeb634b085770f536cd | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Sol {
final static int LINE_SIZE = 128;
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out), false);
int n;
long[] ar;
void solve() throws Exception {
n = in.nextInt();
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 0d75041c02be0dc203e38dcc994d6302 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
static class SegmentTree { /* Author: Po-Chun Chiu */
int size;
private long[] max;
private long[] min;
public SegmentTree(long[] array){
size = array.length;
max = new long[array.length*4];
min = new long[array.length*4];
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | f60b05a05e35e463496f8f1be3dd44a1 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
public class Test
{
public static void main(String[] args)
{
int tt=1;
//cin >> tt;
while(tt>0)
{
long n;
Scanner sc=new Scanner(System.in);
n=sc.nextLong();
long[] a=new long[(int)n];
for(int i=0;i<n;i++)
a[i]=sc.nextL... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 2b061b6735a41874574563a99030e4bd | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class new1
{
public static void main (String[] args)
{
Scanner s = new Scanner(System.in);
int t = 1;//s.nextInt();
for(int i = 0; i < t; i++) {
int n = s.nextInt()... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 67cc89c613aeade7aff25613be2950b2 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
//BufferedReader f = new BufferedReader(new FileReader("uva.in"));
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new Prin... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | f45a8e9eae66e1aa8bf85dc4bec78210 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import javax.swing.plaf.synth.SynthSpinnerUI;
import java.io.*;
import java.net.StandardSocketOptions;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = (long) 1e9 + 7;
static long inf = (long) 1e16;
static int n, k;
static ArrayList<Integer>... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | f2b59dc244c5ef038098f08d257ebf25 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 14b93375d96c573e678316543342519f | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes |
import java.io.*;
import java.util.*;
public class DeltixSU21C {
public static void solve(IO io) {
int k = io.getInt();
long [] arr = new long[k];
for (int i = 0; i < k; i++) {
arr[i] = io.getLong();
}
long total = 0;
for (int i = 0; i < k; i+= 2) {
long hl = 1;
long hh = arr[i];
... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | ec16df0ffd35f1f0d5d2fa0862a9ba45 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Solution
{
public static void main(String[] args)
{
try (Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))))
{
// int T = in.nextInt();
//
// ... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 50cac10e157772ac32e887e9741cd69d | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes |
import java.io.*;
import java.lang.*;
import java.util.*;
public class C1556 {
public static void main(String[] args) throws IOException{
StringTokenizer st;
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
st = new StringTokenizer(f.readLine());
i... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 8fcf704288b5c310d1000e9ae34887ff | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Brackets {
static BufferedReader bf;
static PrintWriter out;
public static void main (String[] args)throws IOException {
bf = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
// int t = Integer.pa... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 41a577ed326ce93217ff205a993b9c6a | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.math.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
InputReader in = new InputReader(System.in);
// Scanner in = new Scanner(System.in);
// Scanner in = new Scanner(new BufferedReader(new... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 041827b9179002f800ac1665ea0bd186 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
static void main() throws Exception{
int n=sc.nextInt();
int[]in=sc.intArr(n);
long ans=0;
for(int i=0;i<n;i+=2) {
long bal=in[i];
long minBal=in[i];
for(int j=i+1;j<n;j+=2) {
bal-=in[j];
long cur=in[j];
long balance=b... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 1dcc2e6b4c130ab82efc62c89f359050 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.*;
public class Leetcode {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int n=scanner.nextInt();
int [] p=new int[n];
for(int i=0;i<n;i++)
p[i]= scanner.nextInt();
long res=0;
for(int i=0;i<n;i+... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | d0a5e540de14e6f826e04ea08f2bfef5 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.util.Scanner;
public class MyClass {
static Scanner in=new Scanner(System.in);
public static void main(String args[]) {
int n=in.nextInt();
long a[]=new long[n];
long total=0;
for(int i=0;i<n;i++){
a[i]=in.next... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output | |
PASSED | 3ccc9c811816deb0fd69a3dd8ca4e9c6 | train_107.jsonl | 1630247700 | William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even nu... | 256 megabytes | import java.io.*;
import java.util.*;
public class Test {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static PrintWriter pr = new PrintWriter(new OutputStreamWriter(System.out));
static String readLine() throws IOException {
return br.readLi... | Java | ["5\n4 1 2 3 1", "6\n1 3 2 1 2 4", "6\n1 1 1 1 2 2"] | 1 second | ["5", "6", "7"] | NoteIn the first example a sequence (((()(()))( is described. This bracket sequence contains $$$5$$$ subsegments which form regular bracket sequences: Subsequence from the $$$3$$$rd to $$$10$$$th character: (()(())) Subsequence from the $$$4$$$th to $$$5$$$th character: () Subsequence from the $$$4$$$th to $$$9$$$th... | Java 8 | standard input | [
"brute force",
"implementation"
] | ca4ae2484800a98b5592ae65cd45b67f | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 1000)$$$, the size of the compressed sequence. The second line contains a sequence of integers $$$c_1, c_2, \dots, c_n$$$ $$$(1 \le c_i \le 10^9)$$$, the compressed sequence. | 1,800 | Output a single integer — the total number of subsegments of the original bracket sequence, which are regular bracket sequences. It can be proved that the answer fits in the signed 64-bit integer data type. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.