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
261c8f8ac28b9772e2a26adbbb00c773
train_000.jsonl
1397749200
One day, at the "Russian Code Cup" event it was decided to play football as an out of competition event. All participants was divided into n teams and played several matches, two teams could not play against each other more than once.The appointed Judge was the most experienced member — Pavel. But since he was the wise...
256 megabytes
import java.io.*; import java.util.*; public class Task{ public static void main(String[] args) throws IOException{ new Task().run(); } StreamTokenizer in; Scanner ins; PrintWriter out; int nextInt() throws IOException{ in.nextToken(); return (int)in.nval;...
Java
["3 1"]
1 second
["3\n1 2\n2 3\n3 1"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "graphs" ]
14570079152bbf6c439bfceef9816f7e
The first line contains two integers — n and k (1 ≤ n, k ≤ 1000).
1,400
In the first line print an integer m — number of the played games. The following m lines should contain the information about all the matches, one match per line. The i-th line should contain two integers ai and bi (1 ≤ ai, bi ≤ n; ai ≠ bi). The numbers ai and bi mean, that in the i-th match the team with number ai won...
standard output
PASSED
c224dc3315d863fb4cd53577367fbe7c
train_000.jsonl
1397749200
One day, at the "Russian Code Cup" event it was decided to play football as an out of competition event. All participants was divided into n teams and played several matches, two teams could not play against each other more than once.The appointed Judge was the most experienced member — Pavel. But since he was the wise...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { public void run() { try { int n = reader.nextInt(); int k = reader.nextInt(); if ((n - 1) / 2 < k) { writer.println(-1); } else { writer.println(n * ...
Java
["3 1"]
1 second
["3\n1 2\n2 3\n3 1"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "graphs" ]
14570079152bbf6c439bfceef9816f7e
The first line contains two integers — n and k (1 ≤ n, k ≤ 1000).
1,400
In the first line print an integer m — number of the played games. The following m lines should contain the information about all the matches, one match per line. The i-th line should contain two integers ai and bi (1 ≤ ai, bi ≤ n; ai ≠ bi). The numbers ai and bi mean, that in the i-th match the team with number ai won...
standard output
PASSED
7981404b29141e8fc28c8f8b775ed9f8
train_000.jsonl
1397749200
One day, at the "Russian Code Cup" event it was decided to play football as an out of competition event. All participants was divided into n teams and played several matches, two teams could not play against each other more than once.The appointed Judge was the most experienced member — Pavel. But since he was the wise...
256 megabytes
import java.io.*; import java.util.*; public class example { FastScanner in; PrintWriter out; class Point { int x, y; public Point(int x, int y) { super(); this.x = x; this.y = y; } } void solve() { int n = in.nextInt(); int k = in.nextInt(); if (n < 2 * k + 1) { ...
Java
["3 1"]
1 second
["3\n1 2\n2 3\n3 1"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "graphs" ]
14570079152bbf6c439bfceef9816f7e
The first line contains two integers — n and k (1 ≤ n, k ≤ 1000).
1,400
In the first line print an integer m — number of the played games. The following m lines should contain the information about all the matches, one match per line. The i-th line should contain two integers ai and bi (1 ≤ ai, bi ≤ n; ai ≠ bi). The numbers ai and bi mean, that in the i-th match the team with number ai won...
standard output
PASSED
7c5fe9dc237c7c59071c2d5de52c230d
train_000.jsonl
1397749200
One day, at the "Russian Code Cup" event it was decided to play football as an out of competition event. All participants was divided into n teams and played several matches, two teams could not play against each other more than once.The appointed Judge was the most experienced member — Pavel. But since he was the wise...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.List; import java.util.regex.Matcher; public class Main { private static StringTokenizer st; private static BufferedReader br; public static long MOD = 1000000007; private static List<List<Integer>>[] ways; public...
Java
["3 1"]
1 second
["3\n1 2\n2 3\n3 1"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "graphs" ]
14570079152bbf6c439bfceef9816f7e
The first line contains two integers — n and k (1 ≤ n, k ≤ 1000).
1,400
In the first line print an integer m — number of the played games. The following m lines should contain the information about all the matches, one match per line. The i-th line should contain two integers ai and bi (1 ≤ ai, bi ≤ n; ai ≠ bi). The numbers ai and bi mean, that in the i-th match the team with number ai won...
standard output
PASSED
a5ff1f0c751864c30ef7dbb49f95123a
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class AverageSuperheroGangPowerB { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int maxPerSuperHeroe = scanner.nextInt(); int totOperations = scanner.nextInt(...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
4d2cea39b2f11375c4d70845d2dad58b
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class ProbB { public static int n, k, m; public static int[] arr; public static long[] prefixSum; public static void main(String[] args) throws IOException { BufferedRe...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
6f6aac390fbd2eda39c76cfcf94c4358
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class B1111 { public static void main(String[] args) throws IOException { // BufferedReader br = new BufferedReader(new FileReader("F:/books/input.txt")); Buffer...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
0bc5c7737b3c7961c05f3ffe5809cabb
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String ar[]) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s1[]=br.readLine().split(" "); String s2[]=br.readLine().split(" "); i...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
91f9bfa42c6075c79af3e68f0edfa2cc
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import static java.lang.Math.*; import static java.lang.Math.min; import static java.util.Arrays.*; import java.util.*; public class B { public Object solve () { int N = sc.nextInt(), K = sc.nextInt(), M = sc.nextInt(); int [] A = sc.nextInts(); sort(A, Collections.reverseOrder()); double [] S = new double ...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
b713e917779eeb18c8d35982cd06d9a4
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import static java.lang.Math.*; import static java.lang.Math.min; import static java.util.Arrays.*; import java.util.*; public class B { public Object solve () { int N = sc.nextInt(), K = sc.nextInt(), M = sc.nextInt(); int [] A = sc.nextInts(); sort(A, Collections.reverseOrder()); double [] S = new double ...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
63998021894c04cb1b7e7301c8366c45
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.IOException; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import ...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
e6e9032dcb9481341133da1bb430fa88
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=s...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
a76c418860da8121ad41c49f0ee63795
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { Reader in = new Reader(); int n = in.nextInt(); long k = in.nextInt(); ...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
fc281f472c63021266b8d781d06e4d2e
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class TaskB { static class Solution { int n, k, m; int mx; long sum; double ans; int a[] = new int[100001]; int c[] = new int[1000001]; void input() { Scanner scanner = new Scanner(System...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
51fb30ff5094255a9ffefc00ec54b376
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.*; import javax.lang.model.util.ElementScanner6; import java.io.*; public class Main{ public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader inp = new InputReader(inputStream); PrintWrite...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
c76b8ed85a223f224317a23028499e9a
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import static java.lang.Double.isNaN; public class Main { public static double fun(int n, int m, int k, double sum, int[] v){ double max = 0; if( n >= (m/k)){ max = (sum + k*(int)(m/k))/n; // System.out...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
cd011a1c2ed9c8a1c4bf1fee7a98ec92
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
//package CodeForces_practice; import java.util.Arrays; import java.util.Scanner; public class B1111 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s=new Scanner(System.in); long t=s.nextInt(); long k=s.nextInt(); long m=s.nextInt(); long [] arr=new long [(int)t]; ...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
e4809f8f6d26bbbad26b341c142c91af
train_000.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Main { static final int UNCALC = -1; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextI...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
6850b4a396c491cd8fb9b43c9fbf198e
train_000.jsonl
1353079800
One day Petya got a set of wooden cubes as a present from his mom. Petya immediately built a whole city from these cubes.The base of the city is an n × n square, divided into unit squares. The square's sides are parallel to the coordinate axes, the square's opposite corners have coordinates (0, 0) and (n, n). On each o...
256 megabytes
import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.math.BigInteger; import java.io.InputSt...
Java
["5 -1 2\n5 0 0 0 1\n0 0 0 0 2\n0 0 0 1 2\n0 0 0 0 2\n2 2 2 2 3", "5 1 -2\n5 0 0 0 1\n0 0 0 0 2\n0 0 0 1 2\n0 0 0 0 2\n2 2 2 2 3"]
5 seconds
["20", "15"]
null
Java 6
standard input
[ "dp", "two pointers", "geometry", "data structures" ]
de37d373a7b93b9380317ef3813761f6
The first line contains three integers n, vx and vy (1 ≤ n ≤ 103, |vx|, |vy| ≤ |104|, |vx| + |vy| &gt; 0). Next n lines contain n integers each: the j-th integer in the i-th line aij (0 ≤ aij ≤ 109, 1 ≤ i, j ≤ n) represents the height of the cube tower that stands on the unit square with opposite corners at points (i -...
2,700
Print a single integer — the number of visible cubes. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
4c42de655a93ee6e526e32fedf6bd105
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
// Problem : D. Ehab and another another xor problem // Contest : Codeforces Round #525 (Div. 2) // URL : https://codeforces.com/contest/1088/problem/D // Memory Limit : 256 MB // Time Limit : 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) import java.io.*; import java.util.*; public class a ...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
41d7dbec0f1fc082758a00bb23142267
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.util.*; public class ContestD { public static void main(String[] args) { Scanner in = new Scanner(System.in); int c=0,d=0; int x = 29; boolean f = true; int r1=0,r2=0; while(x>=0) { if(f) { System.out.println("? "+c+" "+d); System.out.flush(); r1 = in.nextInt(); } c ^= 1...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
1564f47fd84b0e3d3ef1e0d8e00e3bc7
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.util.Scanner; public class D { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = 0; int b = 0; System.out.println("? 0 0"); System.out.flush(); int flag = sc.nextInt(); for (int i = 29; i >= 0; i--) { ...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
e30eb74d77c1a9831578422b7428c590
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.io.*; import java.util.*; import javax.swing.plaf.synth.SynthSpinnerUI; import org.omg.Messaging.SyncScopeHelper; public class A { public static void main(String[] args) throws Exception{ Scanner sc=new Scanner(System.in); long a=0; long b=0; boolean A; //true if a is bigger System.out.println...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
dbeed0e54ee38fd022cb01813e98b765
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.util.*; public class EhabandXor{ public static void main(String[] args) { Scanner in = new Scanner(System.in); int c = 0; int d = 0; int x = 29; boolean f = true; int r1 = 0; int r2 = 0; int r3 = 0; while(x >= 0) { if(f) { System.out.println("? "+c+" "+d); System.out.flush(); ...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
c62d00429b47a0e780fbbda3a182a585
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.io.*; import java.util.*; public class Task{ public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskE...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
4cb20e69b8692941d3eebd8bba8d6359
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.*; public class EhabAnotherXOR { public static void main(String[] args) { FastScanner scanner = new FastScanner(); int curA = 0; int curB = 0; System.o...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
b75f62723a94c5bf3f15e1904c38ad31
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
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
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
9974d3344624911d3756914a2c7dd5e7
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Don Li */ public class EhabAndAnotherAnotherXorProblem2 { void solve() { int a = 0, b = 0; int res = ask(0, 0); for (int...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
41b7869641b044f1a0556b9dbb7f27cf
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Don Li */ public class EhabAndAnotherAnotherXorProblem { void solve() { int a = 0, b = 0; boolean[] vis = new bool...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
781697b970be5ae03f63f1a39dfbb304
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
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
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
12c52f3911ce3c4b8961957ef62aa23f
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.util.*; import java.io.*; public class Solution { private InputReader in = new InputReader(System.in); public static void main(String[] args) { Solution solution = new Solution(); solution.solve(); } static class InputReader { private BufferedReader reader; ...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
325ccaee38d92dc9964a670b74715e97
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.util.*; import java.io.*; public class Solution { private InputReader in = new InputReader(System.in); public static void main(String[] args) { Solution solution = new Solution(); solution.solve(); } static class InputReader { private BufferedReader reader; ...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
75b562d06ce533bbfc4e4aa6880619e1
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
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.List; import java.util.StringTokenizer; import static java.lang.System.exit; public cla...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
36184e357190b2ff1eecf6d030556333
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
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
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
ded0e595bacfbb88164ac8853af504c9
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
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 _1088D { public static void main(String[] args) { InputStream inputStream = System.in; ...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
47f27ad7006dedba8d58e0a7cd3cbd28
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
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 _1088D { public static void main(String[] args) { InputStream inputStream = System.in; ...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
2216ca2358b2ba78214339590f063eb0
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
256 megabytes
import java.util.Scanner; public class D { public static void main(String[] aaaa) { Scanner scanner = new Scanner(System.in); System.out.println("? 0 0"); System.out.flush(); int res = scanner.nextInt(); // System.out.println("res " + res); int a = 0; in...
Java
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
8afcf09b2ea544475214d874798fc7b1
train_000.jsonl
1543934100
This is an interactive problem!Ehab plays a game with Laggy. Ehab has 2 hidden integers $$$(a,b)$$$. Laggy can ask a pair of integers $$$(c,d)$$$ and Ehab will reply with: 1 if $$$a \oplus c&gt;b \oplus d$$$. 0 if $$$a \oplus c=b \oplus d$$$. -1 if $$$a \oplus c&lt;b \oplus d$$$. Operation $$$a \oplus b$$$ is the bi...
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
["1\n-1\n0"]
1 second
["? 2 1\n? 1 2\n? 2 0\n! 3 1"]
NoteIn the sample:The hidden numbers are $$$a=3$$$ and $$$b=1$$$.In the first query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 1 = 0$$$, so the answer is 1.In the second query: $$$3 \oplus 1 = 2$$$ and $$$1 \oplus 2 = 3$$$, so the answer is -1.In the third query: $$$3 \oplus 2 = 1$$$ and $$$1 \oplus 0 = 1$$$, so the answer ...
Java 8
standard input
[ "constructive algorithms", "implementation", "bitmasks", "interactive" ]
7dc1137dd1f0c645cc7ec6dfdb92f5df
See the interaction section.
2,000
To print the answer, print "! a b" (without quotes). Don't forget to flush the output after printing the answer.
standard output
PASSED
4e5794545917aa3b0155273c89eda074
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; // Warning: Printing unwanted or ill-for...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
543a506b3c8cdc6c0c8166fc216adbe2
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class train { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); String s = "";int c =0; while (t != 0) { s = in.next();c=0; int a = s.indexOf("1"); int b = s.lastI...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
a847f4b4916f566408f7549a8085352f
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; import java.math.*; public class test{ public static void main(String []a){ int size; Scanner obj = new Scanner(System.in); size=obj.nextInt(); String sd = obj.nextLine(); for(int i=0;i<size;i++){ int count0=0; Strin...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
df50570c4437bf549590215db58e778b
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br ; public static void main(String[] args) throws Exception{ // write your code here input input = new input(); int tc= input.in(); while (tc-->0){ String s = input.sin(); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
a399272073a430e7dde9bcd8b2d35def
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class scratch_36 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int j=0;j<t;j++){ String n=sc.next(); int prev=0; int count=0; int g=n.indexOf('1'); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
dda9c6842a7ad787ecade749dd776dd6
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { String str = scanner.next(); int start = 0; while (start < str.length() && str.charAt(start) =...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
f988d9a1d146b21754afcc6cac5be2c4
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class CodeForce{ public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.readLine()); while(t-->0){ String str=br...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
ce821769177df0368f8d567c27aba036
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i1=0;i1<t;i1++) { String s=sc.next(); char[] ch=s.toCharArray(); int x=s.indexO...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
0f201ba69d9aeb9ddc478aca35e2a3b4
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
708b777b307cf60b737e385da338578b
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
//package codeforce; import java.util.*; public class class5 { public static void main(String []args){ Scanner scan= new Scanner(System.in); int test; String s; test=scan.nextInt(); while(test-- >0){ int count=0; s=scan.next(); int f=s.indexOf('1'); int l=s.lastIndexOf('1'...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
d7b89dd170d0dc07efed3179b95fbbec
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; import java.io.*; public class ErasingZeroes { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(br.readLine()); while(T-->0) { String str = br.readLine(); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
7d1f2280d1bb093c89483d23fe44b13e
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class ErasingZeroes { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); for(int i=0;i<n;i++) { String s=scan.next(); int t=0; if(s.length()==1 || s.contains("1")==false) { System.out.println(t); continue; }...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
16abd4944877ea99871fe11da925537e
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class ErasingZ{ public static int minimum(String s){ int i = 0; int j = s.length() - 1; while(i < j && (s.charAt(i) == '0' || s.charAt(j) == '0')){ if(s.charAt(i) == '0'){ i = i + 1; } if(s.charAt(j) == '0'){ j = j - 1; } } int ans = 0; whi...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
40ea817c4f97c6a9076d6f6966822e42
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
//dman @16-07-2020 @QuarantineVIbes import java.util.*; public class Game{ public static void main(String args[]){ Scanner s=new Scanner(System.in); int t=s.nextInt(); s.nextLine(); while(t-->0){ String s1=s.nextLine(); int count=0,z=0,m=0,temp=0; for(int i=0;i<s1.length()-1;i++){ ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
07285c30f71fc3c0a6ab59f3a06baa3c
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader var = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(var.readLine()); String line = null; ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
7f1f424269891cbf2999e707d751ab28
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.List; public class Solution { public static void main(String [] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer....
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
1840388d44de8582cf835fa76022a395
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; public class MS { public static void main (String args[]){ Scanner sc =new Scanner (System.in); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
424a46011b7e79c048cffcd7507647fb
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int tc = scanner.nextInt(); for (int i = 0; i < tc; i++) { String seq = scanner.next(); System.out.println(zeroesErasing(seq)); }...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
2d619ddd45fad187e464a074bebc189d
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class JavaApplication78 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner sc = new Scanner(System.in); int h = sc.nextInt(); int a[]=new int[h]; ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
8ab39fab5f34cfe4ae21b1a5b110b8a7
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class Solution { public static void main(String args[]) { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0) { String str=s.next(); int pos1=-1; int n=str.length(); int pos2=str.length(); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
c7ff5c4a2d1934821852da7d7ceec6b5
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class Solurion { public static void main(String ar[]) { Scanner scan=new Scanner(System.in); int test=scan.nextInt(); while(test-->0) { String s=scan.next(); int frst=-1,last=-1; for(int i=0;i<s.length();i++) ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
d4521cee4ad75cb7631b5c11a064e133
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class july30 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); for(int i=0; i<t; i++) { String num = scan.next(); int left = num.indexOf('1'); int right = num.las...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
2562700803171135802edb72aa1de515
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class ErasingZeroes { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); int[] result = new int[t]; boolean flag; String s; for (int j = 0; j < t; j++) { flag = false; s = scan.next(); int num = 0; for (...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
f140f899178786adbe16b96857217b6d
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; import java.lang.*; public class erase_zeros { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); int i; for(i=0;i<t;i++) { String s=sc.next(); int count=0; int j=1; ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
5f1d412fd2f9b767dd9ee04e3b1b7ab2
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class P1303A_ErasingZeroes { public static void main(String subhani[]) throws IOException, NumberFormatException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
af6df681653922a055627d1a22225156
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int steps = sc.nextInt(); for (int i = 0; i < steps; i++) { String line = sc.next(); if (line.length() <= 1) { System.out.pri...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
21b4519c6c9efe8c282b99e05c45e67a
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class main{ public static void main(String[] args) { Scanner s = new Scanner(System.in); int tc=s.nextInt(); while(tc--!=0){ String a=s.next(); int f = a.indexOf("1"); int l = a.lastIndexOf("1"); int c= 0; ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
38a76a12585be606a8aecf4b606e583f
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
120381fa43002a1f28755beaa6249218
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class ErasingZeroes { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int j = 0; j < t; j++) { String s = sc.next(); int ones = 0; for (int i = 0; i < s.length(); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
6e0db6c2bc3cdc58a53fd308f815e35d
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class ErasingZeroes { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int j = 0; j < t; j++) { String s = sc.next(); int ones = 0; for (int i = 0; i < s.length(); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
53e683a898e2f99983ce70c4fced3b32
train_000.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub FastReader fastReader = new FastReader(); StringBuilder out = new StringBuilder(); in...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 8
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
010120ece23c88b5f94dc3c5967eb5c8
train_000.jsonl
1560955500
After a hard-working week Polycarp prefers to have fun. Polycarp's favorite entertainment is drawing snakes. He takes a rectangular checkered sheet of paper of size $$$n \times m$$$ (where $$$n$$$ is the number of rows, $$$m$$$ is the number of columns) and starts to draw snakes in cells.Polycarp draws snakes with lowe...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1185e { public static void main(String[] args) throws IOException { int t = ri(); next: while (t --> 0) { int n = rni(), m = ni(), pos[][] = new int[26][4], bounds[][...
Java
["1\n5 6\n...a..\n..bbb.\n...a..\n.cccc.\n...a..", "3\n3 3\n...\n...\n...\n4 4\n..c.\nadda\nbbcb\n....\n3 5\n..b..\naaaaa\n..b..", "2\n3 3\n...\n.a.\n...\n2 2\nbb\ncc"]
4 seconds
["YES\n3\n1 4 5 4\n2 3 2 5\n4 2 4 5", "YES\n0\nYES\n4\n2 1 2 4\n3 1 3 4\n1 3 3 3\n2 2 2 3\nNO", "YES\n1\n2 2 2 2\nYES\n3\n1 1 1 2\n1 1 1 2\n2 1 2 2"]
null
Java 11
standard input
[ "implementation", "brute force" ]
f34d21b9568c758cacc1d00af1316c86
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases to solve. Then $$$t$$$ test cases follow. The first line of the test case description contains two integers $$$n$$$, $$$m$$$ ($$$1 \le n,m \le 2000$$$) — length and width of the checkered sheet of paper respecti...
2,000
Print the answer for each test case in the input. In the first line of the output for a test case print YES if it is possible to draw snakes, so that you can get a sheet of paper from the input. If it is impossible, print NO. If the answer to this question is positive, then print the way to draw snakes in the following...
standard output
PASSED
2e5c6c2efcf43888b9a6dccf10f4d7ac
train_000.jsonl
1601903100
In the Kingdom of Wakanda, the 2020 economic crisis has made a great impact on each city and its surrounding area. Cities have made a plan to build a fast train rail between them to boost the economy, but because of the insufficient funds, each city can only build a rail with one other city, and they want to do it toge...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; public class Main { static final int NONE = -1; static class Irving { int n; int[][] preferences; int[][] rank; int[] left; ...
Java
["4\n35 19 20\n76 14 75\n23 43 78\n14 76 98", "4\n2 5 8\n7 1 12\n4 6 7\n8 4 5"]
1 second
["3\n4\n1\n2", "-1"]
null
Java 11
standard input
[]
82add5e87e7c801d8a840f09292e7a1b
First line contains one integer $$$N \;(2 \leq N \leq 10^3)\, $$$ — the number of cities. Each of the next $$$N$$$ lines contains $$$N-1$$$ integers $$$A_{i,1}, A_{i,2}, ..., A_{i,i-1}, A_{i,i+1}, ..., A_{i,N-1}\; (1 \leq A_{i,j} \leq 10^9)\, $$$ — where $$$A_{i,j}$$$ represents the cost for city $$$i$$$ to build the r...
3,500
Output should contain $$$N$$$ integers $$$O_{1}, O_{2}, ..., O_N$$$, where $$$O_i$$$ represents the city with which city $$$i$$$ should build the rail with, or $$$-1$$$ if it is not possible to find the stable pairing.
standard output
PASSED
dfa35030716cb9e42c3958b06d824855
train_000.jsonl
1601903100
The Bubble Cup hypothesis stood unsolved for $$$130$$$ years. Who ever proves the hypothesis will be regarded as one of the greatest mathematicians of our time! A famous mathematician Jerry Mao managed to reduce the hypothesis to this problem:Given a number $$$m$$$, how many polynomials $$$P$$$ with coefficients in set...
256 megabytes
import java.io.*; import java.util.*; public class E { static int MOD = (int) 1e9 + 7, inv = (MOD + 1) / 2; static long sum(long x) { x %= MOD; return x * (x + 1) % MOD * inv % MOD; } static long sum(long l, long r) { long ans = sum(r) - sum(l - 1); if (ans < 0) ans += MOD; return ans; } public ...
Java
["2\n2 4"]
1 second
["2\n4"]
NoteIn first case, for $$$m=2$$$, polynomials that satisfy the constraint are $$$x$$$ and $$$2$$$.In second case, for $$$m=4$$$, polynomials that satisfy the constraint are $$$x^2$$$, $$$x + 2$$$, $$$2x$$$ and $$$4$$$.
Java 11
standard input
[ "dp", "constructive algorithms", "bitmasks", "math" ]
24f4bd10ae714f957920afd47ac0c558
The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 5\cdot 10^5)$$$ - number of test cases. On next line there are $$$t$$$ numbers, $$$m_i$$$ $$$(1 \leq m_i \leq 10^{18})$$$ - meaning that in case $$$i$$$ you should solve for number $$$m_i$$$.
2,400
For each test case $$$i$$$, print the answer on separate lines: number of polynomials $$$P$$$ as described in statement such that $$$P(2)=m_i$$$, modulo $$$10^9 + 7$$$.
standard output
PASSED
922db010402c5f515036f15a0e414979
train_000.jsonl
1601903100
The Bubble Cup hypothesis stood unsolved for $$$130$$$ years. Who ever proves the hypothesis will be regarded as one of the greatest mathematicians of our time! A famous mathematician Jerry Mao managed to reduce the hypothesis to this problem:Given a number $$$m$$$, how many polynomials $$$P$$$ with coefficients in set...
256 megabytes
import java.io.BufferedOutputStream; import java.io.Closeable; import java.io.DataInputStream; import java.io.Flushable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.math.BigInteger; import java.util.InputMismatchException; /** * Built using CHelper plug-in * Actua...
Java
["2\n2 4"]
1 second
["2\n4"]
NoteIn first case, for $$$m=2$$$, polynomials that satisfy the constraint are $$$x$$$ and $$$2$$$.In second case, for $$$m=4$$$, polynomials that satisfy the constraint are $$$x^2$$$, $$$x + 2$$$, $$$2x$$$ and $$$4$$$.
Java 11
standard input
[ "dp", "constructive algorithms", "bitmasks", "math" ]
24f4bd10ae714f957920afd47ac0c558
The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 5\cdot 10^5)$$$ - number of test cases. On next line there are $$$t$$$ numbers, $$$m_i$$$ $$$(1 \leq m_i \leq 10^{18})$$$ - meaning that in case $$$i$$$ you should solve for number $$$m_i$$$.
2,400
For each test case $$$i$$$, print the answer on separate lines: number of polynomials $$$P$$$ as described in statement such that $$$P(2)=m_i$$$, modulo $$$10^9 + 7$$$.
standard output
PASSED
9162350d68a844fe2b32d382a44fb6d1
train_000.jsonl
1601903100
The Bubble Cup hypothesis stood unsolved for $$$130$$$ years. Who ever proves the hypothesis will be regarded as one of the greatest mathematicians of our time! A famous mathematician Jerry Mao managed to reduce the hypothesis to this problem:Given a number $$$m$$$, how many polynomials $$$P$$$ with coefficients in set...
256 megabytes
//package bubblecup13.f; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class J { InputStream is; PrintWriter out; String INPUT = ""; void solve() { final int mod ...
Java
["2\n2 4"]
1 second
["2\n4"]
NoteIn first case, for $$$m=2$$$, polynomials that satisfy the constraint are $$$x$$$ and $$$2$$$.In second case, for $$$m=4$$$, polynomials that satisfy the constraint are $$$x^2$$$, $$$x + 2$$$, $$$2x$$$ and $$$4$$$.
Java 11
standard input
[ "dp", "constructive algorithms", "bitmasks", "math" ]
24f4bd10ae714f957920afd47ac0c558
The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 5\cdot 10^5)$$$ - number of test cases. On next line there are $$$t$$$ numbers, $$$m_i$$$ $$$(1 \leq m_i \leq 10^{18})$$$ - meaning that in case $$$i$$$ you should solve for number $$$m_i$$$.
2,400
For each test case $$$i$$$, print the answer on separate lines: number of polynomials $$$P$$$ as described in statement such that $$$P(2)=m_i$$$, modulo $$$10^9 + 7$$$.
standard output
PASSED
8895331911e35d7fe8cae9b79316c016
train_000.jsonl
1426610700
Leonid works for a small and promising start-up that works on decoding the human genome. His duties include solving complex problems of finding certain patterns in long strings consisting of letters 'A', 'T', 'G' and 'C'.Let's consider the following scenario. There is a fragment of a human DNA chain, recorded as a stri...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
Java
["10 4 1\nAGCAATTCAT\nACAT"]
3 seconds
["3"]
NoteIf you happen to know about the structure of the human genome a little more than the author of the problem, and you are not impressed with Leonid's original approach, do not take everything described above seriously.
Java 8
standard input
[ "bitmasks", "brute force", "fft" ]
11870e3fb1aaad9bf15dc505aa9cd0f5
The first line contains three integers |S|, |T|, k (1 ≤ |T| ≤ |S| ≤ 200 000, 0 ≤ k ≤ 200 000) — the lengths of strings S and T and the error threshold. The second line contains string S. The third line contains string T. Both strings consist only of uppercase letters 'A', 'T', 'G' and 'C'.
2,500
Print a single number — the number of occurrences of T in S with the error threshold k by the given definition.
standard output
PASSED
d49cc928b95cc459455a41e3f2b20dfb
train_000.jsonl
1426610700
Leonid works for a small and promising start-up that works on decoding the human genome. His duties include solving complex problems of finding certain patterns in long strings consisting of letters 'A', 'T', 'G' and 'C'.Let's consider the following scenario. There is a fragment of a human DNA chain, recorded as a stri...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); T...
Java
["10 4 1\nAGCAATTCAT\nACAT"]
3 seconds
["3"]
NoteIf you happen to know about the structure of the human genome a little more than the author of the problem, and you are not impressed with Leonid's original approach, do not take everything described above seriously.
Java 8
standard input
[ "bitmasks", "brute force", "fft" ]
11870e3fb1aaad9bf15dc505aa9cd0f5
The first line contains three integers |S|, |T|, k (1 ≤ |T| ≤ |S| ≤ 200 000, 0 ≤ k ≤ 200 000) — the lengths of strings S and T and the error threshold. The second line contains string S. The third line contains string T. Both strings consist only of uppercase letters 'A', 'T', 'G' and 'C'.
2,500
Print a single number — the number of occurrences of T in S with the error threshold k by the given definition.
standard output
PASSED
ef6af3a6f66cc85e86b43bf97f80bf57
train_000.jsonl
1426610700
Leonid works for a small and promising start-up that works on decoding the human genome. His duties include solving complex problems of finding certain patterns in long strings consisting of letters 'A', 'T', 'G' and 'C'.Let's consider the following scenario. There is a fragment of a human DNA chain, recorded as a stri...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); T...
Java
["10 4 1\nAGCAATTCAT\nACAT"]
3 seconds
["3"]
NoteIf you happen to know about the structure of the human genome a little more than the author of the problem, and you are not impressed with Leonid's original approach, do not take everything described above seriously.
Java 8
standard input
[ "bitmasks", "brute force", "fft" ]
11870e3fb1aaad9bf15dc505aa9cd0f5
The first line contains three integers |S|, |T|, k (1 ≤ |T| ≤ |S| ≤ 200 000, 0 ≤ k ≤ 200 000) — the lengths of strings S and T and the error threshold. The second line contains string S. The third line contains string T. Both strings consist only of uppercase letters 'A', 'T', 'G' and 'C'.
2,500
Print a single number — the number of occurrences of T in S with the error threshold k by the given definition.
standard output
PASSED
eec6e78336d9ee655ad93a0e4b14cf35
train_000.jsonl
1426610700
Leonid works for a small and promising start-up that works on decoding the human genome. His duties include solving complex problems of finding certain patterns in long strings consisting of letters 'A', 'T', 'G' and 'C'.Let's consider the following scenario. There is a fragment of a human DNA chain, recorded as a stri...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class FuzzySearch { public static void fft(double[] a, double[] b, boolean invert) { int count = a.length; for (int i = 1, j = 0; i < count; i++) { int bit = count >> 1; for ...
Java
["10 4 1\nAGCAATTCAT\nACAT"]
3 seconds
["3"]
NoteIf you happen to know about the structure of the human genome a little more than the author of the problem, and you are not impressed with Leonid's original approach, do not take everything described above seriously.
Java 8
standard input
[ "bitmasks", "brute force", "fft" ]
11870e3fb1aaad9bf15dc505aa9cd0f5
The first line contains three integers |S|, |T|, k (1 ≤ |T| ≤ |S| ≤ 200 000, 0 ≤ k ≤ 200 000) — the lengths of strings S and T and the error threshold. The second line contains string S. The third line contains string T. Both strings consist only of uppercase letters 'A', 'T', 'G' and 'C'.
2,500
Print a single number — the number of occurrences of T in S with the error threshold k by the given definition.
standard output
PASSED
0b32c689411a467b3d842616a4ac1417
train_000.jsonl
1426610700
Leonid works for a small and promising start-up that works on decoding the human genome. His duties include solving complex problems of finding certain patterns in long strings consisting of letters 'A', 'T', 'G' and 'C'.Let's consider the following scenario. There is a fragment of a human DNA chain, recorded as a stri...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class FuzzySearch { static char[] letters = "ACGT".toCharArray(); static int[] letterIds = new int[256]; public static void main(String[] args) throws IOException { for(int i=0;i<l...
Java
["10 4 1\nAGCAATTCAT\nACAT"]
3 seconds
["3"]
NoteIf you happen to know about the structure of the human genome a little more than the author of the problem, and you are not impressed with Leonid's original approach, do not take everything described above seriously.
Java 8
standard input
[ "bitmasks", "brute force", "fft" ]
11870e3fb1aaad9bf15dc505aa9cd0f5
The first line contains three integers |S|, |T|, k (1 ≤ |T| ≤ |S| ≤ 200 000, 0 ≤ k ≤ 200 000) — the lengths of strings S and T and the error threshold. The second line contains string S. The third line contains string T. Both strings consist only of uppercase letters 'A', 'T', 'G' and 'C'.
2,500
Print a single number — the number of occurrences of T in S with the error threshold k by the given definition.
standard output
PASSED
a065e826095a541f7100cf5577736890
train_000.jsonl
1426610700
Leonid works for a small and promising start-up that works on decoding the human genome. His duties include solving complex problems of finding certain patterns in long strings consisting of letters 'A', 'T', 'G' and 'C'.Let's consider the following scenario. There is a fragment of a human DNA chain, recorded as a stri...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class FuzzySearch { static char[] letters = "ACGT".toCharArray(); static int[] letterIds = new int[256]; public static void main(String[] args) throws IOException { for(int i=0;i<l...
Java
["10 4 1\nAGCAATTCAT\nACAT"]
3 seconds
["3"]
NoteIf you happen to know about the structure of the human genome a little more than the author of the problem, and you are not impressed with Leonid's original approach, do not take everything described above seriously.
Java 8
standard input
[ "bitmasks", "brute force", "fft" ]
11870e3fb1aaad9bf15dc505aa9cd0f5
The first line contains three integers |S|, |T|, k (1 ≤ |T| ≤ |S| ≤ 200 000, 0 ≤ k ≤ 200 000) — the lengths of strings S and T and the error threshold. The second line contains string S. The third line contains string T. Both strings consist only of uppercase letters 'A', 'T', 'G' and 'C'.
2,500
Print a single number — the number of occurrences of T in S with the error threshold k by the given definition.
standard output
PASSED
280f237abbac77b1f6b432c659c27507
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.util.*; import java.io.*; public class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); long x=sc.nextLong(); long a[]=new long[2*n+1]; for(int i=1;i<=n;i++){a[i]=sc.nextLong();a[n+i]=a[i];} long b[]=new long[2*n+1]; long c[]=new long[2*n+1]...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
af12845f0f8427470260237eeafba309
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef{ static long a[]; static long mv[]; static long cd[]; static long tdv[]; static int n; static long k; public static void main (String[] ar...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
dca05b7f1b663eddcdc06fc2da30c124
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); static int bs(long d, long[] arr) { int start = 0, end = arr.length - 1, ret = -1; while(start <= end) { int mid = (start + end) >> 1; if(d <= arr[m...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
9ff03a81e722d35576bc974b8b6cf287
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.util.ArrayList; import java.util.HashSet; import java.util.InputMismatchException; import java.util.List; ...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
fde71a3e15bd31f01d90e4131caa7ea5
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.util.*; public class D { static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); static MyScanner sc; static { try { sc = new MyScanner(); } catch (FileNotFoundException e) { e.printStackTrace(); } } ...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
3ab9d08b5e529c22dbb21c8a1971fa68
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { BufferedReader br = new BufferedReader(new I...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
55506a85ece2a0d564dcabc6faac75a2
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** If I'm the sun, you're the moon Because when I go up, you go down ******************************* I'm working for the day I will surpass you https://www.a2oj.com/Ladder16.html */ impor...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
01811315ffd18a86afed5a2616ba6279
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
//package 第1358场; /* 盗图小能手 ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
3bd58a863e0e8c8493fcc1e1bb021dc4
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); static int MOD = 1000000007; public static void main(String[] args) throws IOException { ...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
7d0ceb46e6a940f7653f400ec3fa952b
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.TimeUnit; public class d645 implements Runnable{ public static void main(String[] args) { try{ new Thread(null, new d645(), "process", 1<<26).start(); } catch(Exception e){ System.out.println(e); ...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
022b4ee458dfdc10aae9fc2ad78dd9a7
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Random; import java.util.StringTokenizer; public class D { //Solution by Sathvik Kuthuru public static void main(String[] args) { FastReader scan = new FastReader(); PrintWriter out = new PrintWriter(System.out); Task solver...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
dc9feabf4986c8dc930f6ffacb825ca1
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static class FastReader { BufferedReader br; StringTokenizer root; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (root == null || !root....
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
ca8f2d000850662dd0aa9906d48023b6
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static class FastReader { BufferedReader br; StringTokenizer root; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (root == null || !root....
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
3109816ca3571c04846a061cd3da72ab
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class D { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
c9438bf42754eb90a3ac5cde78a9e6b2
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.util.*; public class cp1 { static StringBuilder run(){ StringBuilder sb=new StringBuilder(); // code int n=in.nextInt(); long x=in.nextLong(); long a[]=new long[2*n+1]; long pre1[]=new long[2*n+1]; long pre2[]=new long[2*n+1]; for(int i=1;i<=n;i++){ a[i]=in.nextLong(); a[i+n]=a[i]; ...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
f9e82c6b94c61475d97807c0975da544
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
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.Arrays; import java.util.LinkedList; import java.util.List; import java.util.PriorityQueue; impor...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
148e815f8f9835ca20e9bcb896fd28a2
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CF1358D { public static void main(String[] args) { FastReader input = new FastReader(); int months = input.nextInt(); long vacation = input.nextLong()...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
6035d54f19bd06f102af9f801f40bdf9
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; import java.io.*; import java.math.*; public class Main12{ static public void main(String args[])throws IOException{ int tt=1; StringBuilder sb=new StringBuilder(); for(int ttt=1;ttt<=tt;ttt++){ int n=i(); long x=...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
f6148d997266eb189d6705901957f64c
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { static class Pair implements Comparable<Pair>{ int a; int b; public Pair(int x,int y){a=Math.min(x, y);b=Math.max(x, y);} public Pair(){} public int compareTo(Pair p){ return p.a - a; } @Override public int hashCode...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
fd6f2fc25357117c4dc545c8b5c31ed1
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Scanner sc = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); long mod = 998244353; public static void main(String[] arg...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output