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
ccff8bbccef895aa5c475dbfea4222bc
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ public static void main(String args[])throws IOException{ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t --> 0){ ...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
10a857229004c75af6fc8c4483a9b9c8
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ public static void main(String args[])throws IOException{ Scanner sc = new Scanner(System.in); int t1 = sc.nextInt(); while(t1 --> 0){ ...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
0af5022dc4963001d2eeb694f5b38484
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class geek { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); for (int i1 = 0; i1 < n; i1++) {...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
89527df27ed1ecff2ee94040152ead11
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.Scanner; import java.util.Set; import java.util.StringTokenizer; public class code12 { static class FastReader { BufferedReader br; StringTokenizer s...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
38145ad8a5465d00253be70f121dbc3c
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { BufferedReader sc=new BufferedReader(new I...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
2b609d433432ac9bd64e04528e713d9c
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { InputReader in = new InputReader(System.in); int t = in.readInt(); while(t-- > 0) { int n = in.readInt(); char s[] = in.readString().toCharArray(); char trick[] = new char[n]; ...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
122558b2a27403a620a16f943a1ed494
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0){ String n = sc.next(); String o = sc.next(); String s = o; StringBuilder a = new StringBu...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
4f37d06dcb4ea6d77c57cb0fa709c7da
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.util.Scanner; public class TernaryXOR { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int test=sc.nextInt(); for(int t=1;t<=test;t++) { int n=sc.nextInt(); String x=sc.next(); String a="",b=""; ...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
243adbebdb9ab57a8065dbc17713f493
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class C { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); int n, f; String x; Stri...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
fd40bf5c7b2211c7e1fc030e9d6a2127
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.util.Scanner; public class C { public static void main(String [] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); String tr=sc.next(); StringBuffer str= new StringBuffer(...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
0d9f93a42a68958c425e1ee42b1cba25
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
// 02/08/20 12:35 PM Aug 2020 import java.util.*; public class _1328C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); String s = sc.next(); StringBuilder st1...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
be0fb3fe124baa6b0efa5e2f3e87aa72
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class C_POST { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while (t-- > 0) { ...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
35bbaa335e3ec8db47bb421216629c63
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main{ public static void main(String Args[])throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while(t-->0) { StringBuilder s1 = new StringBu...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
fdb693cf4cc11642ef47e94f291cddfd
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.util.Scanner; public class TernaryXOR { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for (int i = 0; i < t; i++) { int n = input.nextInt(); String str = input.next(); boolean bool = false; StringBuffer ans1 = new StringBuffe...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
d99b2761fa6b37b468d5bb6653223be8
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
/* * Remember a 6.72 student can know more than a 10.0 student. * Grades don't determine intelligence, they test obedience. * I Never Give Up. * I will become Candidate Master. * I will defeat Saurabh Anand. * Skills are Cheap,Passion is Priceless. * Obsession is necessary. * Author : Sameer Raj */ import jav...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) — the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer — two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
23bf12cc6cafc5361a989abae001c90e
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.io.*; import java.util.*; /** * @author master_j * @version 0.4.1 * @since Mar 22, 2015 */ public class Solution { private void solve() throws IOException { int w = io.nI(), h = io.nI(), rooksNum = io.nI(), rectsNum = io.nI(); Rook[] rooks = new Rook[rooksNum]; for (int i = 0; ...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
55f1271d613bf0903c60a39faa533fb3
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.io.*; import java.util.*; /** * @author master_j * @version 0.4.1 * @since Mar 22, 2015 */ public class Solution { private void solve() throws IOException { int w = io.nI(), h = io.nI(), rooksNum = io.nI(), rectsNum = io.nI(); Rook[] rooks = new Rook[rooksNum]; for (int i = 0; ...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
763b841a1a5369f1c6935c2f47f8f61d
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintStream; import java.io.PrintWriter; import static java.lang.Integer.max; import static java.lan...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
387ab747cdc28e6d8f892300a9b47ceb
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class Main { static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writ...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
2a872e715c6fe87fa2b5e1533ec46f2c
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.io.*; import java.util.*; public class A { FastScanner in; PrintWriter out; int n, m, k, q; class Point { int x, y; public Point(int x, int y) { super(); this.x = x; this.y = y; } } class Query { Point p0, p1; int num; public Query(Point p0, Point p1) { super(); this...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
ee43b9985945b6522c6a7b4600220631
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; public class B { boolean[] vert(int n, int m, int k, int q, Point[] p) { boolean[] ans = new boolean[q]; Arrays.sort(p); ST tree = new ST(100100); for (Point...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
b9bc104a39807c4984f9a0159739663f
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.util.Arrays; import java.util.ArrayList; import java.io.InputStream; import java.io.InputStreamReader; import java.util.List; import java.io.BufferedReader; import java.math.BigInteger; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /*...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
2b45d67388d4f78915f9f9cbea3fd01a
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.io.*; import java.util.*; public class E { FastScanner in; PrintWriter out; void solve() { int n = in.nextInt(), m = in.nextInt(), k = in.nextInt(), q = in .nextInt(); int[] x = new int[k], y = new int[k]; for (int i = 0; i < k; i++) { x[i] = in.nextInt() - 1; y[i] = in.nextInt() - 1; ...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
4fb339e9d04ddd9427f838a95156a070
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
8791c43d5b2e3034b880859be3938bdb
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.util.Arrays; import java.util.ArrayList; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper p...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
a97fc27aaf013c99ec8a90c36cc2e3a2
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.io.*; import java.util.*; public class E { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; static class Rook { int x, y; public Rook(int x, int y) { this.x = x; this.y = y; } static Comparator<Rook> byX = (Rook a, Rook b) -> { return Integer.compare(a.x, b.x);...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
fe5a417b51ca552bd15ffb3e65f40ca9
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.io.*; import static java.lang.Math.*; import java.util.*; import java.util.concurrent.ArrayBlockingQueue; import java.util.function.*; import java.lang.*; public class Main { final static boolean debug = false; final static String fileName = ""; final static boolean useFiles = false; publi...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
59bd48e49800a66ddbe35784bca90409
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.util.*; import java.io.*; import java.awt.Point; import java.math.BigDecimal; import java.math.BigInteger; import static java.lang.Math.*; // Solution is at the bottom of code public class E implements Runnable{ final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
c4617e046f306cb082ecfef86febc514
train_000.jsonl
1426946400
Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of special strategic importance on the board, they must be protected well. According to Polycarpus, a rectangular area of ​​the bo...
256 megabytes
import java.io.FileNotFoundException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.File; import java.io.Writer; import java.util.List; import java.io.IOException; import java.io.InputStreamReader; import java.io.FileReader; import java.util.Arrays; import java.u...
Java
["4 3 3 3\n1 1\n3 2\n2 3\n2 3 2 3\n2 1 3 3\n1 2 2 3"]
2 seconds
["YES\nYES\nNO"]
NotePicture to the sample: For the last area the answer is "NO", because cell (1, 2) cannot be hit by a rook.
Java 8
standard input
[ "data structures", "sortings" ]
ab2db2c83d0c9de72f40c9a4c813a37f
The first line contains four integers n, m, k and q (1 ≤ n, m ≤ 100 000, 1 ≤ k, q ≤ 200 000) — the sizes of the board, the number of rooks and the number of strategically important sites. We will consider that the cells of the board are numbered by integers from 1 to n horizontally and from 1 to m vertically. Next k li...
2,400
Print q lines. For each strategically important site print "YES" if it is well defended and "NO" otherwise.
standard output
PASSED
7cbcf775529a342dc05197444af27cc3
train_000.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.stream.IntStream; public class _158B { public static void main(String... args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); Map<Integer, Integer> map = new HashMap<>(); map.put(4, 0); map.put(3, 0); ...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 8
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
e846aca4ad16a72a940f43562aaa41bb
train_000.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.*; public class Ayrton{ public static void main(String ...ar){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int []a = new int[n]; int one = 0; int two=0; int three=0; int four=0; for(int i=0; i<n; i++){ a[i] ...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 8
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
798fac1831a2bd4facdcfbbaf3c9c7ff
train_000.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.*; public class Ayrton{ public static void main(String ...ar){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int []a = new int[n]; for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } Arrays.sort(a); int max = 4; i...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 8
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
a3a99bbeb876888cac8e5ba94ceee64e
train_000.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int num[] = new int[4]; int taxi = 0; for (int i = 0; i < n; i++) { num[s.nextInt() - 1]++; } // 3 1 처리 if (num[2] > 0 && num[0] > 0) { int tmp; if (num[...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 8
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
b4d6fe75e7a9b67d0137faaaf7f8ad1c
train_000.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Taxis { public static void main(String[] args) throws IOException{ BufferedReader entrada = new BufferedReader(new InputStreamReader(System.in)); int grupos = Integer.parseInt(entrada.readLine()); String ...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 8
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
e093a6c8c36e0655827214b3a15cb730
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
/** * * @author meashish */ import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.io.Serializable; import java.util.InputMismatchException; public class Main { InputReader in; PrintStream out; private void start() { int n = in.nextInt(); ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
733e4c43def0ef34aa8877c0cf52b71a
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public final class BearAndBlocks { public static void main(String[] args) { new BearAndBlocks(System.in, System.out); } static class Solver { // BufferedRe...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
56c59d9d7bc2932e9e0473573c3a046b
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.Scanner; public class BearAndBlocks { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int heights[] = new int[n + 2]; for (int i = 1; i <= n; ++i) heights[i] = scanner.nextInt(); scanner.close(); int results[] = new int[...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
85797312ee04003a2c63e80e63c3702a
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.*; import java.io.*; /*NO RESPECT*/ public class Main implements Runnable { static boolean showTime = false; public void solve() throws IOException { int n = nextInt(); int[] h = new int[n]; for(int i = 0; i < n; i++) h[i] = nextInt() - 1; int[] lef...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
a8fb080e4ac42c21fc0a87a4c5026a96
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
//package practice; /** * Created by Rajan Waliya on 03-Sep-15. */ import java.io.*; import java.util.*; //public class D574 { Reader sc; PrintWriter out; int n; int[] h; void solve() throws IOException { n = sc.nextInt(); h = new int[n+2]; for(int i=1;i<=n;i++){ ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
41a56beed44ccf6a555360e23c3dcc3c
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
//package practice; /** * Created by Rajan Waliya on 03-Sep-15. */ import java.io.*; import java.util.*; //public class D574 { Reader sc; PrintWriter out; int n; int[] h; void solve() throws IOException { n = sc.nextInt(); h = new int[n+2]; for(int i=1;i<=n;i++){ ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
fc22c5642cfe4c1380ab43412a20cbb1
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; public class Main{ public static int gcd(int a, int b){ if (b == 0) return a; else return gcd(b, a % b); } public static int mcm(int a, int b...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
e5333650bb17e305fbc9a7c6ae2a26e5
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class D { public static void main(String[] args) { FastScanner sc = new FastScanner(); int ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
338e2921608ad86f0f7d09f9ada15902
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class ProblemD { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try{ String line = br.readLine(); int size =...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
d2538a64b731152222cb0d74035ed4c8
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.Scanner; public class Main { public static long min(long x,long y){ return x<y?x:y; } public static long count(long[] original){ int n = original.length; long[] left = new long[n]; long[] right = new long[n]; long best = 1; for(int i=0;...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
74fbe3a99d597fa55105d043541439b4
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String [] args)throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int array[] = new int[n]; StringTokenizer st = new StringTokenizer(br.readLine()); fo...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
84217a301cbddaab3183d3183aa842d8
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.*; import java.util.*; public class D { public static void main(String[] args) { MyScanner sc = new MyScanner(); int nbB = sc.nextInt(); int[] height = new int[nbB]; // we don't care of the first value sc.nextInt(); height[0] = 1; for (int i = 1; i < nbB; i++) { int input = sc.nextInt...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
a98292e630378fb92b4c9113d3123c0e
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Random; import java.util.StringTokenizer; public class D { public static ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
620d83ec25af43bcee84728ad154511f
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.Scanner; public class Main { public int howMuch(int n, int [] t) { int worst = 0; int [] res = new int[n + 1]; Arrays.fill(res, 0); for(int i = 1; i<=n; i++) { worst = Math.min(worst, t[i - 1] - i); ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
6e19d9506fce31bc064fba679b5afb76
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; import java.io.InputStream; import java.io.InputStreamReader; /** * Built using CHelper plug-in * Actual solution is at the top * @author asdf_alex */ public class M...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
3ea8601f84c60ab0e18326079bbda369
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.*; //PrintWriter import java.math.*; //BigInteger, BigDecimal import java.util.*; //StringTokenizer, ArrayList public class R318_Div2_D { FastReader in; PrintWriter out; public static void main(String[] args) { new R318_Div2_D().run(); } void run() { in = new FastReader(System.in...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
9d313e3f7f22cb016809b03fccd86b3d
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.*; import java.util.*; public class cf318_d_2 { public void solve() throws IOException { int n = nextInt(); int a[] = new int[n]; int l[] = new int[n]; int r[] = new int[n]; for (int i = 0; i < n; ++i) { a[i] = nextInt(); } l[0] = ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
b7e184adb49b26bf3c5a3115015de8c9
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.*; import java.util.*; public class D { InputStream is; int __t__ = 1; int __f__ = 0; int __FILE_DEBUG_FLAG__ = __f__; String __DEBUG_FILE_NAME__ = "src/T"; FastScanner in; PrintWriter out; class State implements Comparable<State> { int id; int op; State(int id, int op) { this.id =...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
21d386efbe7d6e197c48846d71b0856c
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.*; import java.io.*; public class CF574D{ public static int index; public static void main(String[] args)throws Exception { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int n = in.nextInt(); int [] a = new int[n...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
b8aa8dbe30b8ee12a81fb37abef6ee80
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.*; import java.util.*; public class PrD { public static void main(String[] args) throws IOException { new PrD().run(); } BufferedReader in; PrintWriter out; StringTokenizer st; String nextToken() throws IOException { while (st == null || !st.hasMoreTokens()) { st = new StringTokenizer(in....
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
a4957f348187e83b7c32f5a934e5980d
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.Scanner; /** * Created by slycer on 9/15/15. */ public class BearandBlocks { public static void main ( String [] args ){ Scanner s = new Scanner( System.in ); int n = s.nextInt(); int [] data = new int[n+2]; for ( int i=1; i<=n; i++ ){ data[i] = s.nex...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
cdf7d5b26925ac292326cf9d39135519
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.stream.IntStream; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.W...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
183339083b68cd4e5b8e1cedda2331d7
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.Writer; import java.io.OutputStreamW...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
9d354e9c4836d8260114d3dde47e732b
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.Writer; import java.io.OutputStreamW...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
cf0adb5589c2d65806cab6142e7ddb30
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; import static java.lang.Math.max; import static java.lang.Math.min; public class Main { private FastScanner in; private PrintWr...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
baa598c1d14547af173c804c479fc24f
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int i, k=0; int[] h= new int[100002]; int[] l= new int[100002]; int[] r= new int[100002]; int n=in.nextInt(); for (i=1; i<=n; i++) h[i]=in.nextInt(); for (i=1; i<=...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
466b164b260e808587f801c8695fc359
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
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
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
fc496caedf9371e6134d32ceb1f0cb9d
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.Scanner; // public class GYM2E { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++){ arr[i] = scan.nextInt(); } int[] left = new int[n]; int[] right = new int[n]; left[0] = 1; ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
eaf142c970e90ec5d48f732282dd0dde
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.PrintStream; import java.util.Scanner; public class myclass { public static PrintStream out = System.out; public static Scanner in = new Scanner(System.in); public static void main(String[] args){ int n = in.nextInt(); int a[] = new int[n]; for (int i = 0; i < n; i++) a[...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
9e64550699b5d0986c8a9f0f12340c9c
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.BufferedInputStream; import java.util.Scanner; public class DBlocks { public static void main(String[] args) { final Scanner scanner = new Scanner(new BufferedInputStream(System.in)); int N = scanner.nextInt(); int[] height = new int[N + 1]; int[] shutdown = new int...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
be0736a27239c3d51153f373ec88ed77
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class SolveD { BufferedReader br; StringTokenizer in; PrintWriter out; public String nextToken() throws IOException { while (in == null || !in.hasMoreTokens()) { in = new StringTokenizer(br.readLine()); ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
0ee6a1bda123a63d924b474f76a50462
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import jav...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
3d331c3ae91b9fb58b3ae058d0552917
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.IOException; import java.util.InputMismatchException; public class BearAndBlocks { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); int N = sc.nextInt(); int[] H = new int[N + 2]; for (int i = 1; i <= N; i++) { H[i] = sc.nextInt(); } int[] dl = new...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
8421595c3d03f2b48b6daea09a9efce3
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class p4 { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputSt...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
d1b52b98a5580199954bf7f97a7e703e
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String [] args)throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int array[] = new int[n]; StringTokenizer st = new StringTokenizer(br.readLine()); fo...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
e0c08e6d3b0cc3cacb80efd333bbc7d9
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top * @author Artyom Korzun */ public cla...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
3ca5272d5c482b7a6f9eb57011cf73f8
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.util.Scanner; /** * @author misterku */ public class Solution implements Runnable { public static void main(String[] args) { new Thread(new Solution()).start(); } @Override public void run() { Scanner cin = new Scanner(System.in); int n = cin.nextInt(); ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
698f7d549a519a4254dfe65b2ec54e19
train_000.jsonl
1440865800
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
256 megabytes
import java.io.PrintWriter; import java.util.*; import java.util.stream.IntStream; import static java.lang.Math.*; import static java.util.stream.IntStream.range; public class Sub { public static void main(String[] args) throws Exception { new Sub().doit(); } public long gcdl(long a, long b) ...
Java
["6\n2 1 4 6 2 2", "7\n3 3 3 1 3 3 3"]
1 second
["3", "2"]
NoteThe picture below shows all three operations for the first sample test. Each time boundary blocks are marked with red color. After first operation there are four blocks left and only one remains after second operation. This last block is destroyed in third operation.
Java 8
standard input
[ "dp", "shortest paths", "data structures", "math" ]
a548737890b4bf322d0f8989e5cd25ac
The first line contains single integer n (1 ≤ n ≤ 105). The second line contains n space-separated integers h1, h2, ..., hn (1 ≤ hi ≤ 109) — sizes of towers.
1,600
Print the number of operations needed to destroy all towers.
standard output
PASSED
e6125d163b712afacb1d9589a6df8b33
train_000.jsonl
1458910800
Johnny is playing a well-known computer game. The game are in some country, where the player can freely travel, pass quests and gain an experience.In that country there are n islands and m bridges between them, so you can travel from any island to any other. In the middle of some bridges are lying ancient powerful arti...
512 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf302218c { public static void main(String[] args) throws IOException { int n = rni(), m = ni(); List<Map<Integer, Integer>> g = new ArrayList<>(), ng = new ArrayList<>(); ...
Java
["6 7\n1 2 0\n2 3 0\n3 1 0\n3 4 1\n4 5 0\n5 6 0\n6 4 0\n1 6", "5 4\n1 2 0\n2 3 0\n3 4 0\n2 5 1\n1 4", "5 6\n1 2 0\n2 3 0\n3 1 0\n3 4 0\n4 5 1\n5 3 0\n1 2"]
3 seconds
["YES", "NO", "YES"]
null
Java 11
standard input
[ "dsu", "dfs and similar", "trees", "graphs" ]
a65813fabe4110a3ee3d891f09302be1
The first line contains two integers n and m (1 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of islands and bridges in the game. Each of the next m lines contains the description of the bridge — three integers xi, yi, zi (1 ≤ xi, yi ≤ n, xi ≠ yi, 0 ≤ zi ≤ 1), where xi and yi are the islands connected by the i-th bridge, zi...
2,300
If Johnny can find some artifact and sell it print the only word "YES" (without quotes). Otherwise print the word "NO" (without quotes).
standard output
PASSED
ab1cdbaeebc9fbd3d59158d85b8fd0f6
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { static PrintWriter pw = new PrintWriter(System.out); static class node { String s; int size; int rounds; int[] c1 = new int[26]; int[] c2 = new int[26]; int beauty; ...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
a0ae36f79527729e7d4fdf3c86dcdf5a
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class Solution { public static int freq(String s){ HashMap<Character,Integer>h=new HashMap<>(); int m=1; for(int i=0;i<s.length();...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
8008c51c5c13d706ed4823756b62887d
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
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
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
79ac49d68c60f1be047fc46af1af8716
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.*; public class Main { static ArrayList<ArrayList<Integer>> tree = new ArrayList<>(); public static int size(int from, int exclude) { int size = 1; for (Integer v : tree.get(from)) { if (v != exclude) { size += size(v, from); } }...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
e0b2c3aa576b37346783aee158700dcb
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.util.*; public class B{ public static void main(String[] args)throws Throwable { MyScanner sc=new MyScanner(); PrintWriter pw=new PrintWriter(System.out); int n=sc.nextInt(); int [] c=new int[125]; String x=sc.next(); int mx1=0; for(char s : x.toCharArray()) { c[...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
0bdd577bc9817b2dd52ad1cde721f632
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.util.*; public class d{ public static void main(String args[]) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader sc = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
f26d406ebcabd1a43b5a2ccf5f289ca7
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.Scanner; public class TreasureHunt { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); String a = s.next(); String b = s.next(); String c = s.next(); int[] arr = new int[58]; int[] brr = new int[58]; ...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
1d03c8c8192e49f704a0e3c2e62758b5
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces979B { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(br.readLine()); int ...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
6ae5b6e88609aa015f14532d6a957c4d
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.*; public class Treasure{ public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] ribbons = new String[3]; for(int i = 0; i < 3; i++){ ribbons[i] = sc.next(); } int[...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
3deaaac96e409c77a893aa9a03edaa4b
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.*; public class Treasure{ public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] ribbons = new String[3]; for(int i = 0; i < 3; i++){ ribbons[i] = sc.next(); } int[...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
bc44a0ba37a1b0bfa2e4c2defec83519
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.DataInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.TreeMap; public class B{ public static void main(String[] args) throws Exception{ Parser ps = new Parser(System.in); int n = ps.nextInt(); String[] ribbons = ne...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
bbe3bfcb3cd8583570e7b4f56b40eb2e
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import java.math.*; public class Main extends Thread { boolean[] prime; FastScanner sc; PrintWriter pw; MathF mf; final class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner() { tr...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
19eab0221a00310f876b104c9a93d119
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.Arrays; import java.util.Iterator; import java.util.PrimitiveIterator; import java.util.Scanner; import java.util.function.Supplier; import java.util.stream.IntStream; import java.util.stream.Stream; public class Main{ static Scanner s=new Scanner(System.in); void solve(){ int n=gInt(); int[][]...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
6761a59df900d5b6a41171ca40a24283
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.util.*; public class Mainn { InputReader scn; PrintWriter out; String INPUT = ""; ArrayList<Integer>[] tree; void solve() { int n = scn.nextInt(), size; char[][] s = { scn.next().toCharArray(), scn.next().toCharArray(), scn.next().toCharArray() }; int[][] arr = new int[3][200...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
41bc12cdfe95e7d047065e159a2f7a22
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.util.Comparator; import java.io.InputStreamReader; import java.io.InputStream...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
342c2971f3ca20e9cdafa7a07400c85c
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); } public static void main(String args[]) { InputStream inputStream = System.in; OutputStream outputStream = System.out; PrintWriter out = ...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
269930fb31d3d011ff438a2170c45f7e
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Try { static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputReader(InputSt...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
08f8628db1e2e4ecbd6fc0ed2d495b75
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; ...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
9bfebd375523acb6aec0bcc95204cfa7
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Collections; import java.util.HashM...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
1c045a0d29bae425c831ef0a5fcb097d
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader in; static PrintWriter out; public static void main(String[] args) throws IOException{ //InputStream ins = new FileInputStream("E:\\rush.txt"); InputStream ins = System.in; in = new Input...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
51ff6b5ddda75f8b3936993eb271ab5d
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
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
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
bad5439ed2e6960d819321670d1ce118
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.*; public class Solution { static class Score implements Comparable<Score> { public String name; public int score; public Score(String name, int score) { this.name = name; this.score = score; } @Override publ...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
5119fa92dfc686d6ee286e21001b555c
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class Main { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter o...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
c28671a5bf04b2b4107ba124f2fa95e4
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.Input...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
44f00580bcb9681b0157a51a8152a014
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
//package com.company; import java.io.*; //import java.nio.file.Paths; import java.util.*; import java.math.*; public class Main{ public static void main(String[] args)throws Exception { Scanner s = new Scanner(System.in); StringBuilder sb = new StringBuilder(); long n=s.nextLong(); ...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
057962fab33cc3cacbabb1a4077c63b6
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.util.*; /** * Created by hapsi on 11.10.2016. */ public class Main { private static class FastScanner { private BufferedReader bufferedReader; private StringTokenizer stringTokenizer; public FastScanner(InputStream inputStream){ bufferedReader = n...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
4187ca5e42fd4afdb95d55b1f9e2f16a
train_000.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.*; import java.util.*; public class B979 { static int find(int c1,int size,int n) { if(c1==size && n==1...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output