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
07d10643c7c1176ef4d6c1e27a8a6d97
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { private static final long INF = 1234567890987654321L; public static void solve(FastIO io) { int N = io.nextInt(); int K = (N + 1) >> 1; long[] A = new long[N + 2]; for (int i = 1; i <= N; ++i) { A[i] = io.nextLong(); } ...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≀ n ≀ 5000)β€”the number of the hills in the sequence. Second line contains n integers ai (1 ≀ ai ≀ 100 000)β€”the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
f449d08ea0d2e1d468552432a10c8966
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { private static final long INF = 1234567890987654321L; public static void solve(FastIO io) { int N = io.nextInt(); int K = (N + 1) >> 1; long[] A = new long[N + 2]; for (int i = 1; i <= N; ++i) { A[i] = io.nextLong(); } ...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≀ n ≀ 5000)β€”the number of the hills in the sequence. Second line contains n integers ai (1 ≀ ai ≀ 100 000)β€”the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
1c75d3b9492a4dde7811fa2091c3e29d
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; public class C { static final int INF = Integer.MAX_VALUE / 3; int[] fast(int[] a) { int n = a.length; int[][] dp = new int[3][2]; for (int[] row : dp) { Arrays.fill(row, INF); } // 0 - last, 1 - prelast, 2 - far ...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≀ n ≀ 5000)β€”the number of the hills in the sequence. Second line contains n integers ai (1 ≀ ai ≀ 100 000)β€”the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
dfbc7d39061bce45949e41c5cd28ef59
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * @author khokharnikunj8 */ public class Main { public static void main(...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≀ n ≀ 5000)β€”the number of the hills in the sequence. Second line contains n integers ai (1 ≀ ai ≀ 100 000)β€”the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
b748562e15512b77e391d849d3ada3f4
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solveaproblem { private static int MAX = Integer.MAX_VALUE; public static void main(String[] args) throws IOException { BufferedReader ...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≀ n ≀ 5000)β€”the number of the hills in the sequence. Second line contains n integers ai (1 ≀ ai ≀ 100 000)β€”the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
f70616b37988d1c5bb2fdd2044b8e2f0
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod=1000000007; long gcd(long a,long b) { return a==0?b:gcd(b%a,a);...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≀ n ≀ 5000)β€”the number of the hills in the sequence. Second line contains n integers ai (1 ≀ ai ≀ 100 000)β€”the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
23a381c995af8b6fb37f5d6b77fe1507
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod=1000000007; long gcd(long a,long b) { return a==0?b:gcd(b%a,a);...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≀ n ≀ 5000)β€”the number of the hills in the sequence. Second line contains n integers ai (1 ≀ ai ≀ 100 000)β€”the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
c724444b598dd8609803ada886d12bf5
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.*; public class Solution { public static void main(String args[] ) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char s[] = {'a' , 'a' , 'b' , 'b'}; for(int i = 0; i < n ; i++) System.out.print(s[i%4]); } }
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
dc4aec5fed9aa298a40c58a165d04dd1
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); if (n >= 4) { int count = n / 4; for (int i = 0; i < count; i++) { System.out.print("aabb"...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
723b18eca87aeb403a5fffe0cf31f93d
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
//package HackerEarthA; import java.io.*; import java.util.*; import java.util.Map.Entry; import java.text.*; import java.math.*; import java.util.regex.*; /** * * @author prabhat */ public class easy18{ public static long[] BIT; public static long[] tree; public static long[] sum; public sta...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
4deb998dab3b2aee9bc424b315813219
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int count=0; for(int i=0;i<n;i++) System.out.print((i&2)==0?"b":"a"); } }
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
27e0913f8360219e1cfb293f3d5f9f99
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class start { static int x[]; public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedRead...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
409f10dc92c6c8a8c93b02171b2ac237
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.io.*; public class $805B { public static void main(String args[])throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); StringBuilder sb = new StringBuilder(""); int k = n/4; char[] a = {'a', 'a', 'b'}; int x = 2*...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
25e68d5a8a1ffe4b0a61f44ddd53be59
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.Scanner; public class main{ public static void main(String [] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); sc.close(); String s[]={"a","a","b","b"}; for(int i=0; i<n; i++) System.out.print(s[i%4]); } }
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
986bd489361c10157f5dff7e0fe5f6ea
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.Scanner; public class main{ public static void main(String [] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String s="aabb"; for(int i=0; i<n; i++) System.out.print(s.charAt(i%4)); } }
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
a8773d7c6ab54f72a2ce96482de36a5e
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.Scanner; /** * Created by rene on 29/09/17. */ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int length = scanner.nextInt(); int count = 1; for(int i = 1; i <= length; i++) { if(count % 4 == 0...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
4596671b84bfe2fff6c7ba5bdff52756
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.Scanner; /** * Created by rene on 29/09/17. */ // http://codeforces.com/problemset/problem/805/B // https://www.codepit.io/#/problems/590c1627d876872abd96cc62/view?index=3 public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int ...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
afba3479cb2e3027e5840f96dd2d2fa3
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class GFGss { static int mod1 = (int) (1e9 + 7); static class Reader { final private int BUFFER_SIZE = 1 << 16; Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); private DataInp...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
ae7ac472bb41f8730ff598fdddf2fd4c
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.*; import java.io.*; public class ProbB implements Runnable{ private static InputStream stream; private static byte[] buf = new byte[1024]; private static int curChar; private static int numChars; private static SpaceCharFilter filter; private static PrintWriter pw; private static void soln...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
d342522a4990d591bd1ec81a735f8d7b
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.Scanner; public class MyClass { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int i,j=0,k=0,l,m,n,f=0; n=sc.nextInt(); for(i=0;i<n;i++) { if(i%4==0) { System.out.print("a"); } else if...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
aa35d2f49f1cf8668e08c5c7efab82eb
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.*; import java.io.*; public class palindrome { public static void main(String[] args) { Scanner dank = new Scanner(System.in); int x = dank.nextInt(); char[] a = new char[x]; for(int i= 0; i<a.length; i=i+4) { a[i]='a'; } for(int i= 1; i<a.length...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
d1ea53dad4a80d8427fc79d00dae55bf
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import static java.lang.System.*; public class A{ public static void main(String[] args) throws Exception { Scanner sc=new Scanner(in); int n=sc.nextInt(); int c=0; //out.println(n); int flag=0; int i=0; char arr[]={'a','a','b','b'}; String ans=""; String sss="a...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
866927661d280c4a8d88b156e5ea789b
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.Scanner; /** * Created by admin on 04/05/2017. */ public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); String toPrint = "aabb"; int n = in.nextInt(); int times = n / 4; int left = n % 4; StringBuild...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
5622ffc5221c6b3dc11798f7e024ecd4
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.*; public class helloWorld { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String str = "aabb"; StringBuilder ans = new StringBuilder(); for(int i = 1; i <= n/4; i++) ans.append(str); ans.append( str.substring(0, n%4) ); ...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
a8787b1a53cef13bb6c5eb774579a788
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.Scanner; public class practcas { public static void main(String[] args) { Scanner ingreso = new Scanner (System.in); int n = ingreso.nextInt(); int cont=0; for (int i = 0; i <=n;) { System.out.print("a"); cont++; if(cont==n) ...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
f94b184027956f987de2a11785c92311
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.Scanner; public class practcas { public static void main(String[] args) { Scanner ingreso = new Scanner (System.in); int n = ingreso.nextInt(); int cont=0; for (int i = 0; i <=n;) { System.out.print("a"); cont++; if(cont==n) ...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
c2d53f4de8a9442389b660291be16e6c
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
58346aa1efecbeda7dffb35fb6352330
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; /** * Created by Augustinas on 20 09 2016! */ public class Solver { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); Task task = new Task(); task.setScanner(scanner); task.solve(); } ...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
ccfcb85088484a1ca3ea8ffee3823421
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Qu1{ static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader() { reader = new BufferedReader(new InputStreamReader(System.in)); tokenizer = null; } public String next() ...
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
c5c8faeed22fccdd137841ec3ca553d3
train_000.jsonl
1493909400
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substrin...
256 megabytes
import java.util.*; import java.lang.String; public class P { public static void main(String args[])throws Exception { Scanner sc=new Scanner(System.in); int n = sc.nextInt(); String s="aabb"; String str=String.join("", Collections.nCopies(n, s)).substring(0,n); System.out.print(str); } }
Java
["2", "3"]
1 second
["aa", "bba"]
NoteA palindrome is a sequence of characters which reads the same backward and forward.
Java 8
standard input
[ "constructive algorithms" ]
fbde86a29f416b3d83bcc63fb3776776
The first line contains single integer n (1 ≀ n ≀ 2Β·105)Β β€” the length of the string.
1,000
Print the string that satisfies all the constraints. If there are multiple answers, print any of them.
standard output
PASSED
4e440082eb5c903643ff9a36aa31a73e
train_000.jsonl
1336145400
Imagine the Cartesian coordinate system. There are k different points containing subway stations. One can get from any subway station to any one instantly. That is, the duration of the transfer between any two subway stations can be considered equal to zero. You are allowed to travel only between subway stations, that ...
256 megabytes
import static java.lang.Math.abs; import static java.lang.Math.max; import static java.lang.Math.min; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import static java.util.Arrays.sort; import java.io.*; import java.util.*; public class Subway { private static void solve() thro...
Java
["1 0\n2 -2", "2 2\n5 -3\n-4 -5\n-4 0\n-3 -2"]
6 seconds
["0", "6"]
null
Java 6
standard input
[ "data structures", "binary search" ]
90fd8635d89e248fa874245a45c1baaa
The first line contains two integers n and k (1 ≀ n ≀ 105;Β 0 ≀ k ≀ 105) β€” the number of dwarves and the number of subway stations, correspondingly. The next n lines contain the coordinates of the dwarves. The i-th line contains two space-separated integers xi and yi (|xi|, |yi| ≀ 108) β€” the coordinates of the i-th dwar...
3,000
Print a single number β€” the minimum time, in which all dwarves can gather together at one point to watch the soap.
standard output
PASSED
19e05551a1b0955283f76af3b1582968
train_000.jsonl
1424190900
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
256 megabytes
//package pkg515b; import java.util.*; public class Main { static int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } public static void main(String[] args) { Main obj=new Main(); Scanner sc=new Scanner(System.in); int n=sc.nextInt()...
Java
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
2 seconds
["Yes", "No", "Yes"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
Java 11
standard input
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
65efbc0a1ad82436100eea7a2378d4c2
The first line contains two integer n and m (1 ≀ n, m ≀ 100). The second line contains integer b (0 ≀ b ≀ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≀ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≀...
1,300
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
standard output
PASSED
5dd753c41d5019ca68efa49bb28c12bc
train_000.jsonl
1424190900
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
256 megabytes
import java.util.*; public class Solution { static int gcd(int a, int b) { if (a == 0) return b; if (b == 0) return a; if (a == b) return a; if (a > b) return gcd(a - b, b); return gcd(a, b - a); } public static void...
Java
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
2 seconds
["Yes", "No", "Yes"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
Java 11
standard input
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
65efbc0a1ad82436100eea7a2378d4c2
The first line contains two integer n and m (1 ≀ n, m ≀ 100). The second line contains integer b (0 ≀ b ≀ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≀ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≀...
1,300
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
standard output
PASSED
7efcdd1895916a6411e58080892b05cd
train_000.jsonl
1424190900
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf515b { static BufferedReader __in; static PrintWriter __out; static StringTokenizer input; public static void main(String[] args) throws IOException { __in = new BufferedRead...
Java
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
2 seconds
["Yes", "No", "Yes"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
Java 11
standard input
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
65efbc0a1ad82436100eea7a2378d4c2
The first line contains two integer n and m (1 ≀ n, m ≀ 100). The second line contains integer b (0 ≀ b ≀ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≀ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≀...
1,300
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
standard output
PASSED
8156060c36575a67fcceb1710672d374
train_000.jsonl
1424190900
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
256 megabytes
import java.io.*; import java.util.*; public class Main { private void solve()throws IOException { int n=nextInt(); int m=nextInt(); int b=nextInt(); boolean happyboys[]=new boolean[n]; while(b-->0) happyboys[nextInt()]=true; boolean happygirls[]=new boolean[m]; int g=nextInt(); while(g-->0) h...
Java
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
2 seconds
["Yes", "No", "Yes"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
Java 11
standard input
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
65efbc0a1ad82436100eea7a2378d4c2
The first line contains two integer n and m (1 ≀ n, m ≀ 100). The second line contains integer b (0 ≀ b ≀ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≀ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≀...
1,300
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
standard output
PASSED
b7be42edf605a9b82cc19654e9d8bdc5
train_000.jsonl
1424190900
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class MeetInTheMiddle_515B { public static void main(String[] args) throws IOException { new MeetInTheMiddle_515B().run(); } private void run() throws...
Java
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
2 seconds
["Yes", "No", "Yes"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
Java 11
standard input
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
65efbc0a1ad82436100eea7a2378d4c2
The first line contains two integer n and m (1 ≀ n, m ≀ 100). The second line contains integer b (0 ≀ b ≀ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≀ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≀...
1,300
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
standard output
PASSED
f4ad21e0ddb660ded91db82c36871f74
train_000.jsonl
1424190900
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
256 megabytes
import java.util.Scanner; public class D630 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); boolean boys[] = new boolean[n]; boolean girls[] = new boolean[m]; int b =in.nextInt(); for ...
Java
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
2 seconds
["Yes", "No", "Yes"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
Java 11
standard input
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
65efbc0a1ad82436100eea7a2378d4c2
The first line contains two integer n and m (1 ≀ n, m ≀ 100). The second line contains integer b (0 ≀ b ≀ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≀ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≀...
1,300
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
standard output
PASSED
a05c2537007d5000ef8500de3029363e
train_000.jsonl
1424190900
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
256 megabytes
import java.io.*; import java.util.*; public class DrazilAndHisFriends { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String ne...
Java
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
2 seconds
["Yes", "No", "Yes"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
Java 11
standard input
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
65efbc0a1ad82436100eea7a2378d4c2
The first line contains two integer n and m (1 ≀ n, m ≀ 100). The second line contains integer b (0 ≀ b ≀ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≀ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≀...
1,300
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
standard output
PASSED
7190363a450f5b3fb6e6ef58c64fa273
train_000.jsonl
1424190900
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
256 megabytes
// #pragma GCC optimize("Ofast") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main { static int infi = Integer.MAX_VALUE / 2, mod = (int) (1e9 + 7), maxn = (int) 1e5; static long infl = Long...
Java
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
2 seconds
["Yes", "No", "Yes"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
Java 11
standard input
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
65efbc0a1ad82436100eea7a2378d4c2
The first line contains two integer n and m (1 ≀ n, m ≀ 100). The second line contains integer b (0 ≀ b ≀ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≀ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≀...
1,300
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
standard output
PASSED
fff01426234419a824b60803971ca435
train_000.jsonl
1424190900
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 to m - 1 separately. In i-th day, Drazil invites -th boy and -th girl...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class practice { // Faster Input... static class Reader{ final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader()...
Java
["2 3\n0\n1 0", "2 4\n1 0\n1 2", "2 3\n1 0\n1 1"]
2 seconds
["Yes", "No", "Yes"]
NoteBy we define the remainder of integer division of i by k.In first sample case: On the 0-th day, Drazil invites 0-th boy and 0-th girl. Because 0-th girl is happy at the beginning, 0-th boy become happy at this day. On the 1-st day, Drazil invites 1-st boy and 1-st girl. They are both unhappy, so nothing changes...
Java 11
standard input
[ "dsu", "meet-in-the-middle", "number theory", "brute force" ]
65efbc0a1ad82436100eea7a2378d4c2
The first line contains two integer n and m (1 ≀ n, m ≀ 100). The second line contains integer b (0 ≀ b ≀ n), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, x2, ..., xb (0 ≀ xi &lt; n), denoting the list of indices of happy boys. The third line conatins integer g (0 ≀...
1,300
If Drazil can make all his friends become happy by this plan, print "Yes". Otherwise, print "No".
standard output
PASSED
eaa5b95eb377dacfedf3b3576c054ff5
train_000.jsonl
1539880500
There are $$$n$$$ children numbered from $$$1$$$ to $$$n$$$ in a kindergarten. Kindergarten teacher gave $$$a_i$$$ ($$$1 \leq a_i \leq n$$$) candies to the $$$i$$$-th child. Children were seated in a row in order from $$$1$$$ to $$$n$$$ from left to right and started eating candies. While the $$$i$$$-th child was eatin...
256 megabytes
import java.util.*; import java.io.*; public class C { public static void main(String args[]) throws Exception { BufferedReader infile = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(infile.readLine()); int N = Integer.par...
Java
["5\n0 0 1 1 2\n2 0 1 0 0", "4\n0 0 2 0\n1 1 1 1", "3\n0 0 0\n0 0 0"]
1 second
["YES\n1 3 1 2 1", "NO", "YES\n1 1 1"]
NoteIn the first example, if the teacher distributed $$$1$$$, $$$3$$$, $$$1$$$, $$$2$$$, $$$1$$$ candies to $$$1$$$-st, $$$2$$$-nd, $$$3$$$-rd, $$$4$$$-th, $$$5$$$-th child, respectively, then all the values calculated by the children are correct. For example, the $$$5$$$-th child was given $$$1$$$ candy, to the left o...
Java 11
standard input
[ "constructive algorithms", "implementation" ]
fa531c38833907d619f1102505ddbb6a
On the first line there is a single integer $$$n$$$ ($$$1 \leq n \leq 1000$$$)Β β€” the number of children in the kindergarten. On the next line there are $$$n$$$ integers $$$l_1, l_2, \ldots, l_n$$$ ($$$0 \leq l_i \leq n$$$), separated by spaces. On the next line, there are $$$n$$$ integer numbers $$$r_1, r_2, \ldots, r_...
1,500
If there is no way to distribute the candies to the children so that all of them calculated their numbers correctly, print Β«NOΒ» (without quotes). Otherwise, print Β«YESΒ» (without quotes) on the first line. On the next line, print $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$, separated by spacesΒ β€” the numbers of candies ...
standard output
PASSED
5357caaa825ac24347f5053aff4ea55e
train_000.jsonl
1464798900
Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.Vanya has...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.*; //Arrays.stream(br.readLine().split("\\s")).mapToInt(Integer::parseInt).toArray(); public class solution{ static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pw = new PrintWriter(System.out); ...
Java
["5 6 3\n5 4 3 2 1", "5 6 3\n5 5 5 5 5", "5 6 3\n1 2 1 1 1"]
1 second
["5", "10", "2"]
NoteConsider the first sample. First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside. Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining. Vanya puts the piece of height 3...
Java 11
standard input
[ "implementation", "math" ]
5099a9ae62e82441c496ac37d92e99e3
The first line of the input contains integers n, h and k (1 ≀ n ≀ 100 000, 1 ≀ k ≀ h ≀ 109)Β β€” the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively. The second line contains n integers ai (1 ≀ ai ≀ h)Β β€” the heights of the pieces.
1,400
Print a single integerΒ β€” the number of seconds required to smash all the potatoes following the process described in the problem statement.
standard output
PASSED
b64e7f7ec2828f84405552fad638881a
train_000.jsonl
1464798900
Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.Vanya has...
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 Kraken */ public class Main { public static void main(String[] args) { InputStream inputSt...
Java
["5 6 3\n5 4 3 2 1", "5 6 3\n5 5 5 5 5", "5 6 3\n1 2 1 1 1"]
1 second
["5", "10", "2"]
NoteConsider the first sample. First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside. Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining. Vanya puts the piece of height 3...
Java 11
standard input
[ "implementation", "math" ]
5099a9ae62e82441c496ac37d92e99e3
The first line of the input contains integers n, h and k (1 ≀ n ≀ 100 000, 1 ≀ k ≀ h ≀ 109)Β β€” the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively. The second line contains n integers ai (1 ≀ ai ≀ h)Β β€” the heights of the pieces.
1,400
Print a single integerΒ β€” the number of seconds required to smash all the potatoes following the process described in the problem statement.
standard output
PASSED
570ee17e31871f3ecd4ac79bcb52c162
train_000.jsonl
1464798900
Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.Vanya has...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { Reader in = new Reader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); int n = in.nextInt(); ...
Java
["5 6 3\n5 4 3 2 1", "5 6 3\n5 5 5 5 5", "5 6 3\n1 2 1 1 1"]
1 second
["5", "10", "2"]
NoteConsider the first sample. First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside. Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining. Vanya puts the piece of height 3...
Java 11
standard input
[ "implementation", "math" ]
5099a9ae62e82441c496ac37d92e99e3
The first line of the input contains integers n, h and k (1 ≀ n ≀ 100 000, 1 ≀ k ≀ h ≀ 109)Β β€” the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively. The second line contains n integers ai (1 ≀ ai ≀ h)Β β€” the heights of the pieces.
1,400
Print a single integerΒ β€” the number of seconds required to smash all the potatoes following the process described in the problem statement.
standard output
PASSED
bf027fa3dab58f80720bb9b22f760d5b
train_000.jsonl
1464798900
Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.Vanya has...
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.StringTokenizer; public class VanyaAndFood { public static void main(String[] args) throws IOException { Scanner sc = ne...
Java
["5 6 3\n5 4 3 2 1", "5 6 3\n5 5 5 5 5", "5 6 3\n1 2 1 1 1"]
1 second
["5", "10", "2"]
NoteConsider the first sample. First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside. Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining. Vanya puts the piece of height 3...
Java 11
standard input
[ "implementation", "math" ]
5099a9ae62e82441c496ac37d92e99e3
The first line of the input contains integers n, h and k (1 ≀ n ≀ 100 000, 1 ≀ k ≀ h ≀ 109)Β β€” the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively. The second line contains n integers ai (1 ≀ ai ≀ h)Β β€” the heights of the pieces.
1,400
Print a single integerΒ β€” the number of seconds required to smash all the potatoes following the process described in the problem statement.
standard output
PASSED
d38f47cec5f7168e1388e5ce13a3e87d
train_000.jsonl
1464798900
Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.Vanya has...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; public class xl3ster { static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter out = new PrintWriter(System.out); public s...
Java
["5 6 3\n5 4 3 2 1", "5 6 3\n5 5 5 5 5", "5 6 3\n1 2 1 1 1"]
1 second
["5", "10", "2"]
NoteConsider the first sample. First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside. Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining. Vanya puts the piece of height 3...
Java 11
standard input
[ "implementation", "math" ]
5099a9ae62e82441c496ac37d92e99e3
The first line of the input contains integers n, h and k (1 ≀ n ≀ 100 000, 1 ≀ k ≀ h ≀ 109)Β β€” the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively. The second line contains n integers ai (1 ≀ ai ≀ h)Β β€” the heights of the pieces.
1,400
Print a single integerΒ β€” the number of seconds required to smash all the potatoes following the process described in the problem statement.
standard output
PASSED
1b22278c7d3f926200342ce2d8627232
train_000.jsonl
1464798900
Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.Vanya has...
256 megabytes
/** * @author egaeus * @mail sebegaeusprogram@gmail.com * @veredict Not sended * @url <https://codeforces.com/problemset/problem/677/B> * @category ? * @date 14/06/2020 **/ import java.io.*; import java.util.*; import static java.lang.Integer.*; import static java.lang.Math.*; public class CF677B { publi...
Java
["5 6 3\n5 4 3 2 1", "5 6 3\n5 5 5 5 5", "5 6 3\n1 2 1 1 1"]
1 second
["5", "10", "2"]
NoteConsider the first sample. First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside. Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining. Vanya puts the piece of height 3...
Java 11
standard input
[ "implementation", "math" ]
5099a9ae62e82441c496ac37d92e99e3
The first line of the input contains integers n, h and k (1 ≀ n ≀ 100 000, 1 ≀ k ≀ h ≀ 109)Β β€” the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively. The second line contains n integers ai (1 ≀ ai ≀ h)Β β€” the heights of the pieces.
1,400
Print a single integerΒ β€” the number of seconds required to smash all the potatoes following the process described in the problem statement.
standard output
PASSED
e78ce85ed3f087e20c53522cc2704486
train_000.jsonl
1464798900
Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.Vanya has...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class solution { public static void merge(int arr[], int l, int m, int r) { // Find sizes of two subarrays to be merged int n1 = m - l + 1; int n2 = r - m; /* Create temp arrays */ int L[] = new int[n1]; ...
Java
["5 6 3\n5 4 3 2 1", "5 6 3\n5 5 5 5 5", "5 6 3\n1 2 1 1 1"]
1 second
["5", "10", "2"]
NoteConsider the first sample. First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside. Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining. Vanya puts the piece of height 3...
Java 11
standard input
[ "implementation", "math" ]
5099a9ae62e82441c496ac37d92e99e3
The first line of the input contains integers n, h and k (1 ≀ n ≀ 100 000, 1 ≀ k ≀ h ≀ 109)Β β€” the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively. The second line contains n integers ai (1 ≀ ai ≀ h)Β β€” the heights of the pieces.
1,400
Print a single integerΒ β€” the number of seconds required to smash all the potatoes following the process described in the problem statement.
standard output
PASSED
031955aaab673ecf5b129f4fff3f6f36
train_000.jsonl
1464798900
Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.Vanya has...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class A{ static FastReader scan=new FastReader(); public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out)); static int n; static char orig[][]; static int check(char arr[][]){ int c=0; ...
Java
["5 6 3\n5 4 3 2 1", "5 6 3\n5 5 5 5 5", "5 6 3\n1 2 1 1 1"]
1 second
["5", "10", "2"]
NoteConsider the first sample. First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside. Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining. Vanya puts the piece of height 3...
Java 11
standard input
[ "implementation", "math" ]
5099a9ae62e82441c496ac37d92e99e3
The first line of the input contains integers n, h and k (1 ≀ n ≀ 100 000, 1 ≀ k ≀ h ≀ 109)Β β€” the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively. The second line contains n integers ai (1 ≀ ai ≀ h)Β β€” the heights of the pieces.
1,400
Print a single integerΒ β€” the number of seconds required to smash all the potatoes following the process described in the problem statement.
standard output
PASSED
36f027b99c498c1fc57a86ae882024dd
train_000.jsonl
1464798900
Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.Vanya has...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Main{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) ...
Java
["5 6 3\n5 4 3 2 1", "5 6 3\n5 5 5 5 5", "5 6 3\n1 2 1 1 1"]
1 second
["5", "10", "2"]
NoteConsider the first sample. First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside. Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining. Vanya puts the piece of height 3...
Java 11
standard input
[ "implementation", "math" ]
5099a9ae62e82441c496ac37d92e99e3
The first line of the input contains integers n, h and k (1 ≀ n ≀ 100 000, 1 ≀ k ≀ h ≀ 109)Β β€” the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively. The second line contains n integers ai (1 ≀ ai ≀ h)Β β€” the heights of the pieces.
1,400
Print a single integerΒ β€” the number of seconds required to smash all the potatoes following the process described in the problem statement.
standard output
PASSED
c835886e3dd0731bd21a925a967bd4f1
train_000.jsonl
1464798900
Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.Vanya has...
256 megabytes
import java.util.Scanner; public class Test { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); // 5 int h = sc.nextInt(); // 6 int k = sc.nextInt(); // 3 int a[] = new int[n]; for(int i = 0;i < n;i++) { a[i] = ...
Java
["5 6 3\n5 4 3 2 1", "5 6 3\n5 5 5 5 5", "5 6 3\n1 2 1 1 1"]
1 second
["5", "10", "2"]
NoteConsider the first sample. First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside. Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining. Vanya puts the piece of height 3...
Java 11
standard input
[ "implementation", "math" ]
5099a9ae62e82441c496ac37d92e99e3
The first line of the input contains integers n, h and k (1 ≀ n ≀ 100 000, 1 ≀ k ≀ h ≀ 109)Β β€” the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively. The second line contains n integers ai (1 ≀ ai ≀ h)Β β€” the heights of the pieces.
1,400
Print a single integerΒ β€” the number of seconds required to smash all the potatoes following the process described in the problem statement.
standard output
PASSED
0607e9a3b03707acbd5994620b5d1966
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int numeros[...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
bde1442a7812ce7b6f02d30abfd6eb5e
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int arr[]=new int [n+1]; int buf[]=new int[5005]; boolean flag=false; for(int i=1;i<=n;i++){ arr[i]=sc.nextInt(); if(b...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
a4370665e173b561baeffeca0b3edf74
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static FastScanner in; static PrintWriter out; public static void main(String[] args){ in = new FastScanner(System.in); out = new PrintWriter(System.out); int T = in.nextInt(); for (int t = 0; t < T; ++t){ int n = in.nextInt(); int[] ...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
0bba50781aa79893347e0b371961e8a8
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
3298d2ce159c5d4aec53a3b37f4c070e
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; /** * Use pen and paper. Solve on paper then code. * If there is some reasoning e.g. sequence/paths, try printing first 100 elements or 100...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
b4272fa2b0dc67ca068e2f0e065338e8
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++){ int n=sc.nextInt(); int a[]=new int[n]; for(int j=0;j<n;j++) a[j]=sc.nextInt(); ...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
fb571e22d55294450f6e35f757ceeffc
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class G_YetAnotherPalindrome { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
ae701041d860f96d9735be80892b9069
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class yetAnotherPalindromeProblem { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = ...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
ecadd35107d4e96ba352c85ac60d8ba2
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static FastReader sc=new FastReader(); public static void main(String[] args) { //StringBuffer sb=new StringBuffer(""); int t = i(); outer :while (t-- > 0) { int n=i(); in...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
1904173bf05406e0aabc1ac3efc74e32
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; import java.math.*; public class PalindromProblem { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int runs = sc.nextInt(); while(runs-->0) { int n = sc.nextInt(); int[] arr = new int[n]; for(int i = 0;i<n;i++) { arr[i] = sc.nextInt(...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
515ac2e80e700642ee8c7a69fe285bb0
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; public class cppalin { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t = 0; t < T; t++) { int n = in.nextInt(); int a[] = new int[n]; for (int i = 0; i < n; i++) { ...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
e6993895480870879d6cf0cc458b9413
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; public class YAPP { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); int[] a = new int[n]; boolean b = false; for(int i=0;i<n;i++) a[i] = sc.nextInt();...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
289be99202abb593064ea20b45b889b9
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; import java.util.stream.IntStream; public class YetAnotherPalindromeProblem { public static void main(String [] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextIn...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
9f7a35d1b78b38221942a6bf2b50c87f
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; public class Palindromesubssoln { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < arr.length; i++) { ar...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
ddf00a011dcccc20bfe42003264ed34c
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class graph1 { public static int fun(int [] seq) { int n = seq.length; int i, j, cl; int L[][] = new int[n][n]; for (i = 0; i < n; i++) L[i][i] = 1; for (cl=2; cl<=n; c...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
0268f7cd4a087d303372ac540e77935a
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class graph1 { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0) { int n=s.nextInt(); int []a=new int[n]; for (int i = 0; i < a.length; i++) a[i]=s.nextInt(); int f...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
84d2fcb2511db7e5472f086bb90ba5c9
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; public class Main{ public static void main(String ... string ){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0){ int n = sc.nextInt(); int a[] = new int[n] ; for(int i = 0; i<n ;i++) ...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
052b5da9db694b38ed0d35eb33b81c9e
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Integer t = Integer.parseInt(sc.nextLine()); int elements[] = new int[5002]; for (int i = 0; i < t; i++) { boolean found = false; Integ...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
73f20734e3865442bfb7ea857a21722c
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Integer t = Integer.parseInt(sc.nextLine()); int elements[] = new int[5002]; for (int i = 0; i < t; i++) { boolean found = false; Integ...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
b7524cf3f2b50514520b05b655287eb3
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } public int[] nextIntArray(int n...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
001c8d61e3c07e4ef903710399a47e70
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.io.*; import java.util.*; public class main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw= new PrintWriter(System.out); int t = Integer.parseInt(br.readLine()); for (in...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
319d56ac12525a46f8bf385e2408aede
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
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(); Map<Integer, Integer> map = new HashMap<Integer, Integer>(); bo...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
e34afd9fa9104552326c73db746ea2e1
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; import java.io.*; public class Main{ public static void main (String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWr...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
2bafefee70ddbed93c5d8ac32171cda2
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; import java.io.*; public class Main{ public static void main (String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWr...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
8f8c010d3c58736703795ba8c42e8ba4
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; import java.io.*; public class yetAnotherPalindromeProblem { static FS sc = new FS(); static PrintWriter pw = new PrintWriter(System.out); static int n; static int[] arr; public static void main(String[] args) { int t = sc.nextInt(); scan : for(int tt = 1; tt <= t; ++tt) { n = sc.nextI...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
b2e1db4d97e7d723133c1a28770c6c45
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; import java.io.*; public class yetAnotherPalindromeProblem { static FS sc = new FS(); static PrintWriter pw = new PrintWriter(System.out); static int n; static int[] arr; public static void main(String[] args) { int t = sc.nextInt(); scan : for(int tt = 1; tt <= t; ++tt) { n = sc.nextI...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
60328f0ef4654327f3674e48a54495b2
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; public class main { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int nn=Integer.parseInt(sc.nextLine()); while(nn-->0) { // hash=new Hashtable<>(); int a=Integer.parseInt(sc.nextLine()); String hh[]=sc.nextLine().split(" "); Hashtab...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
57e7a94baa2a16adcbf3090e4000dda5
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.*; public class susbus{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int j=0;j<t;j++){ int n = sc.nextInt(); int [] vals = new int[n]; int [] first= new int[n]; int [] last = new int[n]; ...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
5924c8650eb61c2b8eb08321463b44b3
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class Main { public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while(t-->0) { ...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
233d96c45d98097d84d3fd46c5d316ef
train_000.jsonl
1584018300
You are given an array $$$a$$$ consisting of $$$n$$$ integers.Your task is to determine if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome.Recall that an array $$$b$$$ is called a subsequence of the array $$$a$$$ if $$$b$$$ can be obtained by removing some (possibly, zero) elements from $$$...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i = 0; i < t ; i++) { int n = sc.nextInt(); ArrayList<Integer> list = new ArrayList<Integer>(); for(int j=0 ; j<n ; j++...
Java
["5\n3\n1 2 1\n5\n1 2 2 3 2\n3\n1 1 2\n4\n1 2 2 1\n10\n1 1 2 2 3 3 4 4 5 5"]
2 seconds
["YES\nYES\nNO\nYES\nNO"]
NoteIn the first test case of the example, the array $$$a$$$ has a subsequence $$$[1, 2, 1]$$$ which is a palindrome.In the second test case of the example, the array $$$a$$$ has two subsequences of length $$$3$$$ which are palindromes: $$$[2, 3, 2]$$$ and $$$[2, 2, 2]$$$.In the third test case of the example, the arra...
Java 8
standard input
[ "brute force", "strings" ]
5139d222fbbfa70d50e990f5d6c92726
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$3 \le n \le 5000$$$) β€” the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers ...
1,100
For each test case, print the answer β€” "YES" (without quotes) if $$$a$$$ has some subsequence of length at least $$$3$$$ that is a palindrome and "NO" otherwise.
standard output
PASSED
06b9e13698ac70a65216d86916476989
train_000.jsonl
1596119700
Captain Flint and his crew keep heading to a savage shore of Byteland for several months already, drinking rum and telling stories. In such moments uncle Bogdan often remembers his nephew Denis. Today, he has told a story about how Denis helped him to come up with an interesting problem and asked the crew to solve it.I...
256 megabytes
import java.util.Scanner; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int a = 0; a < t; a++) { int n = sc.nextInt(); int numOf9 = n - (((n - 1) / 4) + 1); char [] arr = new char[n]; for (int i = 0; i < n; i++) { arr...
Java
["2\n1\n3"]
2 seconds
["8\n998"]
NoteIn the second test case (with $$$n = 3$$$), if uncle Bogdan had $$$x = 998$$$ then $$$k = 100110011000$$$. Denis (by wiping last $$$n = 3$$$ digits) will obtain $$$r = 100110011$$$.It can be proved that the $$$100110011$$$ is the maximum possible $$$r$$$ Denis can obtain and $$$998$$$ is the minimum $$$x$$$ to obta...
Java 8
standard input
[ "greedy", "math" ]
80c75a4c163c6b63a614075e094ad489
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain test casesΒ β€” one per test case. The one and only line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” the length of the integer $$$x$$$ you need to find. It's...
1,000
For each test case, print the minimum integer $$$x$$$ of length $$$n$$$ such that obtained by Denis number $$$r$$$ is maximum possible.
standard output
PASSED
e01acfa2cf6825c4e8df2372b79aab8e
train_000.jsonl
1596119700
Captain Flint and his crew keep heading to a savage shore of Byteland for several months already, drinking rum and telling stories. In such moments uncle Bogdan often remembers his nephew Denis. Today, he has told a story about how Denis helped him to come up with an interesting problem and asked the crew to solve it.I...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Solution { public static void main(String[] args) throws IOException { BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.par...
Java
["2\n1\n3"]
2 seconds
["8\n998"]
NoteIn the second test case (with $$$n = 3$$$), if uncle Bogdan had $$$x = 998$$$ then $$$k = 100110011000$$$. Denis (by wiping last $$$n = 3$$$ digits) will obtain $$$r = 100110011$$$.It can be proved that the $$$100110011$$$ is the maximum possible $$$r$$$ Denis can obtain and $$$998$$$ is the minimum $$$x$$$ to obta...
Java 8
standard input
[ "greedy", "math" ]
80c75a4c163c6b63a614075e094ad489
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain test casesΒ β€” one per test case. The one and only line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” the length of the integer $$$x$$$ you need to find. It's...
1,000
For each test case, print the minimum integer $$$x$$$ of length $$$n$$$ such that obtained by Denis number $$$r$$$ is maximum possible.
standard output
PASSED
4c81ef8dab44d5cd43c1b727c62ce985
train_000.jsonl
1596119700
Captain Flint and his crew keep heading to a savage shore of Byteland for several months already, drinking rum and telling stories. In such moments uncle Bogdan often remembers his nephew Denis. Today, he has told a story about how Denis helped him to come up with an interesting problem and asked the crew to solve it.I...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Solution { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for(int i = 0; i < t; i++) { int n = input.nextInt(); int a = 0; ...
Java
["2\n1\n3"]
2 seconds
["8\n998"]
NoteIn the second test case (with $$$n = 3$$$), if uncle Bogdan had $$$x = 998$$$ then $$$k = 100110011000$$$. Denis (by wiping last $$$n = 3$$$ digits) will obtain $$$r = 100110011$$$.It can be proved that the $$$100110011$$$ is the maximum possible $$$r$$$ Denis can obtain and $$$998$$$ is the minimum $$$x$$$ to obta...
Java 8
standard input
[ "greedy", "math" ]
80c75a4c163c6b63a614075e094ad489
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain test casesΒ β€” one per test case. The one and only line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” the length of the integer $$$x$$$ you need to find. It's...
1,000
For each test case, print the minimum integer $$$x$$$ of length $$$n$$$ such that obtained by Denis number $$$r$$$ is maximum possible.
standard output
PASSED
e2186359e7d7c6fc747a6e6890aaf678
train_000.jsonl
1596119700
Captain Flint and his crew keep heading to a savage shore of Byteland for several months already, drinking rum and telling stories. In such moments uncle Bogdan often remembers his nephew Denis. Today, he has told a story about how Denis helped him to come up with an interesting problem and asked the crew to solve it.I...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(System.in); int c = in.nextInt(); for (int cases = 0; cases < c; cases++) { int n = in.nextInt(); for (int i = 0; i < ...
Java
["2\n1\n3"]
2 seconds
["8\n998"]
NoteIn the second test case (with $$$n = 3$$$), if uncle Bogdan had $$$x = 998$$$ then $$$k = 100110011000$$$. Denis (by wiping last $$$n = 3$$$ digits) will obtain $$$r = 100110011$$$.It can be proved that the $$$100110011$$$ is the maximum possible $$$r$$$ Denis can obtain and $$$998$$$ is the minimum $$$x$$$ to obta...
Java 8
standard input
[ "greedy", "math" ]
80c75a4c163c6b63a614075e094ad489
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain test casesΒ β€” one per test case. The one and only line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” the length of the integer $$$x$$$ you need to find. It's...
1,000
For each test case, print the minimum integer $$$x$$$ of length $$$n$$$ such that obtained by Denis number $$$r$$$ is maximum possible.
standard output
PASSED
a402b3ed153f5e605adb9aee2ebbdf27
train_000.jsonl
1596119700
Captain Flint and his crew keep heading to a savage shore of Byteland for several months already, drinking rum and telling stories. In such moments uncle Bogdan often remembers his nephew Denis. Today, he has told a story about how Denis helped him to come up with an interesting problem and asked the crew to solve it.I...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(System.in); int c = in.nextInt(); for (int cases = 0; cases < c; cases++) { int n = in.nextInt(); for (int i = 0; i < ...
Java
["2\n1\n3"]
2 seconds
["8\n998"]
NoteIn the second test case (with $$$n = 3$$$), if uncle Bogdan had $$$x = 998$$$ then $$$k = 100110011000$$$. Denis (by wiping last $$$n = 3$$$ digits) will obtain $$$r = 100110011$$$.It can be proved that the $$$100110011$$$ is the maximum possible $$$r$$$ Denis can obtain and $$$998$$$ is the minimum $$$x$$$ to obta...
Java 8
standard input
[ "greedy", "math" ]
80c75a4c163c6b63a614075e094ad489
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain test casesΒ β€” one per test case. The one and only line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” the length of the integer $$$x$$$ you need to find. It's...
1,000
For each test case, print the minimum integer $$$x$$$ of length $$$n$$$ such that obtained by Denis number $$$r$$$ is maximum possible.
standard output
PASSED
55529bcbc2d0f93257a606fed254b9c1
train_000.jsonl
1596119700
Captain Flint and his crew keep heading to a savage shore of Byteland for several months already, drinking rum and telling stories. In such moments uncle Bogdan often remembers his nephew Denis. Today, he has told a story about how Denis helped him to come up with an interesting problem and asked the crew to solve it.I...
256 megabytes
import java.lang.*; import java.util.*; public class ct1 { static class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; left=null; right=null; } } static class ListNode { int val; ListNode next; ListNode(int ...
Java
["2\n1\n3"]
2 seconds
["8\n998"]
NoteIn the second test case (with $$$n = 3$$$), if uncle Bogdan had $$$x = 998$$$ then $$$k = 100110011000$$$. Denis (by wiping last $$$n = 3$$$ digits) will obtain $$$r = 100110011$$$.It can be proved that the $$$100110011$$$ is the maximum possible $$$r$$$ Denis can obtain and $$$998$$$ is the minimum $$$x$$$ to obta...
Java 8
standard input
[ "greedy", "math" ]
80c75a4c163c6b63a614075e094ad489
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain test casesΒ β€” one per test case. The one and only line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” the length of the integer $$$x$$$ you need to find. It's...
1,000
For each test case, print the minimum integer $$$x$$$ of length $$$n$$$ such that obtained by Denis number $$$r$$$ is maximum possible.
standard output
PASSED
f381239710ad1b1ab7825093e15fb727
train_000.jsonl
1596119700
Captain Flint and his crew keep heading to a savage shore of Byteland for several months already, drinking rum and telling stories. In such moments uncle Bogdan often remembers his nephew Denis. Today, he has told a story about how Denis helped him to come up with an interesting problem and asked the crew to solve it.I...
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
["2\n1\n3"]
2 seconds
["8\n998"]
NoteIn the second test case (with $$$n = 3$$$), if uncle Bogdan had $$$x = 998$$$ then $$$k = 100110011000$$$. Denis (by wiping last $$$n = 3$$$ digits) will obtain $$$r = 100110011$$$.It can be proved that the $$$100110011$$$ is the maximum possible $$$r$$$ Denis can obtain and $$$998$$$ is the minimum $$$x$$$ to obta...
Java 8
standard input
[ "greedy", "math" ]
80c75a4c163c6b63a614075e094ad489
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain test casesΒ β€” one per test case. The one and only line of each test case contains the single integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” the length of the integer $$$x$$$ you need to find. It's...
1,000
For each test case, print the minimum integer $$$x$$$ of length $$$n$$$ such that obtained by Denis number $$$r$$$ is maximum possible.
standard output
PASSED
2986b3d9ec2073bbf061c1688b6cdda0
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.ObjectInputStream.GetField; import java.math.BigInteger; import java.security.KeyStore.Entry; import java.util.ArrayList; import java.ut...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
b79652b5560d5cc5d119b62e3fb2b9fd
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.*; import java.util.*; public class DoubleName { public static final String taskname = "DoubleName"; public static BufferedReader inr; public static PrintWriter out; public static void main(String[] args) { Locale.setDefault(Locale.US); boolean online = System.getProperty("ONLINE_JUDGE") != n...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
31cd7a80fd583017929f743171901d0a
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class A { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String key = bf.readLine(); String word = bf.readLine(); ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
77e9902ca6533b3f227f5df585f5af6a
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; /** * * @author pter9_000 */ public class Ctask { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { // TODO co...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
3aca7ae9ad4280c66edd0c3309068e44
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.Scanner; public class TaskC { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String name = scanner.nextLine(); String text = scanner.nextLine(); // ΠΈΡ‰Π΅ΠΌ ΠΏΠΎΠ·ΠΈΡ†ΠΈΡŽ Π½Π° ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠΉ заканчиваСтся ΠΏΠ΅Ρ€Π²ΠΎΠ΅ совпадСниС int textLen = text.length(); int nameLen = ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
f8b4ed5f52342bcbdc1ef7082399a383
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.Scanner ; public class Main { public static void main(String[] args){ Scanner cin = new Scanner(System.in) ; System.out.println(new Solve(cin.nextLine() , cin.nextLine() ).run()) ; } } class Solve{ private String word ; private String text ; public Solve(String word , String...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
a0e452d5a93e126ecabb74958ff57f6a
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public final class ProblemC { private static Scanner in; private static Output out; public static void solve() throws Exception { String n = in.nextLine(); String t = in.nextLine(); int end = -1; int l = 0; for...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
2b7234674e102b7322a03e5cbff999a1
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.*; import java.util.Scanner; public class Solution{ public static void main(String[] args){ Scanner scanner = new Scanner(System.in); String s = scanner.next(); String t = scanner.next(); char[] c = s.toCharArray(); char[] d = t.toCharArray(); int i=0; int j=0; int cl = c.length; ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
7f9a570ef12af8629747388c18fb1326
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.IOException; import java.util.Scanner; public class Kval2C { public static void main(String[] args) throws IOException{ Scanner scanner = new Scanner(System.in); String s = scanner.next(); String t = scanner.next(); char[] sMass = s.toCharArray(); char[] tMa...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
f24b13631d1f567fe3b7955d6bb51462
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.Scanner; /** * Created by Hedin on 14-Mar-15. */ public class SolveQual3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] s = sc.next().toCharArray(); char[] t = sc.next().toCharArray(); sc.close(); int count = 0; ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
1fdda9277c6f9d148951fadea66125de
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; public class VK_C_Q2 { private static StreamTokenizer in = new StreamTokenizer(new BufferedReader( new InputStreamReader(System.in))); private ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
f119f7f06d94f363cfe87aaa76c64fb9
train_000.jsonl
1426345200
A Martian boy is named s β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { static MyScanner in; static PrintWriter out; //static Timer t = new Timer(); public static void main(String[] args) throws IOException { in = new MyScanner(); out = new PrintWriter(System.out, true); ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output