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
19423ec307724e2c40db74e4fb34f7da
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.IOException; import java.io.PrintWriter; import java.util.InputMismatchException; import java.util.Scanner; public class Edu_1 { public static void main(String[] args){ FasterScanner in=new FasterScanner(); PrintWriter out=new PrintWriter(System.out); int n=in.nextInt(); int k=in.nextInt(); S...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
6ded9b835c2e7a370e4dd1239b6a6e4d
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.awt.Point; import java.awt.geom.Line2D; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.security.GuardedObject; im...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
22bf1b5032d2f2a7b42e3b76ef296677
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class C628C { public static void main(String[] args)throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.i...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
7b9a10ed6c31246424381d4f24502ec4
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); scanner.nextLine(); String s = scanner.nextLine(); StringBuffer newS = new StringBuffer(); for(int i = 0; i < n; i++)...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
b13a928e72c492503f68c540a5f39b45
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.*; import java.util.StringTokenizer; /** * Created by peacefrog on 2/20/16. * 9:00 AM */ public class CF628C { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; PrintWriter out; long timeBegin, timeEnd; public void runIO() throws IOException { timeBegin = System.currentT...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
73e8b548186d7b20a1a6624bb649379e
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; import java.math.BigInteger; import java.util.ArrayList; /** * Built using CHelper plug-in * Actual soluti...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
e62b029d7fe0cfc61fac24e805347be0
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Codef{ public static void main(String[] args) throws IOException{ BufferedReader vod=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st=n...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
d730bf36bfd4f180f3e3614d63976a66
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) throws IOException { FastScanner qwe = new FastScanner(System.in); int n = qwe.nextInt(); int k = qwe.nextInt(); char[] ans = new char[n]; char[] word = qwe.next().toCharArray(); for (int i = 0; ...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
16e0b1027ec76badcc47bfeaefef053b
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.*; public class C { public static void main (String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] nums = reader.readLine().split(" "); int n = Integer.parseInt(nums[0]); int k = Integer.parseInt(nums[1...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
8644f4274a6ef16ec6d582b6a4d318f0
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; public class Main{ // split de array public static int[] readInts(String cad) { String read[] = cad.split(" "); int res[] = new int[read.length]; for (int i = 0; i < rea...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
46351492c14bcfd8a3ebef519129ddb3
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.util.*; import java.io.*; public class Major { public static void main(String [] args)throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int k = Integer.parseInt(st...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
d0e29dbfc18e4a1c01f1ceeabbc482ec
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.awt.Point; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; import java.math.BigDecimal; /** * * @author Mojtaba */ public class Main { public static void main(String[] args) throws IOException { MyScanner in...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
7951391529dcdb640157667baa0de85c
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.*; import java.util.*; public class C628 { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(), k = input.nextInt(); String s = input.next(); char[] res = new char[n]; int dist = 0; for(int i = 0;...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
88c70a3e6f931f0cdc34e24f518971c5
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.util.*; import java.io.*; public class C { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); String[] nk = in.readLine().split(" "); i...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
76bca9be45cc54808f317e60c38e9af1
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner stdin = new Scanner(new BufferedInputStream(System.in)); int n = stdin.nextInt(); int k = stdin.nextInt(); stdin.nextLine(); String s = stdin.nextLine(); char[] ss = s.toCharArray(); // System.out.p...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
a17eb40e9b1760b7ea667a0da6349966
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class P628C { InputStream is; PrintWriter out; String INPUT = "3 1000 hey"; void solve() { int n = ni(); ...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
f14e7ab40723eaeded91450a9a2ca24a
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; /** * Feb 19, 2016 | 4:18:25 PM * <pre> * <u>Description</u> * * </pre> * * @author Essiennta Emmanuel (colourfulemmanuel@gmail.com) */ public class Pro...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
98386cdaaa9cc8ff4095b3373eaa1ea2
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
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 C { static int max(char c) { c -= 'a'; return Math.max(25 - c, c); } public static void main(String[] args) throws ...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
15915937141a19b9f3f172193655116f
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.util.Scanner; public class BearAndStringDistance { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long k = in.nextLong(); in.nextLine(); String s = in.nextLine(); char[] ar = new char[n]; char c; int max; boolean nearZ = false; boolea...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
3aa6b7c768a79510f647e624e86db5e8
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args){ Scanner in = new Scanner(System.in); int len = in.nextInt(); int dist = in.nextInt(); char[] ch = in.next().toCharArray(); StringBuilder sb = new StringBuilder(); for(int i = 0; i<ch.length; i++){ // System.out.println(d...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
359e0d1f2b71d55e60c290e62cb62de7
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Limak { public static Integer[] parse(String st) { String[] a = st.split(" "); Integer[] ar = new Integer[a.length]; for (int i = 0; i < a.length; i++) ar[i] = Integer.parseInt(a[i]); return ar; } public static void solve(String s,...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
7bb64bae930de9c6ed2674703d7e2944
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.util.Scanner; public class CodeforcesD { public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int b = in.nextInt(); String c = in.next(); char[] s = c.toCharArray(); for(int i=0; i<s.length; i++){ if(s[i]-'a'>=b){ s[i]=(char) (s[i]-b); ...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
4d6a4e7ba9c1c1cbf0ce5b6b655136e3
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.*; import java.util.*; public final class string_dis { static FastScanner sc=new FastScanner(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out=new PrintWriter(System.out); public static void main(String args[]) throws Exception { int n=sc.nextInt(),k=sc....
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
8070ec25eef85cc90d95edb95139fce7
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.InputMismatchException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the to...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
b3d59baec51967aed2e5b42cd07f6f08
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=in.nextInt(); int k=in.nextInt(); int a[]=new int [n]; String s=in.next(); int max1=0; for(int i=0;i<n;i++){ a[i]=s.charAt(i)-'a'; max1+=Math.max(25-a[i], a[i]-0); }...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
687e5a59302322beb4bb31ba5dd5ee64
train_000.jsonl
1455894000
Limak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.The distance between two letters is defined as the difference between their positions in the alphabet. For example, , and .Also, the distance between two nice strings is defined as the sum of distance...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class ProblemC { public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); new Pro...
Java
["4 26\nbear", "2 7\naf", "3 1000\nhey"]
1 second
["roar", "db", "-1"]
null
Java 7
standard input
[ "greedy", "strings" ]
b5d0870ee99e06e8b99c74aeb8e81e01
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 106). The second line contains a string s of length n, consisting of lowercase English letters.
1,300
If there is no string satisfying the given conditions then print "-1" (without the quotes). Otherwise, print any nice string s' that .
standard output
PASSED
ee8ec0d829f72dba6b477251666e8b48
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
//package Practice_Problems; import java.util.*; import java.io.*; public class uniqueness { static int arr[],pref[],suf[]; static Set<Integer> set; static final int mod=(int)1e9+7; static final int inf=(int)1e9; static final long INF=(long)1e18; public static void main(String[] args) { FastScanner fs=new Fast...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
ee42dfee5febecdad6acb485c79a4aa5
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
//package Practice_Problems; import java.util.*; import java.io.*; public class uniqueness { static int arr[],pref[],suf[]; static Set<Integer> set; static final int mod=(int)1e9+7; static final int inf=(int)1e9; static final long INF=(long)1e18; public static void main(String[] args) { FastScanner fs=new Fast...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
e2633d0b3a28e874980ef5b8f93e3bbb
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); int a[] = new int[n]; Map<Integer, Integer> map = new HashMap<Integer, Integer>(); for (int i = 0; i < n; i++) { ...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
dd48d97d9fd00d7f407eff8574da91e4
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashSet; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcep...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
29f6d24e2cbad81ae7e31ca65c998183
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.*; import java.util.*; import java.util.regex.*; public class UNT { public static void main(String[]stp) throws Exception { Scanner scan=new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); BufferedReader br = new BufferedReader(new InputStreamReader(System.in))...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
0b6f5707ee8fd8fc7c2c5dd50b09f333
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; /** * @author AnonymousP * @__WHEN YOU FEEL LIKE QUITTING, THINK ABOUT WHY YOU STARTED__@ */ //COMBINATON = nCr = n*(n-1)/2 public class uniqueness { public static void main(String[] args) throws IOExceptio...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
07cdbaa27568672f9f35742f7f62faa4
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.*; import java.util.*; import java.util.regex.*; public class UNT { public static void main(String[] stp) throws Exception { Scanner scan = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); BufferedReader br = new BufferedReader(new InputStreamReader(Sys...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
8169bbb42d4c0083b45dbf1525cca068
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.HashMap; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.InputStream;...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
53cb44d60009f382fd799ab09a1145de
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.TreeMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int f = 0; in...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
5679550e203c3f2835b470b566c77637
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); HashMap<Integer,Integer> hm=new HashMap<>(); Set<Integer> hs=new HashSet<>(); int count=0; int a[]=new int[n]; ...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
747554d4a6b02a79afacd068e66d7c09
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.util.*; public class Uniqueness { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = s.nextInt(); HashSet<Integer> hs = new HashSet<>(); int l = 0; ...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
08459b4a8b7f8422eaaace68fb05d48a
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.*; import java.util.*; public class A implements Runnable { boolean judge = false; FastReader scn; PrintWriter out; String INPUT = "10\r\n" + "1 2 3 4 5 5 5 6 6 6"; void solve() { int n = scn.nextInt(); int[] arr = scn.nextIntArray(n); HashMap<Integer, Integer> map = new HashMap<>(); HashS...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
0a4bc9636996c096724a3d3deee81b82
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner s = new Scanner(System.in); int n = s.nextInt(); Set<Long> set = new LinkedHashSet<Long>(); long[] arr = new long[n]; for (int i = 0; i < n; i++) { ...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
f66c5e406999c82c364ed31ecf8a1acd
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner s = new Scanner(System.in); int n = s.nextInt(); Set<Long> set = new TreeSet<Long>(); long[] arr = new long[n]; for (int i = 0; i < n; i++) { arr[...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
23225e75a9ecf6297b30e3f7545cb0fe
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner s = new Scanner(System.in); int n = s.nextInt(); Set<Long> set = new HashSet<Long>(); long[] arr = new long[n]; for (int i = 0; i < n; i++) { arr[i...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
c430f6234bd3699c174780844ac14ee1
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.InputMismatchException; import java.io.BufferedOutputStream; import java.util.HashSet; import java.util.StringTokenizer; import java.io.Flushable; import java.io.OutputStream; import java.io.Pr...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
e3e2c7fd0829ae52b09e912f2e95c1da
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.*; import java.util.*; public class Main{ static int mod=(int)1e9+7; public static void main(String[] args) throws IOException { Writer out=new Writer(System.out); Reader in=new Reader(System.in); int ts=1; outer: while(ts-->0) { int n=in.nextInt(); int a[]=in.readArray(n); ...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
d469fa66783b602556abd30ffc666970
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.*; import java.util.*; // CODE JAM SHIT public class Q2 { public static void main(String[] args) { InputReader in = new InputReader(true); PrintWriter out = new PrintWriter(System.out); int N =in.nextInt(); int arr[]=new int[N+N]; for(int i =0;i<N;i++) arr...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
1923a4d508e264cfd387fbad12a592d1
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.util.*; import java.io.*; public class File { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // Try each prefix that does not contain any duplicates. // Extend the suffix to the longest possible. int n = sc.nextInt(...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
5c07a7bcb6d6c0eabfa0fcfc6c4d006d
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int len = n; for (int j = 0; j < n; j++) { a[j] = sc.nextInt(); ...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
7b702dee4f3200c1080a39f3abf2961c
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int len = n; for (int j = 0; j < n; j++) { a[j] = sc.nextInt(); ...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
cffdf07b05b0fa546add31deeade1254
train_000.jsonl
1566743700
You are given an array $$$a_{1}, a_{2}, \ldots, a_{n}$$$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) and delete integers $$$a_l, a_{l+1}, \ldots, a_r$$$ ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main implements Runnable { boolean multiple = false; long MOD; @SuppressWarnings({"Duplicates", "ConstantConditions"}) void solve() throws Exception { int n = sc.nextInt(); /*read int arr a of size n...
Java
["3\n1 2 3", "4\n1 1 2 2", "5\n1 4 1 4 9"]
2 seconds
["0", "2", "2"]
NoteIn the first example all the elements are already distinct, therefore no subsegment needs to be removed.In the second example you can remove the subsegment from index $$$2$$$ to $$$3$$$.In the third example you can remove the subsegments from index $$$1$$$ to $$$2$$$, or from index $$$2$$$ to $$$3$$$, or from index...
Java 11
standard input
[ "two pointers", "binary search", "implementation", "brute force" ]
9873a576d00630fa6e5fd4448a1a65ad
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 2000$$$) — the number of elements in the given array. The next line contains $$$n$$$ spaced integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \le a_{i} \le 10^{9}$$$) — the elements of the array.
1,500
Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $$$0$$$.
standard output
PASSED
f36d34f7367bf54141808c1f8d39e4de
train_000.jsonl
1410103800
Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends Andrew multiple queries of type "di → ti", that means "replace all digits di in string s with substrings equal to ti". For example, if s = 123123, then query "2 → 00" transforms s to 10031003, and query "3 → " ("rep...
256 megabytes
// Codeforces Round #265 (Div.1) C. Substitutes in Number (464/C) import java.util.*; import java.util.AbstractMap.SimpleEntry; public class SubstitutesInNumber { public static void main(String[] args) { Solver solver = new Solver(); solver.solve(); } } class Solver { private final long MOD = 100000000...
Java
["123123\n1\n2-&gt;00", "123123\n1\n3-&gt;", "222\n2\n2-&gt;0\n0-&gt;7", "1000000008\n0"]
1 second
["10031003", "1212", "777", "1"]
NoteNote that the leading zeroes are not removed from string s after the replacement (you can see it in the third sample).
Java 8
standard input
[ "dp" ]
c315870f5798dfd75ddfc76c7e3f6fa5
The first line contains string s (1 ≤ |s| ≤ 105), consisting of digits — the string before processing all the requests. The second line contains a single integer n (0 ≤ n ≤ 105) — the number of queries. The next n lines contain the descriptions of the queries. The i-th query is described by string "di-&gt;ti", where di...
2,100
Print a single integer — remainder of division of the resulting number by 1000000007 (109 + 7).
standard output
PASSED
adf7767268aaf95f23f63adbdcdc8ec1
train_000.jsonl
1410103800
Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends Andrew multiple queries of type "di → ti", that means "replace all digits di in string s with substrings equal to ti". For example, if s = 123123, then query "2 → 00" transforms s to 10031003, and query "3 → " ("rep...
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
["123123\n1\n2-&gt;00", "123123\n1\n3-&gt;", "222\n2\n2-&gt;0\n0-&gt;7", "1000000008\n0"]
1 second
["10031003", "1212", "777", "1"]
NoteNote that the leading zeroes are not removed from string s after the replacement (you can see it in the third sample).
Java 8
standard input
[ "dp" ]
c315870f5798dfd75ddfc76c7e3f6fa5
The first line contains string s (1 ≤ |s| ≤ 105), consisting of digits — the string before processing all the requests. The second line contains a single integer n (0 ≤ n ≤ 105) — the number of queries. The next n lines contain the descriptions of the queries. The i-th query is described by string "di-&gt;ti", where di...
2,100
Print a single integer — remainder of division of the resulting number by 1000000007 (109 + 7).
standard output
PASSED
716cc30a98802bfdcbe0cc1792bd8faf
train_000.jsonl
1410103800
Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends Andrew multiple queries of type "di → ti", that means "replace all digits di in string s with substrings equal to ti". For example, if s = 123123, then query "2 → 00" transforms s to 10031003, and query "3 → " ("rep...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @auth...
Java
["123123\n1\n2-&gt;00", "123123\n1\n3-&gt;", "222\n2\n2-&gt;0\n0-&gt;7", "1000000008\n0"]
1 second
["10031003", "1212", "777", "1"]
NoteNote that the leading zeroes are not removed from string s after the replacement (you can see it in the third sample).
Java 8
standard input
[ "dp" ]
c315870f5798dfd75ddfc76c7e3f6fa5
The first line contains string s (1 ≤ |s| ≤ 105), consisting of digits — the string before processing all the requests. The second line contains a single integer n (0 ≤ n ≤ 105) — the number of queries. The next n lines contain the descriptions of the queries. The i-th query is described by string "di-&gt;ti", where di...
2,100
Print a single integer — remainder of division of the resulting number by 1000000007 (109 + 7).
standard output
PASSED
0d8a5c2dd9103aefd720b931edc40dde
train_000.jsonl
1410103800
Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends Andrew multiple queries of type "di → ti", that means "replace all digits di in string s with substrings equal to ti". For example, if s = 123123, then query "2 → 00" transforms s to 10031003, and query "3 → " ("rep...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import java.math.BigInteger; import static java.math.BigInteger.*; import static java.util.Arrays.*; import javax.xml.ws.Holder; //<editor-fold defaultstate="collapsed" desc="Main"> public class Task{ // https://netbeans.org/kb/73/java/editor-code...
Java
["123123\n1\n2-&gt;00", "123123\n1\n3-&gt;", "222\n2\n2-&gt;0\n0-&gt;7", "1000000008\n0"]
1 second
["10031003", "1212", "777", "1"]
NoteNote that the leading zeroes are not removed from string s after the replacement (you can see it in the third sample).
Java 8
standard input
[ "dp" ]
c315870f5798dfd75ddfc76c7e3f6fa5
The first line contains string s (1 ≤ |s| ≤ 105), consisting of digits — the string before processing all the requests. The second line contains a single integer n (0 ≤ n ≤ 105) — the number of queries. The next n lines contain the descriptions of the queries. The i-th query is described by string "di-&gt;ti", where di...
2,100
Print a single integer — remainder of division of the resulting number by 1000000007 (109 + 7).
standard output
PASSED
98ee5deb7463352f8ea5dc078a25d92e
train_000.jsonl
1410103800
Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends Andrew multiple queries of type "di → ti", that means "replace all digits di in string s with substrings equal to ti". For example, if s = 123123, then query "2 → 00" transforms s to 10031003, and query "3 → " ("rep...
256 megabytes
import java.util.*; import java.io.*; public class C { public static PrintStream out = System.out; public static InputReader in = new InputReader(System.in); static long MOD = (long) 1e9 + 7; static class Node { static Node EMPTY_LEAF = new Node(0); int i; List<Node> children = n...
Java
["123123\n1\n2-&gt;00", "123123\n1\n3-&gt;", "222\n2\n2-&gt;0\n0-&gt;7", "1000000008\n0"]
1 second
["10031003", "1212", "777", "1"]
NoteNote that the leading zeroes are not removed from string s after the replacement (you can see it in the third sample).
Java 8
standard input
[ "dp" ]
c315870f5798dfd75ddfc76c7e3f6fa5
The first line contains string s (1 ≤ |s| ≤ 105), consisting of digits — the string before processing all the requests. The second line contains a single integer n (0 ≤ n ≤ 105) — the number of queries. The next n lines contain the descriptions of the queries. The i-th query is described by string "di-&gt;ti", where di...
2,100
Print a single integer — remainder of division of the resulting number by 1000000007 (109 + 7).
standard output
PASSED
cadc9c949c687eca80e82578eb55467a
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int numOfFriends = scn.nextInt(), fenceHeight = scn.nextInt(), count = 0, n; for (int i = 0; i < numOfFriends; i++) { n = scn.nextInt(); if (...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
7b57aa1e06c21fbf8d3ce8c4f706257f
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class VanyaAndFence { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int friendNum = scanner.nextInt(); int fenceHeight =scanner.nextInt(); int minWidthOfRoad = 0; for (int i = 0; i < friendNum; i++) { ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
68f32573db9e4dee52ce63224f39333a
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class VenyaAndFence { public static void main(String[] args) { Scanner input = new Scanner (System.in); int num =input.nextInt() , h =input.nextInt(), width =0; for (int i=1; i<=num; i++){ int ai = input.nextInt(); if (ai <= h) w...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
9687557d24b8b2f854f96be4fbd0bcac
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class problem { public static void main(String[] args) { int n,h,w=0 , s; Scanner input = new Scanner(System.in); n=input.nextInt(); h=input.nextInt(); int [] arr=new int[n]; for(int i=0;i<n;i++) { ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
56b740461104239c756a9e0e1b97e39f
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
//package test; import java.util.Scanner; public class test { public static void main(String[] args) { // TODO Auto-generated method stub Scanner IN = new Scanner(System.in); int n,h,len,x; n = IN.nextInt(); h = IN.nextInt(); len = 0; for (int i = 1; i<=n; i++){ x = IN.nextInt(); if(x>h) len+...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
665034e91b7cc7d2a3a8a32b906167e4
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; /** * * @author i7 */ public class ProblemSolving { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int n,h,w=0,s; Scanner input = new Scanner(System.in); ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
7f3a4adc453d44c00385e9aab2c08595
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class test { public static Scanner myScanner = new Scanner(System.in); public static void main(String[] args) { int n = myScanner.nextInt(); int h = myScanner.nextInt(); int[] arr = new int[n]; int result = 0; for(int X = 0; X < n ; X++) { arr[X] = myScanner.nextIn...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
c5ee0faa75b1f854443bcf7049e84ea7
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Test { public static Scanner myScanner = new Scanner(System.in); public static void main(String[] args) { int n, h; n = myScanner.nextInt(); h = myScanner.nextInt(); int[] numOfFriends = new int[n]; int minimumWidth = 0; for(int p = 0; p < n; p++) { numOfFr...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
dc7a02440fa32a74e247d6b637871a59
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; /** * * @author CesarAlfonsoMendoza */ public class A { public static void main(String[]args){ Scanner in = new Scanner(System.in); int n=in.nextInt(),h=in.nextInt(),persona,suma=0; for(int i=0;i<n;i++) { persona=in.nextInt(); if(persona>h) suma+=2; else...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
3b830d85a368e3f8fa218bba869287c7
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Main { private static int PersonsNumber; private static int FenceHeight ; private static int RoadSize = 0 ; public static void main(String[] args) { // write your code here Scanner myObj = new Scanner(System.in); ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
7b822d99a3f860cc28130b1c337982d7
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Main { private static int RoadSize = 0 ; public static void main(String[] args) { // write your code here Scanner myObj = new Scanner(System.in); int personsNumber = myObj.nextInt(); int fenceHeight = myObj.nextInt(); for (int ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
d47b5077cc0e13bbcde5e9ac95561505
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Cf_677_A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), h = sc.nextInt(); int sum = 0; for(int i = 0; i < n; i++) { int num = sc.nextInt(); if(num <= h) sum += 1; else if(num > h) sum+= 2; } ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
3612566e0e69b95274dff7baf504dd76
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author mohanad */ public class Main { public static void main(String[] args) { InputStream i...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
c5400b22047db518de6bcc3c8b7f3eb0
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class practice { public static void main(String [] args){ Scanner sc =new Scanner(System.in); int n = sc.nextInt(); int h = sc.nextInt(); int sum = 0; for(int i = 0; i< n; i++){ int b = sc.nextInt(); if(b <= h) sum += 1; else sum+=2; } Syst...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
19da74548b74f60dc5884ec27d6a02e1
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Sol { public static void main(String args[]) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int h=s.nextInt(); int a[]=new int[n]; int count=0; for(int i=0;i<n;i++) a[i]=s.nextInt(); for(int k=0;k<n;k+...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
cff8e54df8e7617295a3d14d78a2d805
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class CF { public static void main(String[] args) { Scanner input= new Scanner(System.in); long maxH; int n = input.nextInt(); int h = input.nextInt(); maxH = n; for(int i = 0 ; i < n ; i++){ int a = input.nextInt(); ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
0ad22cf0596c4c0106de16a1850b627c
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner (System.in); //takes in an input let first one a be the number of people and b be the height of the fence int n = scan.nextInt(); int h = scan.nextInt(); in...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
1a41318c8090ecf0d435b54a901387a3
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(), h = input.nextInt(),sum=0; int []a = new int[n]; for(int i=0; i<n; i++){ a[i]=input.nextInt(); } for(...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
7d55b64f2b181cf32a2c5c34ae1fe93a
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(), h = input.nextInt(),sum=0; for(int i=0; i<n; i++){ int x= input.nextInt(); if(x<=h) sum ++; ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
94051436a3e9b64853a8d114c99dc73d
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(), h = input.nextInt(),sum=0; for(int i=0; i<n; i++){ int x= input.nextInt(); if(x>h) sum ++; ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
9afd1fc337a431e3efa3da320a27d1c4
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); // Start writing your solution here. ------------------------------------- int n = sc....
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
965a9b2dbc4dd1785cb2e984075c5122
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); // Solution int n = sc.nextInt(),h = sc.nextInt(); List<Integer> a = new ArrayList<In...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
fd0e5979c0348ff40b532d44eeb2d323
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); out = new PrintWriter(new BufferedOutputStream(System.out)); // Solution int n = sc.nextInt(),h = sc.nextInt(); List<Integer> a = new ArrayLi...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
61ad75809460b250cb24024f2abace8c
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; public class Dis { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x=input.nextInt(); int y=input.nextInt(); int c=0; int arr[]=new int [10000]; for(int i=0;i<x;i++) { arr[i]=input.nextInt(); } for(int i=0;i<x;i++) ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
b567e87e80168a47a27f0c9dd815bd4e
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.util.Scanner; import java.util.*; public class JavaApplication5 { public static void main(String[] args) { Scanner in = new Scanner(System.in); short n ,h,sum=0; n=in.nextShort(); h=in.nextShort(); short arr[]= new short[n]; for(short i=0;i<n;i++) ...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
59c422a1ac518bfa7a44c900b540a657
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class VanyaAndFence1 { static class Reader { final private int BUFFER_SIZE = 1 << 16; priva...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
99109fa23d37bf7119a3e5abbbcd4500
train_000.jsonl
1464798900
Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class VanyaAndFence { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in));...
Java
["3 7\n4 5 14", "6 1\n1 1 1 1 1 1", "6 5\n7 6 8 9 10 5"]
1 second
["4", "6", "11"]
NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required m...
Java 8
standard input
[ "implementation" ]
e7ed5a733e51b6d5069769c3b1d8d22f
The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively. The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
800
Print a single integer — the minimum possible valid width of the road.
standard output
PASSED
e1049491bfbc118af591e828da1e7a0f
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
/** * Created with IntelliJ IDEA. * User: olethra * Date: 25/10/13 * Time: 18:56 * To change this template use File | Settings | File Templates. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public cl...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
9ddb6f41ed642c4b2c70039da85844f9
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.util.*; public class Main { private static final long MOD = 1000000007; public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); scan.nextLine(); StringBuilder builder = new StringBuilder()...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
710aa40ea210f130f12ab7daa2c05f98
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.io.StreamCorruptedException; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.LinkedList; import java.util.PriorityQueue; import java...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
3aeff2330333a174428489b70044b9fb
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.util.Scanner; import java.io.File; import java.lang.Math; public class B { private Scanner sc; int n; static int t = 0; static int len; String[] s; static String mess; public static void main(String[] args) throws Exception { B cl = new B(); cl.input(); ...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
5136bc5207e2453db662c19f0d2e6739
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.util.Scanner; public class Main { private static boolean matches(String needle,String haystack) { int n = 0; for (int i=0;i<haystack.length();i++) { if (needle.charAt(n) == haystack.charAt(i)) { n++; if (n == needle.length()) return true;...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
425c2c877afb1679af550f00a9a3dd49
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.util.*; import java.util.regex.*; import java.text.*; import java.math.*; public class Solution { public static void main(String args[]){ Scanner scan = new Scanner(System.in); String line = scan.nextLine(); Scanner sc = new Scanner(line); int n = sc.nextInt(); String[] x = new String[n]; f...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
1828ae3cfe3a7d6b4ea0b16e6058b167
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main{ public static void main(String args[]){ Scanner in=new Scanner(System.in); int n=in.nextInt(); in.nextLine(); ArrayList<String>a=new ArrayList<String>(); for(int i=0;i<n;i++) a.add(in.nextLi...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
c0ac438577f5b021d9179cf9e9968bd7
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.BufferedReader; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static ...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
37c2e2863053a26c93399a050db59fa4
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
/* Date : Nov 27, 2013 Problem Name : dima and text messages Location : http://codeforces.com/contest/358/problem/B Algorithm : bruteforces Status : solving CodingTime : 10:05- ReadingTime : */ import java.util.*; import java.io.*; public class Main { static Buf...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
a02178896a1c14831271950aaf49bc05
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; public class C358B { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new Inpu...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
79025b18b76d82a47772107ef1ec7f44
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String[] words = new String[2*n+1]; for(int i = 0; i< 2*n; i+=2){ words[i] = "<3"; w...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
6c6c8053045781e69cbb262c8dbaa075
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Locale; public class Solution implements Runnable { static BufferedReader in; static PrintWriter out; public static void main(String[] args) { new Thread(null, new Solution(), "", 256 * (1L << 20)).start(); } public void run(...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
d1ff006fa5546f65046c30dd80afe98a
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.*; public class N358B { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); StringBuilder sb = new StringBuilder(); for(int i = 0; i < n; i++){ ...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
ba8ec76ed0d873ee45b20bb7af79d267
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.util.*; import java.io.*; public class TaskB { FastScanner in; PrintWriter out; public void solve() throws IOException { int n = in.nextInt(); String[] words = new String[n]; for (int i = 0; i < n; i++) { words[i] = in.next(); } String sms = ...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
ec06eef4a00df78b51a010bbe25a93c3
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.*; import java.util.*; public class CF { void solve() { int n = in.nextInt() + 1; String[] s = new String[n]; s[0] = "<3"; for (int i = 1; i < n; i++) s[i] = in.next() + "<3"; String ss = in.next(); int it = 0; for (int i1 = 0; i1 < n; i1++) for (int i2 = 0; i2 < s[i1].length(); i2...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
1e713351d77297a5933a2ac31e21d192
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class B implements Runnable { private void solve() throws IOException { int n = nextInt(); StringBuilder all = new Stri...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
316db31989be408c4b01b0c67516c96c
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.InputMismatchException; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author karan173 */ public class Main { public static void m...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
b266b474c6cdb57825e87c7ad69da182
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Stack; public class Q1 { public static void main(String[] args) { FasterScanner s= new FasterScanner(); PrintWriter out=new PrintWrit...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
9db85ddf5983f6414bb7a982971d07c2
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.*; import java.util.*; public class cf358b { static FastIO in = new FastIO(), out = in; public static void main(String[] args) { int n = in.nextInt(); StringBuilder sb = new StringBuilder("<3"); for(int i=0; i<n; i++) { sb.append(in.next().trim()); sb.append("<3"); } ...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
2d5818682c3b70c0a85ae47a487af2a5
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.io.IOException; import java.io.InputStreamReader; import java.util.InputMismatchException; import java.io.PrintStream; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.TreeSet; import java.io.Reader; import java.io.Writer; import java.io.InputStream; ...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output