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 | b88cf621201f707cf3a0bf49509ea626 | train_000.jsonl | 1519058100 | Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi access point. This access point can be accessed within a range of r meters (this range can be chosen by... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class Rextester{
static double distance(double x1,double y1,double x2,double y2){
return Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
}
public static void main(String[] args)throws IOException{
BufferedReader br = new ... | Java | ["5 3 3 1 1", "10 5 5 5 15"] | 1 second | ["3.7677669529663684 3.7677669529663684 3.914213562373095", "5.0 5.0 10.0"] | null | Java 11 | standard input | [
"geometry"
] | 29d4ca13888c0e172dde315b66380fe5 | The single line of the input contains 5 space-separated integers R, x1, y1, x2, y2 (1 ≤ R ≤ 105, |x1|, |y1|, |x2|, |y2| ≤ 105). | 1,600 | Print three space-separated numbers xap, yap, r where (xap, yap) is the position which Fifa chose for the access point and r is the radius of its range. Your answer will be considered correct if the radius does not differ from optimal more than 10 - 6 absolutely or relatively, and also the radius you printed can be ch... | standard output | |
PASSED | f44cfb581d76ad65b9fdda31da34a69e | train_000.jsonl | 1519058100 | Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi access point. This access point can be accessed within a range of r meters (this range can be chosen by... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class File {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Flat radius:
double R = sc.nextDouble();
// Flat coordinates:
double x1 = sc.nextDouble();
double y1 = sc.nextDouble();
// Fafa c... | Java | ["5 3 3 1 1", "10 5 5 5 15"] | 1 second | ["3.7677669529663684 3.7677669529663684 3.914213562373095", "5.0 5.0 10.0"] | null | Java 11 | standard input | [
"geometry"
] | 29d4ca13888c0e172dde315b66380fe5 | The single line of the input contains 5 space-separated integers R, x1, y1, x2, y2 (1 ≤ R ≤ 105, |x1|, |y1|, |x2|, |y2| ≤ 105). | 1,600 | Print three space-separated numbers xap, yap, r where (xap, yap) is the position which Fifa chose for the access point and r is the radius of its range. Your answer will be considered correct if the radius does not differ from optimal more than 10 - 6 absolutely or relatively, and also the radius you printed can be ch... | standard output | |
PASSED | 1913f6f8d99b197d72886208f6b61c5f | train_000.jsonl | 1519058100 | Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi access point. This access point can be accessed within a range of r meters (this range can be chosen by... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class File {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Flat radius:
double R = sc.nextDouble();
// Flat coordinates:
double x1 = sc.nextDouble();
double y1 = sc.nextDouble();
// Fafa c... | Java | ["5 3 3 1 1", "10 5 5 5 15"] | 1 second | ["3.7677669529663684 3.7677669529663684 3.914213562373095", "5.0 5.0 10.0"] | null | Java 11 | standard input | [
"geometry"
] | 29d4ca13888c0e172dde315b66380fe5 | The single line of the input contains 5 space-separated integers R, x1, y1, x2, y2 (1 ≤ R ≤ 105, |x1|, |y1|, |x2|, |y2| ≤ 105). | 1,600 | Print three space-separated numbers xap, yap, r where (xap, yap) is the position which Fifa chose for the access point and r is the radius of its range. Your answer will be considered correct if the radius does not differ from optimal more than 10 - 6 absolutely or relatively, and also the radius you printed can be ch... | standard output | |
PASSED | 76299006f2f0dea9f4c3f02dfecd092b | train_000.jsonl | 1299340800 | The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the history of magic teacher, lectures in such a boring and monotonous voice, that he has ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class CodeD
{
static class Scanner
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
... | Java | ["3\n1875\n1936\n1721", "4\n9999\n2000\n3000\n3011", "3\n1999\n5055\n2000"] | 1 second | ["1835\n1836\n1921", "1999\n2000\n2000\n2011", "No solution"] | null | Java 7 | standard input | [
"implementation",
"greedy",
"brute force"
] | c175d010d75c391d0b25391fecff007c | The first input line contains an integer n (1 ≤ n ≤ 1000). It represents the number of dates in Harry's notes. Next n lines contain the actual dates y1, y2, ..., yn, each line contains a date. Each date is a four-digit integer (1000 ≤ yi ≤ 9999). | 1,700 | Print n numbers z1, z2, ..., zn (1000 ≤ zi ≤ 2011). They are Ron's resulting dates. Print each number on a single line. Numbers zi must form the non-decreasing sequence. Each number zi should differ from the corresponding date yi in no more than one digit. It is not allowed to change the first digit of a number into 0.... | standard output | |
PASSED | 99e937d93af32c25bba0b1e198446c94 | train_000.jsonl | 1299340800 | The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the history of magic teacher, lectures in such a boring and monotonous voice, that he has ... | 256 megabytes | import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Closeable;
import java.util.Iterator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.Inpu... | Java | ["3\n1875\n1936\n1721", "4\n9999\n2000\n3000\n3011", "3\n1999\n5055\n2000"] | 1 second | ["1835\n1836\n1921", "1999\n2000\n2000\n2011", "No solution"] | null | Java 7 | standard input | [
"implementation",
"greedy",
"brute force"
] | c175d010d75c391d0b25391fecff007c | The first input line contains an integer n (1 ≤ n ≤ 1000). It represents the number of dates in Harry's notes. Next n lines contain the actual dates y1, y2, ..., yn, each line contains a date. Each date is a four-digit integer (1000 ≤ yi ≤ 9999). | 1,700 | Print n numbers z1, z2, ..., zn (1000 ≤ zi ≤ 2011). They are Ron's resulting dates. Print each number on a single line. Numbers zi must form the non-decreasing sequence. Each number zi should differ from the corresponding date yi in no more than one digit. It is not allowed to change the first digit of a number into 0.... | standard output | |
PASSED | 43d33cc4dc26b9657d7eb0e82016b8b5 | train_000.jsonl | 1299340800 | The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the history of magic teacher, lectures in such a boring and monotonous voice, that he has ... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
i... | Java | ["3\n1875\n1936\n1721", "4\n9999\n2000\n3000\n3011", "3\n1999\n5055\n2000"] | 1 second | ["1835\n1836\n1921", "1999\n2000\n2000\n2011", "No solution"] | null | Java 7 | standard input | [
"implementation",
"greedy",
"brute force"
] | c175d010d75c391d0b25391fecff007c | The first input line contains an integer n (1 ≤ n ≤ 1000). It represents the number of dates in Harry's notes. Next n lines contain the actual dates y1, y2, ..., yn, each line contains a date. Each date is a four-digit integer (1000 ≤ yi ≤ 9999). | 1,700 | Print n numbers z1, z2, ..., zn (1000 ≤ zi ≤ 2011). They are Ron's resulting dates. Print each number on a single line. Numbers zi must form the non-decreasing sequence. Each number zi should differ from the corresponding date yi in no more than one digit. It is not allowed to change the first digit of a number into 0.... | standard output | |
PASSED | a4a6fd52bc86caecac74e3d686dfac50 | train_000.jsonl | 1299340800 | The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the history of magic teacher, lectures in such a boring and monotonous voice, that he has ... | 256 megabytes | import java.util.*;
public class QFF {
static Scanner input = new Scanner(System.in);
public static void main(String[] args) {
int n=input.nextInt(),i,max1;
String alls[] = new String [n];
int tmp,j;
boolean start=false,end=false;
int[][] all = new int[n][4];
int... | Java | ["3\n1875\n1936\n1721", "4\n9999\n2000\n3000\n3011", "3\n1999\n5055\n2000"] | 1 second | ["1835\n1836\n1921", "1999\n2000\n2000\n2011", "No solution"] | null | Java 7 | standard input | [
"implementation",
"greedy",
"brute force"
] | c175d010d75c391d0b25391fecff007c | The first input line contains an integer n (1 ≤ n ≤ 1000). It represents the number of dates in Harry's notes. Next n lines contain the actual dates y1, y2, ..., yn, each line contains a date. Each date is a four-digit integer (1000 ≤ yi ≤ 9999). | 1,700 | Print n numbers z1, z2, ..., zn (1000 ≤ zi ≤ 2011). They are Ron's resulting dates. Print each number on a single line. Numbers zi must form the non-decreasing sequence. Each number zi should differ from the corresponding date yi in no more than one digit. It is not allowed to change the first digit of a number into 0.... | standard output | |
PASSED | 79687ebc2c8f1ceb1f55bac75b4e79d5 | train_000.jsonl | 1299340800 | The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the history of magic teacher, lectures in such a boring and monotonous voice, that he has ... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Code implements Runnable {
public static void main(String[] args) throws IOException {
new Thread(new Code()).start();
}
private void solve() throws IOException {
int n = nextInt();
String[] dates... | Java | ["3\n1875\n1936\n1721", "4\n9999\n2000\n3000\n3011", "3\n1999\n5055\n2000"] | 1 second | ["1835\n1836\n1921", "1999\n2000\n2000\n2011", "No solution"] | null | Java 7 | standard input | [
"implementation",
"greedy",
"brute force"
] | c175d010d75c391d0b25391fecff007c | The first input line contains an integer n (1 ≤ n ≤ 1000). It represents the number of dates in Harry's notes. Next n lines contain the actual dates y1, y2, ..., yn, each line contains a date. Each date is a four-digit integer (1000 ≤ yi ≤ 9999). | 1,700 | Print n numbers z1, z2, ..., zn (1000 ≤ zi ≤ 2011). They are Ron's resulting dates. Print each number on a single line. Numbers zi must form the non-decreasing sequence. Each number zi should differ from the corresponding date yi in no more than one digit. It is not allowed to change the first digit of a number into 0.... | standard output | |
PASSED | 17bf933fb452e4287e36d808228eaa20 | train_000.jsonl | 1299340800 | The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the history of magic teacher, lectures in such a boring and monotonous voice, that he has ... | 256 megabytes | import java.util.Random;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.Pr... | Java | ["3\n1875\n1936\n1721", "4\n9999\n2000\n3000\n3011", "3\n1999\n5055\n2000"] | 1 second | ["1835\n1836\n1921", "1999\n2000\n2000\n2011", "No solution"] | null | Java 7 | standard input | [
"implementation",
"greedy",
"brute force"
] | c175d010d75c391d0b25391fecff007c | The first input line contains an integer n (1 ≤ n ≤ 1000). It represents the number of dates in Harry's notes. Next n lines contain the actual dates y1, y2, ..., yn, each line contains a date. Each date is a four-digit integer (1000 ≤ yi ≤ 9999). | 1,700 | Print n numbers z1, z2, ..., zn (1000 ≤ zi ≤ 2011). They are Ron's resulting dates. Print each number on a single line. Numbers zi must form the non-decreasing sequence. Each number zi should differ from the corresponding date yi in no more than one digit. It is not allowed to change the first digit of a number into 0.... | standard output | |
PASSED | 5724a31830057dfe111ef69ecdd87722 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import static java.lang.Integer.parseInt;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class C {
static long[][] trees;
public static void main(String[] args) throws Throwable{
BufferedReader in =new BufferedReader(new InputStreamReader(System.in));
i... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 7870221167d44be7e0bb8ff095da91c7 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Problem545C {
public static void main(String[] args) {
InputReader in = new InputReader();
PrintWriter out = new PrintWriter(System.out);
new P... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 03e16cd05ee4cdda25af43ed925563f2 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.util.Scanner;
public class WoodCutters {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long n=sc.nextInt();
long[] position=new long[(int) (n+1)];
long[] height=new long[(int) (n+1)];
for(int i=1;i<=n;i++)
{
position[i]=sc.nextInt();
height[i]=sc.nextInt... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 1478effc9f62bf74b088d0a7864bc90b | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String []args){
Scanner s=new Scanner(System.in);
int n=s.nextInt();
long p[][]=new long[n][2];
int i,j;
for(i=0;i<n;i++){
p[i][0]=s.nextLong();
p[i][1]=s.nextLong();
}
int count=2;
long occup=0;
for(i=1;i<n-1;i++){
if(p[... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 29b3c96716b1b1722a528ed19d5c06c4 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | //package codeforces;
import java.util.Scanner;
/**
* Created by nitin.s on 30/05/15.
*/
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] x = new int[n];
int[] h = new int[n];
for(int i = 0; i < ... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 92d93229d89089904f499cf20421f57a | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | //package c303;
import java.util.Scanner;
public class q3
{
public static void main(String rag[])
{
Scanner s=new Scanner(System.in);
int n=s.nextInt();
long x[]=new long[n];
long h[]=new long[n];
for(int i=0;i<n;i++)
{
x[i]=s.nextLong();
... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 5a71293ec5213af59a6ae5072e85d29e | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.util.Scanner;
/**
* Created by yakoub on 04/09/15.
*/
public class WoodCutter {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int steady[] = new int[n];
int left[] = new int[n];
int right[] = new i... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 049bc4524261a2b9c05cef19945f372f | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class WoodCutters {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 08a64d09cd2216adc42ad2c207904d93 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.util.Scanner;
public class Test
{
private static int[] x = new int[100010];
private static int[] h = new int[100010];
private static int[][] dp = new int[100010][3]; // dp[i][0] 表示向左倒, dp[i][1]表示不动,dp[i][2]表示向右倒
// srm 168 div2
public static void main(String[] args)
... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 88c4ae2950fdd4c3ec866b78c17db772 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | //package srm303;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Woodcuters {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 1a70705a1f2bc389e5bde86e8fd516f3 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.io.IOException;
import java.util.Scanner;
public class Woodcutters {
public static void main(String[] args) throws IOException {
Scanner kb = new Scanner(System.in);
int numOfTrees = kb.nextInt();
kb.nextLine();
Node[] trees = new Node[numOfTrees];
for (int i = 0; i < numOfTrees; i+... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 8e42e9e92fe9d168f49e7930d55a211c | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Erasyl Abenov
*
*
*/
pub... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | a7d53d95a3042b32ace4b8dfab25f545 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.util.Scanner;
/**
* Created by alex on 19.05.15.
*/
public class C {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long x[] = new long[n];
long h[] = new long[n];
for (int i = 0; i < n; i++) {
... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | fd3ca8e252e4ee703f1fde44103a9154 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
TaskC a= new TaskC();
a.solve(sc);
}
}
class TaskC{
//int [] dp = new int[10000];
//int [] tree = new int[100005];
public int solve(Scanner sc){
int n=sc.nextInt();
int lef... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | b6237122b5948d9a32b394e897bbc932 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.util.Scanner;
public class Woodcutters {
public static void main(String[] args) {
int i,j,s=2;
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a=new int[n];
int[] b=new int[n];
for(i=... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 40b7860aaa3d44b5e860ec8d25060901 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Solution545C {
public static void main(String... bob) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 600e74f47aec37ced144d6590144da75 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | /**
* Created by kapilkrishnakumar on 10/21/15.
*/
import java.util.*;
public class WoodCutter {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x[] = new int[n];
int h[] = new int[n];
for (int i = 0; i < n; i++) {
... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 308d99557822c98d5e727a53f6b68154 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class C {
private static class Tree {
int position;
int height;
public Tree(int position, int height) {
this.position = position;
... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | edbeb2fe9795544363e211b557054667 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
public class C {
static int n;
static int[][] trees;
static int[][] max;
public static void main(String[] args) thr... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 794abd22bd3c9ea1f9e2b3a806999172 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.IOException;
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.HashSet;
import java.util.InputMismatchException;
import java.util.Linked... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 1a96f5ab75fd4a6938b63007f4676500 | train_000.jsonl | 1432053000 | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.There are n trees located along the road at points with coordinates x1, x2, ..., xn. Each tr... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.IOException;
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.HashSet;
import java.util.InputMismatchException;
import java.util.Linked... | Java | ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1"] | 1 second | ["3", "4"] | NoteIn the first sample you can fell the trees like that: fell the 1-st tree to the left — now it occupies segment [ - 1;1] fell the 2-nd tree to the right — now it occupies segment [2;3] leave the 3-rd tree — it occupies point 5 leave the 4-th tree — it occupies point 10 fell the 5-th tree to the right — now it ... | Java 7 | standard input | [
"dp",
"greedy"
] | a850dd88a67a6295823e70e2c5c857c9 | The first line contains integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contain pairs of integers xi, hi (1 ≤ xi, hi ≤ 109) — the coordinate and the height of the і-th tree. The pairs are given in the order of ascending xi. No two trees are located at the point with the same coordinate. | 1,500 | Print a single number — the maximum number of trees that you can cut down by the given rules. | standard output | |
PASSED | 0c030e8618ef2e4b898a7cf3a3c0a1d5 | train_000.jsonl | 1514037900 | A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larg... | 256 megabytes | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF907A extends PrintWriter {
CF907A() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF907A o = new CF907A(); o.main(); o.flush();
}
void main() {
int a = sc.nextInt();
int b ... | Java | ["50 30 10 10", "100 50 10 21"] | 2 seconds | ["50\n30\n10", "-1"] | NoteIn first test case all conditions for cars' sizes are satisfied.In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20. | Java 11 | standard input | [
"implementation",
"brute force"
] | 56535017d012fdfcc13695dfd5b33084 | You are given four integers V1, V2, V3, Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3. | 1,300 | Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively. If there are multiple possible solutions, print any. If there is no solution, print "-1" (without quotes). | standard output | |
PASSED | 99dc2d0ffae34b62a675ee4ddfd1450e | train_000.jsonl | 1514037900 | A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larg... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.io.BufferedOutputStream;
import java.util.StringTokenizer;
import java.io.Closeable;
import... | Java | ["50 30 10 10", "100 50 10 21"] | 2 seconds | ["50\n30\n10", "-1"] | NoteIn first test case all conditions for cars' sizes are satisfied.In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20. | Java 11 | standard input | [
"implementation",
"brute force"
] | 56535017d012fdfcc13695dfd5b33084 | You are given four integers V1, V2, V3, Vm(1 ≤ Vi ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that V1 > V2 > V3. | 1,300 | Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively. If there are multiple possible solutions, print any. If there is no solution, print "-1" (without quotes). | standard output | |
PASSED | fb2d702e931b378fb21f07855a7aa763 | train_000.jsonl | 1472472300 | ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into the empty cell.Chris tried filling in rando... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class start {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
// ... | Java | ["3\n4 0 2\n3 5 7\n8 1 6", "4\n1 1 1 1\n1 1 0 1\n1 1 1 1\n1 1 1 1", "4\n1 1 1 1\n1 1 0 1\n1 1 2 1\n1 1 1 1"] | 2 seconds | ["9", "1", "-1"] | NoteIn the first sample case, we can fill in 9 into the empty cell to make the resulting grid a magic square. Indeed, The sum of numbers in each row is:4 + 9 + 2 = 3 + 5 + 7 = 8 + 1 + 6 = 15.The sum of numbers in each column is:4 + 3 + 8 = 9 + 5 + 1 = 2 + 7 + 6 = 15.The sum of numbers in the two diagonals is:4 + 5 + 6 ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 3bd5a228ed5faf997956570f96becd73 | The first line of the input contains a single integer n (1 ≤ n ≤ 500) — the number of rows and columns of the magic grid. n lines follow, each of them contains n integers. The j-th number in the i-th of them denotes ai, j (1 ≤ ai, j ≤ 109 or ai, j = 0), the number in the i-th row and j-th column of the magic grid. If t... | 1,400 | Output a single integer, the positive integer x (1 ≤ x ≤ 1018) that should be filled in the empty cell so that the whole grid becomes a magic square. If such positive integer x does not exist, output - 1 instead. If there are multiple solutions, you may print any of them. | standard output | |
PASSED | 96f95e009d4fe175b1c47f00234d651d | train_000.jsonl | 1472472300 | ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into the empty cell.Chris tried filling in rando... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.math.MathContext;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class Main {
public static void main(String[] args) throws IOException{
InputReader in = new InputReader(System.in);
Printer out = new Prin... | Java | ["3\n4 0 2\n3 5 7\n8 1 6", "4\n1 1 1 1\n1 1 0 1\n1 1 1 1\n1 1 1 1", "4\n1 1 1 1\n1 1 0 1\n1 1 2 1\n1 1 1 1"] | 2 seconds | ["9", "1", "-1"] | NoteIn the first sample case, we can fill in 9 into the empty cell to make the resulting grid a magic square. Indeed, The sum of numbers in each row is:4 + 9 + 2 = 3 + 5 + 7 = 8 + 1 + 6 = 15.The sum of numbers in each column is:4 + 3 + 8 = 9 + 5 + 1 = 2 + 7 + 6 = 15.The sum of numbers in the two diagonals is:4 + 5 + 6 ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 3bd5a228ed5faf997956570f96becd73 | The first line of the input contains a single integer n (1 ≤ n ≤ 500) — the number of rows and columns of the magic grid. n lines follow, each of them contains n integers. The j-th number in the i-th of them denotes ai, j (1 ≤ ai, j ≤ 109 or ai, j = 0), the number in the i-th row and j-th column of the magic grid. If t... | 1,400 | Output a single integer, the positive integer x (1 ≤ x ≤ 1018) that should be filled in the empty cell so that the whole grid becomes a magic square. If such positive integer x does not exist, output - 1 instead. If there are multiple solutions, you may print any of them. | standard output | |
PASSED | b40e1161819ca03043315d2a0f78dfc4 | train_000.jsonl | 1472472300 | ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into the empty cell.Chris tried filling in rando... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class CF_711B {
public static void main(String args[]) {
MScanner sc = new MScanner();
int n = sc.nextInt();
long[][] arr = new long[n][n];
int x = 0, y = 0;
for (int i = 0;... | Java | ["3\n4 0 2\n3 5 7\n8 1 6", "4\n1 1 1 1\n1 1 0 1\n1 1 1 1\n1 1 1 1", "4\n1 1 1 1\n1 1 0 1\n1 1 2 1\n1 1 1 1"] | 2 seconds | ["9", "1", "-1"] | NoteIn the first sample case, we can fill in 9 into the empty cell to make the resulting grid a magic square. Indeed, The sum of numbers in each row is:4 + 9 + 2 = 3 + 5 + 7 = 8 + 1 + 6 = 15.The sum of numbers in each column is:4 + 3 + 8 = 9 + 5 + 1 = 2 + 7 + 6 = 15.The sum of numbers in the two diagonals is:4 + 5 + 6 ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 3bd5a228ed5faf997956570f96becd73 | The first line of the input contains a single integer n (1 ≤ n ≤ 500) — the number of rows and columns of the magic grid. n lines follow, each of them contains n integers. The j-th number in the i-th of them denotes ai, j (1 ≤ ai, j ≤ 109 or ai, j = 0), the number in the i-th row and j-th column of the magic grid. If t... | 1,400 | Output a single integer, the positive integer x (1 ≤ x ≤ 1018) that should be filled in the empty cell so that the whole grid becomes a magic square. If such positive integer x does not exist, output - 1 instead. If there are multiple solutions, you may print any of them. | standard output | |
PASSED | d5eec2c6ba76e10102477fccf9ef8707 | train_000.jsonl | 1472472300 | ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into the empty cell.Chris tried filling in rando... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Q5
{
public static void main(String args[])throws IOException
{
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out);
int n,i,j;
n=in.readInt();
long a[][]=new long[n... | Java | ["3\n4 0 2\n3 5 7\n8 1 6", "4\n1 1 1 1\n1 1 0 1\n1 1 1 1\n1 1 1 1", "4\n1 1 1 1\n1 1 0 1\n1 1 2 1\n1 1 1 1"] | 2 seconds | ["9", "1", "-1"] | NoteIn the first sample case, we can fill in 9 into the empty cell to make the resulting grid a magic square. Indeed, The sum of numbers in each row is:4 + 9 + 2 = 3 + 5 + 7 = 8 + 1 + 6 = 15.The sum of numbers in each column is:4 + 3 + 8 = 9 + 5 + 1 = 2 + 7 + 6 = 15.The sum of numbers in the two diagonals is:4 + 5 + 6 ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 3bd5a228ed5faf997956570f96becd73 | The first line of the input contains a single integer n (1 ≤ n ≤ 500) — the number of rows and columns of the magic grid. n lines follow, each of them contains n integers. The j-th number in the i-th of them denotes ai, j (1 ≤ ai, j ≤ 109 or ai, j = 0), the number in the i-th row and j-th column of the magic grid. If t... | 1,400 | Output a single integer, the positive integer x (1 ≤ x ≤ 1018) that should be filled in the empty cell so that the whole grid becomes a magic square. If such positive integer x does not exist, output - 1 instead. If there are multiple solutions, you may print any of them. | standard output | |
PASSED | 7af7471c1d6570d668aa3651965f087c | train_000.jsonl | 1472472300 | ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into the empty cell.Chris tried filling in rando... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
... | Java | ["3\n4 0 2\n3 5 7\n8 1 6", "4\n1 1 1 1\n1 1 0 1\n1 1 1 1\n1 1 1 1", "4\n1 1 1 1\n1 1 0 1\n1 1 2 1\n1 1 1 1"] | 2 seconds | ["9", "1", "-1"] | NoteIn the first sample case, we can fill in 9 into the empty cell to make the resulting grid a magic square. Indeed, The sum of numbers in each row is:4 + 9 + 2 = 3 + 5 + 7 = 8 + 1 + 6 = 15.The sum of numbers in each column is:4 + 3 + 8 = 9 + 5 + 1 = 2 + 7 + 6 = 15.The sum of numbers in the two diagonals is:4 + 5 + 6 ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 3bd5a228ed5faf997956570f96becd73 | The first line of the input contains a single integer n (1 ≤ n ≤ 500) — the number of rows and columns of the magic grid. n lines follow, each of them contains n integers. The j-th number in the i-th of them denotes ai, j (1 ≤ ai, j ≤ 109 or ai, j = 0), the number in the i-th row and j-th column of the magic grid. If t... | 1,400 | Output a single integer, the positive integer x (1 ≤ x ≤ 1018) that should be filled in the empty cell so that the whole grid becomes a magic square. If such positive integer x does not exist, output - 1 instead. If there are multiple solutions, you may print any of them. | standard output | |
PASSED | 029efab3dfd7d38510ddc3d20ff69cef | train_000.jsonl | 1472472300 | ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into the empty cell.Chris tried filling in rando... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.lang.*;
public class Submission {
private static BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args){
try{
... | Java | ["3\n4 0 2\n3 5 7\n8 1 6", "4\n1 1 1 1\n1 1 0 1\n1 1 1 1\n1 1 1 1", "4\n1 1 1 1\n1 1 0 1\n1 1 2 1\n1 1 1 1"] | 2 seconds | ["9", "1", "-1"] | NoteIn the first sample case, we can fill in 9 into the empty cell to make the resulting grid a magic square. Indeed, The sum of numbers in each row is:4 + 9 + 2 = 3 + 5 + 7 = 8 + 1 + 6 = 15.The sum of numbers in each column is:4 + 3 + 8 = 9 + 5 + 1 = 2 + 7 + 6 = 15.The sum of numbers in the two diagonals is:4 + 5 + 6 ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 3bd5a228ed5faf997956570f96becd73 | The first line of the input contains a single integer n (1 ≤ n ≤ 500) — the number of rows and columns of the magic grid. n lines follow, each of them contains n integers. The j-th number in the i-th of them denotes ai, j (1 ≤ ai, j ≤ 109 or ai, j = 0), the number in the i-th row and j-th column of the magic grid. If t... | 1,400 | Output a single integer, the positive integer x (1 ≤ x ≤ 1018) that should be filled in the empty cell so that the whole grid becomes a magic square. If such positive integer x does not exist, output - 1 instead. If there are multiple solutions, you may print any of them. | standard output | |
PASSED | c66ad94fc3491031a844e79945b50aa6 | train_000.jsonl | 1472472300 | ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into the empty cell.Chris tried filling in rando... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.math.*;
public class aprail152
{
static class InputReader {
private InputStream stream;
private byte[] inbuf = new byte[1024];
private int start= 0;
private int end = 0;
public InputReader(InputStream stream) {
th... | Java | ["3\n4 0 2\n3 5 7\n8 1 6", "4\n1 1 1 1\n1 1 0 1\n1 1 1 1\n1 1 1 1", "4\n1 1 1 1\n1 1 0 1\n1 1 2 1\n1 1 1 1"] | 2 seconds | ["9", "1", "-1"] | NoteIn the first sample case, we can fill in 9 into the empty cell to make the resulting grid a magic square. Indeed, The sum of numbers in each row is:4 + 9 + 2 = 3 + 5 + 7 = 8 + 1 + 6 = 15.The sum of numbers in each column is:4 + 3 + 8 = 9 + 5 + 1 = 2 + 7 + 6 = 15.The sum of numbers in the two diagonals is:4 + 5 + 6 ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 3bd5a228ed5faf997956570f96becd73 | The first line of the input contains a single integer n (1 ≤ n ≤ 500) — the number of rows and columns of the magic grid. n lines follow, each of them contains n integers. The j-th number in the i-th of them denotes ai, j (1 ≤ ai, j ≤ 109 or ai, j = 0), the number in the i-th row and j-th column of the magic grid. If t... | 1,400 | Output a single integer, the positive integer x (1 ≤ x ≤ 1018) that should be filled in the empty cell so that the whole grid becomes a magic square. If such positive integer x does not exist, output - 1 instead. If there are multiple solutions, you may print any of them. | standard output | |
PASSED | ea54c5fc717e9f42dc4397ae4d00bcbf | train_000.jsonl | 1472472300 | ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into the empty cell.Chris tried filling in rando... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
public class B {
int N;
long[][] a;
int y,x;
public boolean check1(){
long[] row = new long[N];
long[] col= new long[N];
long[] dia = new long[2];
for(int i = 0;i < N;i++){
if(i ... | Java | ["3\n4 0 2\n3 5 7\n8 1 6", "4\n1 1 1 1\n1 1 0 1\n1 1 1 1\n1 1 1 1", "4\n1 1 1 1\n1 1 0 1\n1 1 2 1\n1 1 1 1"] | 2 seconds | ["9", "1", "-1"] | NoteIn the first sample case, we can fill in 9 into the empty cell to make the resulting grid a magic square. Indeed, The sum of numbers in each row is:4 + 9 + 2 = 3 + 5 + 7 = 8 + 1 + 6 = 15.The sum of numbers in each column is:4 + 3 + 8 = 9 + 5 + 1 = 2 + 7 + 6 = 15.The sum of numbers in the two diagonals is:4 + 5 + 6 ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 3bd5a228ed5faf997956570f96becd73 | The first line of the input contains a single integer n (1 ≤ n ≤ 500) — the number of rows and columns of the magic grid. n lines follow, each of them contains n integers. The j-th number in the i-th of them denotes ai, j (1 ≤ ai, j ≤ 109 or ai, j = 0), the number in the i-th row and j-th column of the magic grid. If t... | 1,400 | Output a single integer, the positive integer x (1 ≤ x ≤ 1018) that should be filled in the empty cell so that the whole grid becomes a magic square. If such positive integer x does not exist, output - 1 instead. If there are multiple solutions, you may print any of them. | standard output | |
PASSED | 79801bde4de97cc949bd89d91d4e1cbe | train_000.jsonl | 1472472300 | ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into the empty cell.Chris tried filling in rando... | 256 megabytes | import java.util.Scanner;
public class Problem711B
{
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
int n = Integer.parseInt(s.nextLine());
long[][] square = new long[n][n];
int row = 0;
int col = 0;
for (int i = 0; i < n; i++)
{
String[] line = s.nextLine().spli... | Java | ["3\n4 0 2\n3 5 7\n8 1 6", "4\n1 1 1 1\n1 1 0 1\n1 1 1 1\n1 1 1 1", "4\n1 1 1 1\n1 1 0 1\n1 1 2 1\n1 1 1 1"] | 2 seconds | ["9", "1", "-1"] | NoteIn the first sample case, we can fill in 9 into the empty cell to make the resulting grid a magic square. Indeed, The sum of numbers in each row is:4 + 9 + 2 = 3 + 5 + 7 = 8 + 1 + 6 = 15.The sum of numbers in each column is:4 + 3 + 8 = 9 + 5 + 1 = 2 + 7 + 6 = 15.The sum of numbers in the two diagonals is:4 + 5 + 6 ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 3bd5a228ed5faf997956570f96becd73 | The first line of the input contains a single integer n (1 ≤ n ≤ 500) — the number of rows and columns of the magic grid. n lines follow, each of them contains n integers. The j-th number in the i-th of them denotes ai, j (1 ≤ ai, j ≤ 109 or ai, j = 0), the number in the i-th row and j-th column of the magic grid. If t... | 1,400 | Output a single integer, the positive integer x (1 ≤ x ≤ 1018) that should be filled in the empty cell so that the whole grid becomes a magic square. If such positive integer x does not exist, output - 1 instead. If there are multiple solutions, you may print any of them. | standard output | |
PASSED | fea7da5d9af4162e7ae86c486a066d94 | train_000.jsonl | 1472472300 | ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to fill a positive integer into the empty cell.Chris tried filling in rando... | 256 megabytes | import java.util.Scanner;
public class main {
public static void main(String[] args) {
kvadrat();
}
private static void kvadrat(){
try{
Scanner s = new Scanner(System.in);
long size = s.nextInt();
if(size == 1){
System.out.println(1);
return;
}
long zx = 0;
long zy = 0;
long[] size... | Java | ["3\n4 0 2\n3 5 7\n8 1 6", "4\n1 1 1 1\n1 1 0 1\n1 1 1 1\n1 1 1 1", "4\n1 1 1 1\n1 1 0 1\n1 1 2 1\n1 1 1 1"] | 2 seconds | ["9", "1", "-1"] | NoteIn the first sample case, we can fill in 9 into the empty cell to make the resulting grid a magic square. Indeed, The sum of numbers in each row is:4 + 9 + 2 = 3 + 5 + 7 = 8 + 1 + 6 = 15.The sum of numbers in each column is:4 + 3 + 8 = 9 + 5 + 1 = 2 + 7 + 6 = 15.The sum of numbers in the two diagonals is:4 + 5 + 6 ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 3bd5a228ed5faf997956570f96becd73 | The first line of the input contains a single integer n (1 ≤ n ≤ 500) — the number of rows and columns of the magic grid. n lines follow, each of them contains n integers. The j-th number in the i-th of them denotes ai, j (1 ≤ ai, j ≤ 109 or ai, j = 0), the number in the i-th row and j-th column of the magic grid. If t... | 1,400 | Output a single integer, the positive integer x (1 ≤ x ≤ 1018) that should be filled in the empty cell so that the whole grid becomes a magic square. If such positive integer x does not exist, output - 1 instead. If there are multiple solutions, you may print any of them. | standard output | |
PASSED | b637fe5b47e35e5a80801fa6c9b3a393 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
/*
Once a legend said : "Tries matlab string manipulation...for other info, go to page number 352 of the book."
*/
public class Main implements Runnable {
public boolean required(char[] s) {
... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 6b37738be245a56e323df45f98438457 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class SolD{
public static void main(String[] args){
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int n = sc.nextInt();
long k = sc.nextLong();
String s = sc.next();
char[] ch... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 362d0bc5b304ac79766de46c0c7bc3eb | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.*;
public class Main {
static class Task {
int NN = 200005;
int MOD = 1000000007;
int INF = 2000000000;
long INFINITY = 2000000000000000000L;
public void solve(InputReader in, PrintWriter out) {
int n = in.nextInt();
int k = in.nex... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 09be004dcd59f0d73aa36019a708b0f6 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class Solve5 {
public static void... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | c4259b6ee1bc4be94b704d2a4a6d3fa5 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF1333D extends PrintWriter {
CF1333D() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1333D o = new CF1333D(); o.main(); o.flush();
}
static class V {
V next;
int i;
V(int i) {
this.i = i;
}
}
... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | a6f6eccf1683975e547ebf673a6addc4 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | // upsolve with kaiboy
import java.io.*;
import java.util.*;
public class CF1333D extends PrintWriter {
CF1333D() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1333D o = new CF1333D(); o.main(); o.flush();
}
void main() {
int n = sc.nextInt();
int k = s... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | d6cf617e6df1e73af6534c814dc12307 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Solution {
public static void main(String[] args) throws IOException {
FastReader in = new FastReader(System.in);
StringBuilder sb = new StringBuilder();
int i, j;
int n = in.nextInt();
... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | ed95e064cc4a42df5086b2438e680d66 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf1333d {
public static void main(String[] args) throws IOException {
int n = rni(), k = ni(), cnt = 0;
char[] s = rcha();
long maxk = 0;
for (int i = 0; i < n; ++i... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 2e4c257c537bfd70c2505ae30bddfcf4 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.BufferedOutputStream;
import java.util.StringTokenizer;
impo... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 0d323c011191a97dab8c81955f1a3a7c | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class D {
static class Task {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
int k = in.nextInt();
String str = in.... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | e912064038fe536c38127dbe837c4d21 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) throws Exception
{
new D().run();
}
LinkedList<Integer> inversionLoca... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 22381d41373ec156d44049f5665e90e2 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public c... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | d5ab5948ca3d6165058f8515a80d4c9e | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.util.LinkedList;
import java.util.Queue;
import java.util.ArrayList;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Random;
import java.io.FileWriter;
import j... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 5d1886020075eb0b9101e2ed1874a398 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | //package round632;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;
public class D {
InputStream is;
PrintWriter out;
String I... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | a0090c36c962913007f299b2e270dd81 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class D {
static class Task {
private void swap(char[] arr, int i, int j) {
char t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
public void solve(... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 8b3dfb2be5b6c6f6b893d53e4f660111 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class D {
static class Task {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
int k = in.nextInt();
String str = in.... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 7d44c5ef74231f40eae36a1145d8bef4 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class SolD{
public static void main(String[] args){
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int n = sc.nextInt();
long k = sc.nextLong();
String s = sc.next();
char[] ch... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 860b5c1d3e5715b7d5c5937b3af94c63 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
public class Main {
static int[][] vis;
static void solve(TreeMap<Integer, Integer>rmap, TreeMap<Integer, Integer>gmap, TreeMap<Integer, Integer>bmap){
}
public static void main(Str... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 07b5fd4525736fcbc8d7b0c9798327b7 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
static void main() throws Exception {
int n = sc.nextInt();
int k = sc.nextInt();
String c = sc.nextLine();
StringBuilder sb = new StringBuilder(c);
boolean changed = true;
List<Integer>[] arr = new ArrayList[k];
int m = 0;
boolean fail... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 0ab3e9c7bfd9b6ccf1cc8cdc593f711a | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.io.Writer;
impo... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | ff3827b5055b57fb06c30456e698cc81 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.*;
public class D {
public final static int RIGHT = 1;
public final static int LEFT = -1;
public static void main(String args[]) throws IOException {
Scanner in = new Scanner(System.in);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(Syste... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | e2f9179430e2c2d5159303be2f8e38a7 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private void swap(char[] a, int i, int j) {
char tmp = a[i]; a[i] = a[j]; a[j] = tmp;
}
private void solve() {
int n = sc.nextInt();
int k = sc.nextInt();
String s = sc.next();
char[] a = s.toCharArray();
... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | e738cc46570a3572624d2e12b7d1bc92 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes |
import java.io.*;
import java.util.*;
public class D{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
PrintWriter pw = new PrintWriter(System.out);
int n = Integ... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 1607f947bf9b5d822a6f2bac2e006d90 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main implements Runnable
{
boolean multiple = false;
long MOD;
@SuppressWarnings({"Duplicates", "ConstantConditions"})
void solve() throws Exception
{
int n = sc.nextInt();
int k = sc.nextInt();
... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 8532bc890cfe34b30d1b2f2aecbcb954 | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
public class D {
pub... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | 200f83a1647dafd416afa1938b7ae8fc | train_000.jsonl | 1586356500 | There are $$$n$$$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a row and turned heads either to the left or to the right.Children can do the following: in one second several pairs of neighbo... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is a... | Java | ["2 1\nRL", "2 1\nLR", "4 2\nRLRL"] | 2 seconds | ["1 1", "-1", "2 1 3 \n1 2"] | NoteThe first sample contains a pair of children who look at each other. After one move, they can finish the process.In the second sample, children can't make any move. As a result, they can't end in $$$k>0$$$ moves.The third configuration is described in the statement. | Java 11 | standard input | [
"greedy",
"graphs",
"constructive algorithms",
"games",
"implementation",
"sortings",
"brute force"
] | dfe0f5da0cb90706f33365009d9baf5b | The first line of input contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 3000$$$, $$$1 \le k \le 3000000$$$) — the number of children and required number of moves. The next line contains a string of length $$$n$$$ and consists only of characters L and R, where L means that the child looks to the left and R me... | 2,100 | If there is no solution, print a single line with number $$$-1$$$. Otherwise, output $$$k$$$ lines. Each line has to start with a number $$$n_i$$$ ($$$1\le n_i \le \frac{n}{2}$$$) — the number of pairs of children, who turn at this move. After that print $$$n_i$$$ distinct integers — the numbers of the children who w... | standard output | |
PASSED | c3f2b110d707508000ac7d76c53c8267 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.*;
import java.util.*;
public class D implements Runnable {
boolean judge = false;
FastReader scn;
PrintWriter out;
String INPUT = "";
void solve() {
int n = scn.nextInt();
char[] arr = scn.next().toCharArray();
long ans = n * 1L * (n - 1) / 2 - 2 * n;
for(int i = 1; i < n; i++) {
if(a... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | c8da0c509886c38fa229a382b87ea580 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | // package Quarantine;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class ABSubstring {
public static void main(String[] args)throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(b... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 3577fb59d406ee05598e7f7aaf7742ad | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
ArrayList<Integer> res=new ArrayList<>();
char[] a=scan.next().toCharArray();
int streak=0, prev=-1;
for(int i=0;i<n;i++) {
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 0a28669ef3394cb22f52ddee75846f1a | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | //package cfed74;
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class G {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
int n = sc.nextInt();
char[] s = sc.nextLine().toCharArray();
long ans = (long) n * (long) (n + 1) / 2;
int[] last = new int[]{-1,... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 1a817a59b665638ed5a85c7538356420 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 1655e71d3082ea1f8814e054b3975ae9 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.*;
import java.util.*;
public class cfd {
static DataReader input;
static int LARGE_INT = 1000000007;
//static int MAXN = 300000;
//static int[] len = new int[300000];
//static int[] price = new int[300000];
public static void main(String[] args) throws IOException {
input = new DataReader(... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 63105d2d287a6c1a3ee5fb9213fd5783 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.util.*;
import java.io.*;
public class Contest1 {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int n = sc.nextInt();
char[]s=sc.nextLine().toCharArray();
TreeSet<I... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | eb3e8ee5a01090319e64ffce337fe14c | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes |
import java.util.Scanner;
import static java.lang.Math.max;
public class D {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
String s = in.next();
int pra[] = new int[n];
int prb[] = new int[n];
int ta = n;
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | d205ff641908e073e2ea8aa78a3b8956 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | /**
* BaZ :D
*/
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
static MyScanner scan;
static PrintWriter pw;
static long MOD = 1_000_000_007;
static long INF = 1_000_000_000_000_000_000L;
static long inf = 2_000_000_000;
public static void main(Strin... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 1a2ae61e93b2cd730e406cc2db8c5036 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.PriorityQueue;
public class codeforces {
public static PrintWriter out;
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | da7c1fab5c422a0626cca51c4ab520b0 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int inf = (int) 1e9 + 7;
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(System.out);
int n = nextInt();
char h[] = next(... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 47c41ecceb19ce000717afbefb33df4b | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes |
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.util.*;
public class CFContest {
public static void main(String[] args) throws Exception {
boolean local = Syste... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 2febd6d5dab311f2d918267fe0bb4d26 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class Main {
public static void main(String[] args) throws IOException {
new Main().run();
}
private void run() throws IOException {
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 2b9bd5887eb98fb10357b158f1a31b52 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.*;
import java.util.*;
public class EDU74D2 {
public static void main(String[] args) {
JS scan = new JS();
int n =scan.nextInt();
String s= scan.next();
long ans = sum(n);
int[][] next = new int[n][2];
int[][] prior = new int[n][2];
for(int i = 0;i<n;i++) {
Arrays.fill(next[i], n);
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 6e1937ef0f260f9bfaa377939a1dca79 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
static int t,m,mod=998244353,maxn=1000000,q,n;
static long INF=(long)1e18,k;
void solve(PrintWriter out, Reader in) throws IOException{
n = in.nextInt();
String str = in.next();
long ans = ((lo... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | c861b3ebdd31919bdaa09f88e4fb4439 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.*;
import java.util.*;
public final class code
{
static void solve()throws IOException
{
int n=nextInt();
String s=nextLine();
ArrayList<Integer> list=new ArrayList<Integer>();
long ans=(long)n*(n-1)/2;
for(int i=0;i<n;)
{
int j=i;
while(j<n && s.charAt(i)==s.charAt(j))
j++;
li... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | f0e554c6074adc9f7d6161b043cecbdf | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
import javafx.util.Pair;
public class Main {
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 99d37d55b6c7977190867ef91ab73ab2 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.util.*;
public class terror{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int n=in.nextInt();
in.nextLine();
String s= in.nextLine();
int lasta =n;
int lastb =n;
long val =0;
boolean a=false;
boolean b=false;
for(int i =s.length()-1;i>=0;i--)
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 5a58499508aae81eda7e15d203a92ccb | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes |
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
//import java.math.*;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
static int MD= 998244353... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 885b256f2e12254eb90ca87c5f115547 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.util.*;
import java.io.*;
public class EdD {
public static void main(String[] args) throws Exception{
int num = 998244353;
// TODO Auto-generated method stub
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int n = Inte... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | c1ddc51c624b9992254a4b06865fa318 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.Writer;
import java.io.OutputStream... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | f28b469cfd902d79b58accc001750c74 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.*;
import java.util.*;
public class Sol2{
public static void main(String[] args) throws IOException{
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
TreeSet<Long> idx = new TreeSet<>();
long n= sc.nextLong();
String str = sc.nextToken();
long arr[] = new lo... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | cd4d63a6c9b11ccb4e17fc1899255cb6 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | //package codeforces.educational74;
import java.io.*;
import java.util.*;
public class D {
static InputReader in;
static PrintWriter out;
public static void main(String[] args) {
//initReaderPrinter(true);
initReaderPrinter(false);
//solve(in.nextInt());
solve(1);
}
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | b2cf93abb6c4927f4b788435a058623c | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
public static void main(String args[])throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw=new PrintWriter(System.out);
int testCases=1;//Integer.parseInt(br.readLine());
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 988a9d7a6991c37ecfa8bd4900f92ae8 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 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.List;
import java.util.StringTokenizer;
public class Main {
private static final int MODULO = 998244353;
private Fast... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 4951b2b7196044f3a2d2e3c8d862e843 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Random;
import java.io.PrintWriter;
/*
Solution Created: 19:37:29 08/10/2019
Custom Compet... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | cf25af994e432e8859bea58757d481db | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | //created by Whiplash99
import java.io.*;
import java.util.*;
public class A
{
private static long ans, pair;
private static void solve(ArrayList<Character> list)
{
ArrayDeque<Integer> A=new ArrayDeque<>();
ArrayDeque<Integer> B=new ArrayDeque<>();
for(int i=0;i<list.size();i++)
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | ee7b2f77e4600024fdfa82b1334bfea7 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | ae22f9ad075df8874a0b9e8e9698a861 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes |
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class ABString implements Closeable {
private In... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 7803d090294e3737175b2a6125f212de | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader();
long n=sc.nextInt();
String s=sc.next();
... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | 596dc2f013a0e3aed5cd6f24f317d34f | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
import java.math.*;
public class just{
public void solve () {
InputReader in =new InputReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
long n=in.nextLong();
char s[]=in.nextLine().toCharArray()... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output | |
PASSED | b31d171cd5c05410d09ccaab28f97f25 | train_000.jsonl | 1570545300 | The string $$$t_1t_2 \dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1.A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not.Here are some e... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
public void solve(InputReader in, PrintWriter out) {
int n = in.nextInt();... | Java | ["5\nAABBB", "3\nAAA", "7\nAAABABB"] | 2 seconds | ["6", "3", "15"] | NoteIn the first test case there are six good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_4$$$, $$$s_1 \dots s_5$$$, $$$s_3 \dots s_4$$$, $$$s_3 \dots s_5$$$ and $$$s_4 \dots s_5$$$.In the second test case there are three good substrings: $$$s_1 \dots s_2$$$, $$$s_1 \dots s_3$$$ and $$$s_2 \dots s_3$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"binary search",
"strings"
] | 3eb23b7824d06b86be72c70b969be166 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the length of the string $$$s$$$. The second line contains the string $$$s$$$, consisting of letters A and B. | 1,900 | Print one integer — the number of good substrings of string $$$s$$$. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.