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
47f65e0138f3749b872b126c6975cfd8
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { Scanner jin = new Scanner(System.in); long num = Long.parseLong(jin.nextLine()); jin.close(); if (num < 3) System.out.println(-1); else { if (num % 2 == 0) { long num1 = ((num * num) / 4) + 1; long num2 = num...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
ec6d4543fe4f50cee3fbfaa3ece82f81
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
//package adruill; import java.util.Scanner; public class Main{ public static void main(String[] agrs){ Scanner in = new Scanner(System.in); while(in.hasNext()){ long n = in.nextLong(); if(n == 1 || n == 2) System.out.print(-1); else{ if(n %...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
30a543b6d2f4aaaf3aa061550a9b97e7
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); long b = in.nextLong(); if(b==1||b==2){ System.out.println("-1"); return; } if(b%2!=0){ long e = b*b; ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
d64951af043a0462f981f74d571ef15d
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.*; import java.io.*; /** * @author Bill * */ public class CF707C { public static void main(String[] args) throws IOException{ BufferedReader fin = new BufferedReader(new InputStreamReader(System.in)); long N = 0; StringTokenizer st = new StringTokenizer(fin.readLine()); N = Long.parseLo...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
b3d77626156b5a1740aa62d1c8caa688
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class CSep10 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); long num = Integer.parseInt(in.readLin...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
a5b8c227c29f8975ecbafccf543673c7
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
1378a8f74c2a457c6525c98afce16eb5
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
002e38a64cbae98610c24a6051f7ab34
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } long a; long c; long b; private void run() { init(); if (a == 1 || a == 2) { System.out.println(-1); } else { if (a % 4 == 0) { ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
870068e0b6da4d8e682977c2e3ef81a8
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); long n = s.nextLong(); long a = 0, b = 0; if (n % 2 == 1) { a = (n*n-1)/2; b = a+1; if (a <= 0 || b <= 0) { ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
982bfffa9b1a693ad59b916153f98c6c
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); if (n==2 || n==1) System.out.println(-1); else if (n%2==0) { long k = n*n/4+1; long m = k-2; System.out.println(m+" "+k); } else { long k...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
8e82b01628969eacbcc8d71417b04808
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class TaskC { static ArrayList<Long>al; static int n, m, ans; static int[]arr; static int[] row = new int[9]; public static void backtrack(int col) { if(col==9) { ans++; System....
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
b1e3b5f20e04159cffb24bdbbbd4670d
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class kod{ public void solve(){ long n; Scanner in = new Scanner( System.in ); n = in.nextLong(); long t=1; while( n%2==0 ){ t *= 2; n /= 2; } if( n==1 ){ if( t<=...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
62c2917b7c97ecde0bb2fc8e6235c96f
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
/* * Remember a 7.0 student can know more than a 10.0 student. * Grades don't determine intelligence, they test obedience. * I Never Give Up. */ import java.util.*; import java.util.Map.Entry; import java.io.*; import java.text.*; import static java.lang.System.out; import static java.util.Arrays.*; import static...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
f252b594dbbcaeb9c3c13202c901390e
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.*; public class PythagoeanTriples { public static void main(String[] args) { Scanner input = new Scanner(System.in); long a = input.nextInt(); if(a < 3) { System.out.println(-1); } else if(a % 2 == 1) { l...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
df02e452976cc7603f54e3de470c8cb3
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
72cd914fdc3f722929d51aedc74b56b8
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.Entry; import javax.swing.text.InternationalFormatter; import java.math.*; public class temp1 { public static PrintWriter out; static int[] a; static int[] b; static StringBuilder sb = new StringBuilder(); static int ans = 0; public static void mai...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
e0e07730e46ce606f1cb47e351f99563
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; public class P600A { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); for(int i=0; i<t; i++) { int n = Integer.parseI...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
2d851582a38f0dee1e00499feac8c70e
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String ts = br.readLine(), ns; while ((ns = br.readLine()) != null) { int n = Integer...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
970bb523d37235380330425c56a2bb10
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.Scanner; public class first{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int l,r,a[], b[],n,i,j; while(t>0) { t--; n=sc.nextInt(); a=new int[n]; b=new int[n]; for(i=0;i<n;i++) { a[i]=sc.nextInt(); } for(i=0;...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
1643176bfa121353f9c89828684b6002
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class MyProgram { public static FastIO file = new FastIO(); private static void solve() { int tt = nextInt(); while (tt-- > 0) { int n = nextInt(); int[] a = nextArray(n); int[] b = nextArray(n...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
cc00c37632cad6616de9e903bdacdfcc
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.HashSet; import java.util.Iterator; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int xx = 0; xx < t; xx++) { int n = scanner.nextInt(); int[] a = ne...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
d7151c37d1d384075b75e14cb927fa64
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.sqrt; import static java.lang.Math.floor; import static java.lang.Math.abs; public class cf { static final double EPS = 1e-6; final static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
2ff830daf359138c58b588efa3d74184
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException{ FastReader sc = new FastReader(); PrintWriter pw = new PrintWrit...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
7dce70b7f3db53c953d0e29ab8012a35
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Main { static final int INF = (int) (1e9 + 10); static final int MOD = (int) (1e9 + 7); public static void main(String[] args) throws NumberFormatException, IOException { FastReader sc = new FastReader()...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
f7d10b975e984da23192a8e3bc66c7d0
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.*; public class solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); int[] a=new int[n]; int[] b=new int[n]; for(int j=0;j<n;j++) { a[j]=sc.nextInt(); } for(int j=0;j<n;j++) ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
aeac395722a6b5b1496ff602d5615e4c
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t>0){ int n = sc.nextInt(); int a[] = new int[n]; int b[] = new int[n]; for(int i=0;i<n;i++){ a[i]=sc.nextInt(); } for(int i=0;i<n;i++){ b[i]...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
0d6fa76ba0c24a3439acad6605181522
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.*; public class singlepush { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i=0;i<t;i++) { int k = sc.nextInt(); int a[] = new int[k]; int b[] = new int[k]; int dif[] = new int[k]; int count=0; for(int w=0;w<k;w++...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
56a0b3e810b4ac97b8c6a751bab10439
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static BufferedReader input = new BufferedReader( new InputStreamReader(System.in) ); public static void main(String[] args) throws IOException { byte tests = Byte.parseByte...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
820c79f0aeb36b76b24475f65eafe8c9
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
//package hiougyf; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a[]=new int[n+1]; int b[]=new int[n+1]; for(int i=1;i<=n;i++) a[i]=sc.nextInt(); for(int i=1;i<=n;i++)...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
60907f996a328980ec5f823375759f25
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class M1 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); for(int i =0; i<t;i++){ int n = s.nextInt(); int[] a = new int[n]; int[] b = new int[n];...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
3b1035e1fd273f3093b2613ab9ac1b25
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.Scanner; public class Push { static boolean proc(int []a, int []b){ int n=a.length; int range=-1; int dis=0; boolean ok=true; for (int i=0; i<n; i++){ if (a[i]==b[i] && ok) { range=i; continue; } ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
41d5755fc05efb02fca4873c3216285a
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static PrintWriter out = new PrintWriter(System.out); static Reader in = new Reader(); public static void main(String[] args) throws IOException { Main solver = new Main(); solver.solve(); out.flush(); ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
315e6fc2bdea4b67120e39af577c9253
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.*; public class single_push { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T=in.nextInt(); while(T-->0) { int n=in.nextInt(); int arr[]=new int[n]; int check[]=new int[n]; Set<Integer> set = new HashSet<>(); for(int i=0;i<n;i++) { ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
2fa715f6336b736d2f742827ce2d3b2a
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); List<Integer> list1 = new ArrayList<>(); List<Integer> list2 = new ArrayList<>(); ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
ea31ec6ca1ca1cf5665cf1825656f53e
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { int mod = 1000000007; static public int diff(int[] a, int i, int j) { return Math.abs(a[i] - a[j]); ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
83684e914bcc40fcb32ed1b8ce43c8c1
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.*; public class A_600 { public static class Pair{ Pair(){ } } public static String solve(int[] arr1,int[] arr2){ ArrayList<Integer> arr=new ArrayList<>(); int flag=0; for(int i=0;i<arr1.length;i++){ arr1[i]=arr1[i]-arr2[i]; i...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
0edc04fdf400d5bdf09cdb8ba240fdf4
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; public class SinglePush { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(input.readLine()); while (t-- > 0) { int n = Integer.parseInt(input.readLine())...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
3410a661254c62d96ac565c4dcf77d5c
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class singlePush { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReade...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
0139f1a94d12e8621923cf2fa06e7255
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.lang.System.*; import static java.util.Arrays.*; public class Main { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(Syste...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
ade09f6a29726999b4c71434dbebcfd0
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.Scanner; public class singlePush { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); for (int m = 0; m < tc; m++) { int n = sc.nextInt(); int a[] = new int[n]; int b[] = new int[n]; ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
b4b623c2faabd219ecef955542460d4d
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Freaks3 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Intege...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
a2bb9a226e01d80515d3a90aa356f1e7
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.Scanner; public class n020 { static Scanner scan=new Scanner(System.in); public static int[] getarr(int n) { int arr[]=new int[n]; for(int i=0;i<n;i++) arr[i]=scan.nextInt(); return arr; } public static int getint() { return scan.nextInt(); } public static long getlong() { return...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
bb18b6c6c47c3371e06634ec8a33fb3c
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.Scanner; public class n020 { static Scanner scan=new Scanner(System.in); public static int[] getarr(int n) { int arr[]=new int[n]; for(int i=0;i<n;i++) arr[i]=scan.nextInt(); return arr; } public static int getint() { return scan.nextInt(); } public static long getlong() { return...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
0b5901adebca44106836c8661d3e79d6
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class Main { public static void process()throws IOException { int n=ni(),a[]=new int[n+1],b[]=new int[n+1],diff[]=new int[n+2]; for(int i=1;i<=n;i++) a[i]=ni(); for(int i=1;i<=n;i++){ b[i]=ni(); diff[i]=b[i...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
fa8536ac06cfd6bb7a6aeb6607a02c60
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Locale; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { boolean isLocalRun = args.length == 1 && "localrun".equals(args[0]); new Main().run(isLocalRun); } private v...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
6c842a88eebd550531ff9ec2a5be787b
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException{ FastScanner fs = new FastScanner(); int test = fs.nextInt(); while(test-->0) { int n = fs.nextInt(); int[] a = fs.readArray(n); int[] b = fs.readArray(n); for(int i=0 ; i<n ; i++) ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
735dc9dc02c8d3901673dcf73ea829b6
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int q = in.nextInt(); while (q-- > 0) { int n = in.nextInt(); if (n == 1) { answerIt(in.nextInt() <= in.nextInt()); ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
4fd6d652b2110a3d7d52501d197e4653
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; public class a { public static void main(String[] args) throws Exception { FastScanner in = new FastScanner(System.in); int t = in.nextInt(); while (t --> 0) { int n = in.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for (int i = 0; i < n; i++) a...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
e662cc0f79693a6e6f8bc5ddc7128576
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class Solution { static int TC, N, start, end, diff; static int[] arr, arr2; static StringTokenizer st; static bool...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
1b86a31df6af7a1f93ac654abfcafb58
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Cf131 implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
e5d4c2ef0f5d5048d907c0643c372f13
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; public class CF1253A extends PrintWriter { CF1253A() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1253A o = new CF1253A(); o.main(); o.flush(); } void main() { int t = sc.nextInt(); while (t-- > 0) { int n = sc....
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
acbb195aec5cc7abadb10be7a0ce5842
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; public class A { Random random = new Random(751454315315L + System.currentTimeMillis()); public void solve() throws IOException { int q = nextInt(); while (q-- > 0) { int n = nextInt(); int[] a = nextArr(n); int[] b = n...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
5e393eb48a09b580e5edb39a601660f9
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.util.*; public class Solution { public static void main(String arg[]) { Scanner sc=new Scanner(System.in); int tc = sc.nextInt(); while(tc-- > 0) { int n = sc.nextInt(); int [] a = new int[n]; int [] b = new int[n]; ...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
2c17dd21dca9262c0678d16cf7c75b50
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; public class test { /* * array list * * ArrayList<Integer> al=new ArrayList<>(); creating BigIntegers * * BigInteger a=new BigInteger(); BigInteger b=new BigInteger(); * * hash map * * HashMap<Integer,Integer> hm=new HashMap<Integer,Integer>(); for(int * i...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
ef89c7ac1cde0bcac8b16648c9b30a26
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static int MAX = (int)1e5+1; public static void main(String[] args)throws Exception{ //InputReader input = new InputReader(System.in); Scanner input = new Scanner(System.in); OutputStreamWriter out = new OutputStreamWriter(System.out); int t...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
e0c77bbeaed9cceb35476f82d72d7d35
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
import java.awt.*; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInput...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
44915a876bc9ce6056f8f64e2fa200e2
train_001.jsonl
1573914900
You're given two arrays $$$a[1 \dots n]$$$ and $$$b[1 \dots n]$$$, both of the same length $$$n$$$.In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 \le l \le r \le n$$$ and $$$k &gt; 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, \ldots, a_r$$$.For exa...
256 megabytes
//template import java.util.*; import java.util.stream.Stream; import java.io.*; public class Main{ static BufferedReader in= new BufferedReader(new InputStreamReader(System.in)); static PrintWriter out= new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); public static void main(String[] args...
Java
["4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6"]
1 second
["YES\nNO\nYES\nNO"]
NoteThe first test case is described in the statement: we can perform a push operation with parameters $$$(l=3, r=5, k=2)$$$ to make $$$a$$$ equal to $$$b$$$.In the second test case, we would need at least two operations to make $$$a$$$ equal to $$$b$$$.In the third test case, arrays $$$a$$$ and $$$b$$$ are already equ...
Java 11
standard input
[ "implementation" ]
0e0ef011ebe7198b7189fce562b7d6c1
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 20$$$) β€” the number of test cases in the input. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100\ 000$$$) β€” the number of elements in each array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2...
1,000
For each test case, output one line containing "YES" if it's possible to make arrays $$$a$$$ and $$$b$$$ equal by performing at most once the described operation or "NO" if it's impossible. You can print each letter in any case (upper or lower).
standard output
PASSED
42728142432a3fafe7196409af24495e
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; import ja...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 8
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
8d6d25bbc4409b4dca35d1bf0c0a57f0
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class F { static String[] f = new String[] { "Carrots", "Kiwis", "Grapes"}; public static void main(String[] args) throws ...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 8
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
ab3fc013c737a145420763f5c8cab377
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.TreeSet; import java.util.ArrayList; import java.io.BufferedOutputStream; import java.util.StringTo...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 8
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
ee3adc23259ceb974d074ce3aaedf933
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
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); ...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 8
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
d5e918e95434b67fa3d9591ad8fdb7e1
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
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
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 8
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
30384a398b6f47e03827005506eb47ae
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Solution{ static void getZarr(String str,int[] z){ int n = str.length(); int l=0,r=0; for(int i=1;i<n;i++){ if(i>r){ l = r = i; while(r<n && str.charAt(r-l)==str.charAt(r))...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 8
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
8efbc1f4d4e1b05c88ad0f7f192c30b9
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.*; import java.util.*; public class icpc { public static void main(String[] args) throws IOException { // Reader in = new Reader(); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s = in.r...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 8
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
26b5f63129adc45eb60c7a0644a33f75
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collecti...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 8
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
3741dee75cf3307e5a65add6174a9bf7
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.*; import java.util.*; public class Main { void solve() { String s = in.next(); int m=in.nextInt(),n=s.length(); String a[] = new String[m]; for(int i=0;i<m;++i){ a[i]=in.next(); } int res=-1,pos=-1; int last=n-1; for(int i...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 8
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
0c71f62ae067c7a5ca0ac9fbae1f5de0
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.*; /** * 79C * <p> * O(n*max(len(substrs))*len(s)) time * O(len(s)) space * * @author artyom */ public class Beaver implements Runnable { private BufferedReader in; p...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 8
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
128302ac25a51eb39c88854614071413
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); int n = Integer.parseInt(br.readLine()); String[] bad = new Str...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
a79197ede55957766d22ebc8949c23fc
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.*; import java.util.*; public class Beaver implements Runnable { private void solve() throws IOException { String s = nextToken(); int n = nextInt(); String [] a = new String[n]; for(int i=0;i<n;i++) a[i] = nextToken(); int left = 0; int pos = 0; int len = 0; for(int i=1;i<=s.len...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
126fb8e5e8bd9028e8810a4d43327f1a
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.IOException; import java.sql.Array; import java.util.Arrays; import java.util.Scanner; /** * Author: dened * Date: 26.03.11 */ public class C { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); String s = in.next(); int n = in...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
ed8306690ef38a9c4369fee08fa27431
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; import static java.lang.Math.*; public class Sol implements Runnable { StringTokenizer tokenizer = new StringTokenizer(""); BufferedReader in; PrintStream out; public void debug(String s) { System.err.println(s); } public static void main(Str...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
c14ef2e7f1b84c1bc0f7e6a2ad333860
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; import static java.lang.Math.*; public class Sol implements Runnable { StringTokenizer tokenizer = new StringTokenizer(""); BufferedReader in; PrintStream out; public void debug(String s) { System.err.println(s); } public static void main(Str...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
b1d4c463040487e08bc389b09dec5591
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
/** * Created by ckboss on 14-9-3. */ import java.util.*; public class Beaver { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next().trim(); int n = in.nextInt(); String[] b = new String[n + 1]; for (int i = 0; i < n; i++) ...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
1c469a5c96624bf2a32a9820b8182b0b
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; im...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
8b922028933f3e1a208e0b68bbde7262
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.*; import java.util.*; public class beaver { public static void main (String [] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String original = in.readLine(); int orgLength = original.length(), numOthers = Integer.parseInt(in.readLine(...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
1089f1c48c36c97db644d8bce3ffd6e8
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.*; import java.util.*; public class beaver { public static void main (String [] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String original = in.readLine(); int orgLength = original.length(), numOthers = Integer.parseInt(in.readLine(...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
8fafde4b2dcfdad1ab66aa22243ebf1a
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); char[]taro = n...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
4f9a78ea94ec0346bd9c8302931fec4b
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.util.*; public class cf79c { public static void main(String[] args) { Scanner in = new Scanner(System.in); String v = in.next().trim(); int n = in.nextInt(); String[] x = new String[n]; for(int i=0; i<n; i++) x[i] = in.next().trim(); //find the longest string ending at i //progressive...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
de884fb16e9585ead3e9c07e484d07e4
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.util.InputMismatchException; import java.io.*; import java.math.*; import java.util.Vector; /** * Generated by Contest helper plug-in * Actual solution is at the bottom */ public class Main { public static void main(String[] args) { InputReader in = new StreamInputReader(System.in); ...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
b3998d7773140c42875c6e2b2bd5bc9c
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.util.*; import java.math.*; import static java.lang.Character.isDigit; import static java.lang.Character.isLowerCase; import static java.lang.Character.isUpperCase; import static java.lang.Math.*; import static java.math.BigInteger.*; import static java.util.Arrays.*; import static java.util.Collections.*;...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
3d0c297f3241f197711a99b8fca7b389
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Beaver { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader r=new BufferedReader(new InputStreamReader(System.in)); char[...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
55101fb9abbb64aa234dbc2d7f85c424
train_001.jsonl
1304175600
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.However, Ciel feels...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Beaver { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader r=new BufferedReader(new InputStreamReader(System.in)); char[...
Java
["Go_straight_along_this_street\n5\nstr\nlong\ntree\nbiginteger\nellipse", "IhaveNoIdea\n9\nI\nh\na\nv\ne\nN\no\nI\nd", "unagioisii\n2\nioi\nunagi"]
2 seconds
["12 4", "0 0", "5 5"]
NoteIn the first sample, the solution is traight_alon.In the second sample, the solution is an empty string, so the output can be Β«0 0Β», Β«0 1Β», Β«0 2Β», and so on.In the third sample, the solution is either nagio or oisii.
Java 6
standard input
[ "dp", "hashing", "greedy", "two pointers", "data structures", "strings" ]
b5f5fc50e36b2afa3b5f16dacdf5710b
In the first line there is a string s. The length of s will be between 1 and 105, inclusive. In the second line there is a single integer n (1 ≀ n ≀ 10). Next n lines, there is a string bi (1 ≀ i ≀ n). Each length of bi will be between 1 and 10, inclusive. Each character of the given strings will be either a English a...
1,800
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any bi, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s. If there are several ...
standard output
PASSED
1118d225218cc2714fa5cef97ccbe275
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.util.Scanner; public class Main { static boolean espal(String a){ int medio=(a.length())/2; for (int i= 0; i < medio; i++) { if (a.charAt(i)!=a.charAt(a.length()-1-i)) { return false; } } return true; }...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
2fbcc5dfb02f061b8e2488c83cdb0143
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.util.Scanner; public class MikeAndFox { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String s=sc.next().trim(); int k=sc.nextInt(); System.out.println(checkPalindrome(s,k)==true?"YES":"NO"); } private static boolean checkPalindrome(String s, int k){ if(s.len...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
4741b7a9cf1b7bba5027531b3c43f3ff
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); int k = in.nextInt(); int lenghtEachPart = s.length() / k; String result = "NO"; if (s.length() % k == 0) { int j = 0; for (in...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
9e1df3f7d97a7b8ba289c131ac21cc21
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.util.Scanner; public class Codeforces_Round_305_A_Mike_and_Fax { static boolean isPalendrom(String x) { for (int i = 0, j = x.length() - 1; i < x.length(); j--, i++) { if (x.charAt(i) != x.charAt(j)) return false; } return true; } public static void main(String[] args) { Scanner in = ne...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
72e0b81e53f9c8c098c3eac780637ff7
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.util.Scanner; /** * Created by Trajkovski on 26-May-15. */ public class Main{ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s = scanner.next(); int k = scanner.nextInt(); if (s.length() % k != 0) { System.out.prin...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
bddb555f25c9bac05a075f60cd485ccf
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.util.ArrayList; public class MikeAndFax { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedR...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
3ab98e72d256a846845495f300f892b1
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next(); int k = in.nextInt(); int len = s.length(); if(s!="" && len!=0) { int plen = len/k; if(len < k || len%plen != 0 || len%k !=0) { System.out.println("N...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
6f56a252afae15e4e0e48a76f75f3f1c
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.util.Scanner; public class Tester { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scanner =new Scanner(System.in); String string=scanner.nextLine(); int numOfPal=scanner.nextInt(); int stringLength=string.length(); int stringpar...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
106ab910c6b86a094c1d2fe2483eae2b
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * @author Tamil */ public class MikeAndFax { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String mg = in.r...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
c8c85e7298749427ec9911d6006e4782
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.io.*; import java.util.*; public class temp{ public static void main(String[] arg) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s = in.readLine(); int k = Integer.parseInt(in.readLine()); String[] ss = new String[...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
61973b086208db6ae210498aa572fe39
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
//package round305div2; import java.util.*; import java.io.*; public class A { static String INPUT = "res/input.txt"; void solve() { String s = in.next(); int k = in.nextInt(); int n = s.length(); if(n % k != 0) { out.println("NO"); ...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
874d33df1988657d9d50efd21cb3fe1f
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.PriorityQueue; import java.util.StringTokenizer; /** * * @author Mojtaba ...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
592b6b7375a4bca02f22aa67bff93582
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.lang.*; import java.util.*; public class Solution{ public static void main(String args[]){ Scanner in = new Scanner(System.in); String s = in.next(); int n = in.nextInt(); int len = s.length()/n; if(s.length()==n) {System.out.println("YES");return;} if(s.length()%n!=0){System.out.println("NO...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
f591eb47db1a909899787333f8b59066
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class A218 { public static void main(String[] args) throws IOException { new A...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
a687f0afda4d142ef3987f436f5cd0e2
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { boolean pali( String s, int b, int e ) { for( int i = b; i < e; i++ ) if( s.charAt( i ) != s.charAt( e - i + b - 1 ...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
8f54e7677a073bc0fd33bc6c4f4dce1a
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.io.File; import java.util.ArrayList; import java.util.Scanner; public class A { public static void main(String[] args) throws Exception { // Scanner sc = new Scanner(new File("in.txt")); Scanner sc = new Scanner(System.in); String s = sc.next(); final int k = sc.nextInt(); if (s.length() % k !=...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
fa939dc73ae21f3191eb3ca3adb180b7
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
//package code_alone; import com.sun.org.apache.bcel.internal.Constants; import java.util.ArrayList; import java.util.Scanner; public class Code_Alone { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int y = sc.nextInt(); if(s.length()%y...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output
PASSED
982bd804840d026305c21b5836015927
train_001.jsonl
1432658100
While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h...
256 megabytes
import java.util.Scanner; public class A{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int y = sc.nextInt(); if(s.length()%y!=0){System.out.print("NO");return;} int step=s.length()/y; for(int i=0;i<s.length();i+=step) if(!s.substring(i , i+step).equals(...
Java
["saba\n2", "saddastavvat\n2"]
1 second
["NO", "YES"]
NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".
Java 7
standard input
[ "implementation", "brute force", "strings" ]
43bb8fec6b0636d88ce30f23b61be39f
The first line of input contains string s containing lowercase English letters (1 ≀ |s| ≀ 1000). The second line contains integer k (1 ≀ k ≀ 1000).
1,100
Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.
standard output