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
29434341febe353078e445d5cbf58428
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.util.*; public class Main { public static void main (String[] args){ Scanner in = new Scanner(System.in); String s = in.next(); int c[] = new int[26]; for(int i =0 ;i<s.length();i++) { c[s.charAt(i)-'a']++; } int odd=0; for(int i =0 ;i<c.length;i++) { if(c[i]%2==1) ...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
37892db3397986bc91a365beb7869874
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.util.Scanner; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.math.BigDecimal; import java.io.BufferedWriter; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigIntege...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
d67cb2c84f8da81eabcf2c8c3b43a1e9
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.util.*; public class P_276B { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next(); int[] cBucket = new int[26]; for (int i = 0; i < s.length(); ++i) cBucket[s.charAt(i) - 'a']++; int oddNum = 0; for (int i = 0; i < 26; ++i) { if (cBucke...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
ad3133b623f1753b7141228e72c63fc8
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; /** * * @hor user */ public class gameB { public static void main(String[] args) throws IOException { BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); int[] A= new int[26]; String S= br....
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
30ce7e7cf5e76e8e0ff6c6d8bbba6b53
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.util.*; import static java.lang.Math.*; import java.awt.Point; import java.io.*; public class A { static Scanner sc = new Scanner(new BufferedInputStream(System.in)); public static void main(String[] args) { String in = n() ; int[] a = new int[26]; for(int i = 0; i < in.length(); i++) a[in.c...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
44457db284c26d479c911dd5acf77fab
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class LittleGirlAndGame { public static void main(final String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s = in.readLine(); int length = s.lengt...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
5b4084912a4289082cb47a8e4e5222fe
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.io.IOException; import java.util.InputMismatchException; public class LittleGirlAndGame { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); char[] S = sc.nextLine().toCharArray(); int[] freq = new int[256]; for (int i = 0;...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
383f3296873b5184e429816fa8217b7f
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.io.*; import java.util.*; public final class little_girl_and_game { static Scanner sc=new Scanner(System.in); static PrintWriter out=new PrintWriter(System.out); public static void main(String args[]) throws Exception { char[] a=sc.next().toCharArray(); int[] cnt=new int[123]; for(int i=0;i<a.le...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
8b2bddfe1de9bae56f77a09b271a9779
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.util.*; import static java.lang.System.*; public class A276 { Scanner sc = new Scanner(in); public void run() { String n=sc.next(); boolean pali=true; int[] c=new int[30]; for(int i=0;i<n.length();i++){ c[n.charAt(i)-'a']++; } int odd=0...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
05ee660c3ad490217dbd89c5d7f8af85
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class B { public static void main(String[] args) { Scanner s = new Scanner(System.in); String line = s.nextLine(); Set<Character> set = new HashSet<Character>(); for (char c : line.toCharArray()) { ...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
fe2e6124c21d06c38a4d768cecd5e895
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.util.Scanner; public class B{ public static void main(String args[]){ Scanner input = new Scanner(System.in); String str = input.next(); char let[] = str.toCharArray(); boolean ans = true; int winner = 2; while(ans){ boolean won = true; ...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
275071c59be4b024e5fcce9652b3486c
train_001.jsonl
1361719800
The Little Girl loves problems on games very much. Here's one of them.Two players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from string s. If the player befor...
256 megabytes
import java.util.Scanner; public class B_169 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s=sc.next(); int a[]=new int[1000]; for (int i = 0; i <s.length(); i++) { a[(int)s.charAt(i)-97]++; } int ans=0; for (int i =0; i <=26; i++) { if(a[i]%2==1 && a[i]!=0)...
Java
["aba", "abca"]
2 seconds
["First", "Second"]
null
Java 7
standard input
[ "greedy", "games" ]
bbf2dbdea6dd3aa45250ab5a86833558
The input contains a single line, containing string s (1 ≀ |s|  ≀  103). String s consists of lowercase English letters.
1,300
In a single line print word "First" if the first player wins (provided that both players play optimally well). Otherwise, print word "Second". Print the words without the quotes.
standard output
PASSED
4ca637662379e13fed724fe2c5b29b53
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.io.*; import java.util.Arrays; public class RemoveSmallest{ public static void main(String[] args){ try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int cases = Integer.parseInt(br.readLine()); int arLen = 0; String[] temp; int[] arr = nu...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
e4a47e6bf7abe1dccb2bd17be0128691
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.io.*; import java.util.Arrays; public class RemoveSmallest{ public static void main(String[] args){ try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int cases = Integer.parseInt(br.readLine()); int arLen = 0; String[] temp; int[] arr = nu...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
6450882ad70bdcbe158749c79b313682
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { // Use the Scanner class Scanner sc = new Scanner(System.in); /* int n = sc.nextInt(); // read input as integer long k = sc.nextLong(); // read input as long double d = sc.n...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
1f966007d83a7b87ef9519954360c6d7
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args){ Scanner inp =new Scanner(System.in); int t = inp.nextInt(); while(t-- >0){ int n =inp.nextInt(); int[] nums =new int[n]; for(int i=0;i<n;i++){ nums[i] =...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
bc3e9268141e5a0b2d6d649429f024c1
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.util.*; import java.io.*; public class RemoveSmallest { private void removeSmallest(List<List<Integer>> inputList) { for (List<Integer> list : inputList) { helper(list); } } private void helper(List<Integer> list) { Collections.sort(list); for (int i...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
0b0089c4af34d733d9645897347ffdba
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception{ Scanner s=new Scanner(System.in); int t=s.nextInt(); for(int is=0;is<t;is++) { int n=s.nextInt(); int[] arr=new int[n]; ...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
4a0c00eec89f9c25c4e935a806c97643
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception{ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int j=0;j<t;j++) { int n=sc.nextInt(); int[] arr=new int[n];...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
4cc7a9a0ae13385cd41f4db8fb8479a2
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class RemoveSmallest { public static class FastScanner { BufferedReader br; StringTokenizer st; public Fa...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
1d7f8f070da8ed1160f3eae0d12e4d43
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ public static void main(String args[]){ Scanner s = new Scanner(System.in); int t=s.nextInt(); for(int i=0;i<t;i++){ int n=s.nextInt(); int a[]=new int[n]; int c=0; for(int j=0;j<n;j++) a[j]=...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
936080f4b3808d7dd19caf08cd5588f9
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.util.*; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t > 0) { t--; int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { ...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
333eb69d6023834c71c7b9509d6a4177
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.util.*; public class A1 { public static void main(String[] args) { Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int k=0;k<t;k++) { int n=in.nextInt(); int[] arr=new int[n]; for(int i=0;i<n;i++) { arr[i]=in.nextInt(); } int z = arr.length; for (i...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
b1dc181de6f63e8e2f53976ab4474c49
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class Rem { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
bf6170ef0732c50d93c13ecc16efc73d
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Solution{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- != 0){ int n = sc.nextInt(); int[] a = new int[n]; for(in...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
11cb69b615a2ff4fb429e3df7c217db2
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; public class Main { public static void main(String args[])throws Exception { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); Scanner sc=new Scanner(System.in); int t=Integer.parseInt(in.readLine()); //String ...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
06645247964c43631228f5a1a1669cbe
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { ...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
3f837cb5db3cc48be4bd3be315a3cc90
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int[]arr=new int[n]; for(int...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
5c139d6e505811cf9bfe482bf280674a
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
//package RemoveSmallest; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int t=scan.nextInt(); while(t-->0) { int n=scan.nextInt(); ArrayList<Integer> l=new ArrayList<Inte...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
c0ef609250e5acbf12d6d2624be0db40
train_001.jsonl
1596638100
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int i = 0; i < t; i++) { int n = in.nextInt(); ArrayList<Integer> arr = new ArrayList<Integer>(); for(int j = 0; j < n; j++) arr.add(in.nextInt(...
Java
["5\n3\n1 2 2\n4\n5 5 5 5\n3\n1 2 4\n4\n1 3 4 4\n1\n100"]
1 second
["YES\nYES\nNO\nNO\nYES"]
NoteIn the first test case of the example, we can perform the following sequence of moves: choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$); choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose an...
Java 8
standard input
[ "sortings", "greedy" ]
ed449ba7c453a43e2ac5904dc0174530
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” 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 50$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_...
800
For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.
standard output
PASSED
2889eba8d5e70612508570ba814a9cfa
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class q_2_41 { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] temp; temp ...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
25280ae5791703f18af6c296ccb8dcc1
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ar { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
a8abbada6554d735c8c73c6469616a1f
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.*; import java.lang.*; import static java.lang.Integer.min; /** * * @a...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
637d8edba16eb966a29e3a1ecbe92a9e
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
//package math_codet; import java.io.*; import java.util.*; public class lets_do { public static void main(String[] args) { InputReader in=new InputReader(System.in); StringBuffer str=new StringBuffer(); int n=in.nextInt(); int k=in.nextInt(); int i=0; int arr[]=...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
080d02b68163b0ea4dce6ea4e0b52a3d
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
d71103c30eebb27b5aa966e7e956f731
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.util.Scanner; public class LectureSleep { public static void main(String[] args) { Scanner cin=new Scanner(System.in); int N = cin.nextInt(); int k=cin.nextInt(); int arr[]=new int[N]; int time[]=new int[N]; for(int i=0;i<N;i++) { ...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
e62dc963eeaf9ddbd3c4ec9afe59b5f9
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import ja...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
74458ea49b466f2b05db46bcfc6cb8d9
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.util.Scanner; /* * 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. */ /** * * @author SteinOr */ public class CF961B { /** * @param args the command line arguments...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
057098a781126ce0f2360952c4928013
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.io.*; import java.util.*; import java.util.regex.*; public class vk18 { public static void main(String[]stp) throws Exception { Scanner scan=new Scanner(System.in); //BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //String []s; int n=scan.nextI...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
0a8868de10cc178fb6e13744a042d61c
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.util.*; import java.io.*; public class CFQB { public static void main(String args[]) throws Exception { Scan scan = new Scan(); Print print = new Print(); int N=scan.scanInt(); int K=scan.scanInt(); int arr[] = new int[N]; int t[] = new int[N]; for (int i = 0; i < N; i++) { arr[i] = ...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
b325d00781949061c3b7ac693ada69e7
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.util.Scanner; /** * Created by Kirill on 04.04.2018. */ public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int[] a = new int[N]; int[] t = new int[N]; for(int i = 0...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
4ef30e7d2a2849491aec831e5faed809
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.io.*; import java.util.*; public class p961B { public static void main(String args[]) throws Exception { Scanner cin=new Scanner(System.in); String[] line = cin.nextLine().split(" "); int[] firstLine = new int[2]; for (int i=0; i<2; i++){ firstLine[i]=Integer....
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
e4cef68fe0f365ef42ae6aa23e5ac804
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import org.omg.CORBA.MARSHAL; import java.awt.event.InputEvent; import java.awt.image.AreaAveragingScaleFilter; import java.io.*; import java.net.CookieHandler; import java.util.*; import java.math.*; import java.lang.*; public class Main implements Runnable { static class InputReader { private InputStre...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
b68551791b4b1d33bc2fa198e6af3dce
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class B_educ_41 { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int k = scn.nextInt(); int[] as = new int[n]; int[] ts = new int[n]; for(int i = 0; i < n; i++) { as[i] = scn.nextInt(); }...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
9996d37b128337c3b98ea078bdca2f51
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.util.*; import java.io.*; public class lecture { public static void main(String[]args) throws IOException{ BufferedReader kb = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer line = new StringTokenizer(kb.readLine()); int n = Integer.parseInt(line.nextToken()), k = Integer.parse...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
d6ff7f59dbad0c1382fc5e72ad43e5fa
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.io.*; import java.util.*; public class pishty { public static void main(String[] args)throws IOException { //InputStreamReader read=new InputStreamReader(System.in); //BufferedReader in=new BufferedReader(read); FastReader in=new FastReader(); PrintWriter pw=new PrintWriter(System.out, t...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
5faec450595d23f01e1aa93a5c9d5263
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
c1f0f8ae742831f78bde08ca798ff525
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int total_time = sc.nextInt(); int k = sc.nextInt(); int[] original = new int[total_time]; for(int i = 0; i < total_time...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
a2165702eaa86600806cadbc87f3fd88
train_001.jsonl
1522850700
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given an array t of Mishka's behavior. If Mishka is asleep during the i-th min...
256 megabytes
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // duration of lecture int k = in.nextInt(); // time to keep awake int [] tabn = new int [n]; int [] behav= new int[n]; for (int i = 0 ; i < n...
Java
["6 3\n1 3 5 2 5 4\n1 1 0 1 0 0"]
1 second
["16"]
NoteIn the sample case the better way is to use the secret technique at the beginning of the third minute. Then the number of theorems Mishka will be able to write down will be equal to 16.
Java 8
standard input
[ "dp", "two pointers", "implementation", "data structures" ]
0fbac68f497fe189ee088c13d0488cce
The first line of the input contains two integer numbers n and k (1 ≀ k ≀ n ≀ 105) β€” the duration of the lecture in minutes and the number of minutes you can keep Mishka awake. The second line of the input contains n integer numbers a1, a2, ... an (1 ≀ ai ≀ 104) β€” the number of theorems lecturer tells during the i-th m...
1,200
Print only one integer β€” the maximum number of theorems Mishka will be able to write down if you use your technique only once to wake him up.
standard output
PASSED
de1fcb94b4b01a2f74e497bcdb8f6669
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Main { // 1 1 1 1 1 1 1 1 5 public static void main(String[] args) throws IOException { Scanne...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 8
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
9941ea56b91cf598beb63d20563299cd
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] args)throws Throwable { MyScanner sc=new MyScanner(); PrintWriter pw=new PrintWriter(System.out); int n=sc.nextInt(); long [] a=new long [n]; for(int i=0;i<n;i++) a[i]=sc.nextInt(); Arrays.sort(a); for(int i=1;i...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 8
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
e62bceb2c596f5741d4fbb7fac528211
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.util.Arrays; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Comparator; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 8
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
c4510579d3f2da71655b425208fe7d66
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(Sys...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 8
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
b9a4ab71f38995b8c56d49bd7b86e93e
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { IIO io; Main(IIO io) { this.io = io; } public static void main(String[] args) throws IOException { ConsoleIO io = new Cons...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 8
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
507c0e5cca500c24427f8ee365482b8e
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.*; import java.util.*; public class D implements Runnable{ public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();} public void run() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); System.err.println("Go!"); int n = fs...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 8
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
1d7c4f2ead7ecaa6f738142b30520499
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class NaughtyStonePiles { static final int MAX = (int)...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 8
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
f019afdd22becbda586a9bcee5d034e1
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws IOException { ...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 8
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
2398c6a6095624ed6d9c998d5ea57504
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.*; import java.util.*; public class CodeForces { static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; void runCase(int caseNum) throws IOException { // for (int i = 0; i < 100000; ++i) // out.println("1000000000"); // out.println(); int n = ...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 6
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
b8103da85bc78d583676d1eb4c4797d1
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class ProblemB { public static void main(String[] args) throws I...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 6
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
a19ffe9c49594bd4a46182912c8532c9
train_001.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Random; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is ...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 6
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≀ n ≀ 105) β€” the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≀ ai ≀ 109) β€” the initial sizes of the stone piles. The third line contains integer q (1 ≀ q ≀ 105) β€” the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers β€” the answers to the queries in the order, in which the queries are given in the input. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
c8bf593591532a4fd707f671992b5eed
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
// http://codeforces.com/contest/126/problem/B import java.util.Scanner; public class Password { public static void main(String[] args) { Scanner in = new Scanner(System.in); char[] s = in.next().toCharArray(); in.close(); int[] arr = new int[s.length]; int i = 1, j = 0; while(i < s.length) { if(s[i]...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
feffee4b7812ee4148b455f2913010a4
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
/* * Date: 13.05.12 * Time: 23:45 * Author: * Vanslov Evgeny * vans239@gmail.com */ import java.io.FileNotFoundException; import java.util.Scanner; public class C { public static void main(String[] args) throws FileNotFoundException { // final Scanner scanner = new Scanner(new BufferedReader(new...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
9cbb473f2c64cffb20e78e3988af847d
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
/** * Created by icon on 1/17/2016. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class CF126B { public sta...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
dff1a7683ba237300c5a324eb6e0fbd5
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Password { public static int[] preProcessPattern(String ptrn) { int i = 0, j = -1; int ptrnLen = ptrn.length(); int[] b = new int[ptrnLen + 1]; b[i...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
c8bb75c9f0cc1d5d808ce1e20a8e3309
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Password { public static void main(String[] args){ FastScanner sc = new FastScanner(); String s = sc.nextTo...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
4c00a0a16c9f3ab1c45bccc7b61eb254
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @auth...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
dfb9508b4dcc6e0fefe28b37c1b3fecb
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.*; import java.util.*; public class kmp { public static int zarr(String s) { int z[]=new int[s.length()]; int n=s.length(); z[0] = 0;//1st element is always zero for (int i=1; i<n; ++i) { int j = z[i-1]; while (j > 0 && s.charAt(i) != s.charAt(j)) j = z[j-1]; //System.out.println...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
9d2e01d86fc3389fd7141f0c90f94fff
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class Round93_B { int[] z; public void run(String str) { char[] s = str.toCharArray(); int n = s.length; ...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
2a016895d9a8b4f8e4460420e71c40a5
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.util.*; public class Password { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next(); int[] zv = zValues(s); int max = -1; int result = -1; for(int x = 1; x < zv.length; x++) { if(zv[x] > max) { max = zv[x]; } else if(zv[...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
506576d7551ec0da2fd714e4aa07c589
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.Character.Subset; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; i...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
2a7c8e1c52d6e8ff0a549e914355dd70
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.math.BigDecimal; import java.io.BufferedWriter; import java.util.Locale; import java.util.InputMismatchException; import java.util.ArrayList; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInt...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
9cbc7dc2ed4ab19094061d0c84eb6001
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; public class z_function { static StreamTokenizer st; static String s; public static void main(String[] args) throws IO...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
82f6f95fe7d933018693aa10170f0a53
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; public class z_function { static StreamTokenizer st; static String s; public static void main(String[] args) throws IO...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
f4ea4493009cbb1e022635d2451c1855
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Password { static int [] ZFunction(char[] s){ int z[] = new int[s.length]; z[0] = s.length; int r = 0; int l = 0; int n = s.length; ...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
dce87453d15d0ad556e8551f2bc352b7
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.*; import java.util.*; import java.io.DataInputStream; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import java.util.Stack; public class fast{ static class InputReader { private bool...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
e125833434376e023a55839d173c98b6
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Password { static char[] s; static int[] z; static int n; static void solve() { int L = 0, R = 0; for (int i = 1; i < n; i++) { if (i > R)...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
d06640992438680fb961ff1eba41e6d5
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Password { static int[] z; public static void Z(StringBuilder s) { int L = 0, R = 0; int n = s.length(); z = new int[n]; for (int i = 1; i < n; i++) { ...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
1fbe35245c0dca1a18e88caeaa6a6289
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Password { static int[] z; public static void Z(StringBuilder s) { int L = 0, R = 0; int n = s.length(); z = new int[n]; for (int i = 1; i < n; i++) { if ...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
553ea038fdcc0aba032e085f16509d10
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Password { static int[] z; public static void Z(StringBuilder s) { int L = 0, R = 0; int n = s.length(); z = new int[n]; for (int i = 1; i < n; i++) { if (i > R) { L = R = i; while (R < n ...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
25d7a56cf39c77ff6ce0b5d231d5eabf
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual so...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
0463d6021cabc6615738a4f0668b0e74
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Zfunction { // input String static char s[]; // z function static int z[]; // length of string s static int n; static void Zfunction() { int L = 0, R = 0; for (int i =...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
a8f569eb550dd24d7b383e6ad854a0a6
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual so...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
76d768d1aa9c08c4e15db90b8c2c036f
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.TreeSet; public class ZValues { public static int[] zValues(String s) { int[] z = new int[s.length()]; z[0] = s.length(); int l = 0; int r = 0; int j = 0; for (int i = 1; i < s.length(); i++) ...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
4a961ed1d48bf6a6e6c7c413c667b77b
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.util.*; public class ZValues { public static void main(String[] args){ Scanner br = new Scanner(System.in); String s = br.next(); boolean alla = true; for(int i = 0;i<s.length();i++){ if(s.charAt(i) != 'a'){ alla = false; } ...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
d669be7f911156c20259d1cbce3ccb7f
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.util.*; public class ZValues { public static void main(String[] args){ Scanner br = new Scanner(System.in); String s = br.next(); boolean alla = true; for(int i = 0;i<s.length();i++){ if(s.charAt(i) != 'a'){ alla = false; } } if(s.length() > 100 && alla){ System.out.println(s.sub...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
4ac3dae1609f6a6a18e94f44880f472b
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
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.Stack; public class ProblemB { static final long PRM = 1000000009; public static void main(String[] args) throws IOException { BufferedReader in = ...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
d09f3065b25912bb5b66b4ad54ba9bd5
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.*; import java.util.*; import java.awt.*; import java.math.*; public class Main { static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out) ); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st = new StringTokenizer(""); sta...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
547e38cbac03036108e4e581b6251e08
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.util.*; import java.util.LinkedList; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.math.BigInteger; public class tmp { public static void main(String [] args) throws Exception{ BufferedReader in = new BufferedReader(new InputStrea...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
49bc3f73c9815d8c14f2786b21493687
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Scanner; im...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
364ebbd85737c3098899662859185bac
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Arrays; import java.util.Scanner; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.math.BigInteger; import j...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
355a3224ac7bee9f9c57d7ada673c0ad
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.LinkedList; public class Main { static int[] z; static void Z_fun(String s) { char[] c = s.toCharArray(); int L = 0, R = 0; for (int i = 1; i < c.length; i++) { if (...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
78b367764f60317eea48c6d90d74d4d0
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.*; import java.util.*; public final class password { static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc=new FastScanner(br); static PrintWriter out=new PrintWriter(System.out); static long[] pow1,pow2,inv1,inv2; static long mod1=(long)(1e9+7),m...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
897d4fb98fec9ba2a4778d6c1c222984
train_001.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.util.Scanner; public class Password { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); int max = -1; int[] next = new int[s.length()+2]; next[0] = -1; int j = -1; for (int i = 1; i < s....
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 7
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
0969498ca0e49a056d4f627a444f7f7d
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.Scanner; public class PythagoreanTriples { public static void main(String[] args) { Scanner in = new Scanner(System.in); long num = in.nextLong(); if (num <= 2) { System.out.println("-1"); return; } if (num % 2 == 0) { ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
8649b03527716e86e40ba81e2b59506a
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import static java.lang.Math.*; public class Main { private FastScanner scanner = new FastScanner(); public static void main(String[] args) { new Main().solve(); } int p[]; ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
03526d3a7b3547534ad6cdbd3e9187c0
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author xwchen */ public class Main { public static void main(String[] args) { InputStream in...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
96ae770ec84a5ca52e4f13a0655f301c
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.Scanner; public class Tasks { public static void main(String[] args) { Scanner in = new Scanner(System.in); long a = in.nextLong(); if ((a == 2) || (a == 1)) { System.out.println("-1"); return; } long b; if (a % 2 == 1) { System.out.print(a * a / 2); System.out.print(' '); ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
7a4478a246391b03694a03f80a3b79c3
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.*; import java.awt.geom.*; import java.io.*; import java.math.*; public class Main { public static void main(String[] args) { long startTime = System.nanoTime(); int n=in.nextInt(); Long M=0L; Long N=0L; if(n%2==0 && n>2) { n/=2; M=(long)n; N=1L; ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
ebef4c9f228307e9380db92b172f3479
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.*; import java.awt.geom.*; import java.io.*; import java.math.*; public class Main { public static void main(String[] args) { long startTime = System.nanoTime(); int n=in.nextInt(); Long M=0L; Long N=0L; if(n%2==0 && n>2) { n/=2; M=(long)n; N=1L; ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output
PASSED
9edc1850b400444292d96ba1fe80512d
train_001.jsonl
1471698300
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples.For example, triples...
256 megabytes
import java.util.*; import java.io.*; public class Main{ /* . . . . . . . some constants . */ /* . . . if any . . */ public static void main(String[] args) throws IOException{ /* . . . . . . */ long n=nl(); long m,k; if(n%2==1){ k=(n*n+1)/2; ...
Java
["3", "6", "1", "17", "67"]
1 second
["4 5", "8 10", "-1", "144 145", "2244 2245"]
NoteIllustration for the first sample.
Java 8
standard input
[ "number theory", "math" ]
df92643983d6866cfe406f2b36bec17f
The only line of the input contains single integer n (1 ≀ n ≀ 109)Β β€” the length of some side of a right triangle.
1,500
Print two integers m and k (1 ≀ m, k ≀ 1018), such that n, m and k form a Pythagorean triple, in the only line. In case if there is no any Pythagorean triple containing integer n, print  - 1 in the only line. If there are many answers, print any of them.
standard output