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
9e32bc275f05cdb44a48d77e4ee38cd3
train_001.jsonl
1276875000
You are given an equation: Ax2 + Bx + C = 0. Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; import java.util.Hash...
Java
["1 -5 6"]
1 second
["2\n2.0000000000\n3.0000000000"]
null
Java 7
standard input
[ "math" ]
84372885f2263004b74ae753a2f358ac
The first line contains three integer numbers A, B and C ( - 105 ≤ A, B, C ≤ 105). Any coefficient may be equal to 0.
2,000
In case of infinite root count print the only integer -1. In case of no roots print the only integer 0. In other cases print the number of root on the first line and the roots on the following lines in the ascending order. Print roots with at least 5 digits after the decimal point.
standard output
PASSED
35fe61841f16305cfa17684c3c151434
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x < y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
90b01da53ed74524a462ae7ca719e6b4
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x < y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; imp...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
2bda6b4b77903b2d279f6a3ab996084e
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x < y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { static final double eps = 1e-8; static int mod = 1000 * 1000 * 1000 + 9; static int n, k; static Set<Integer> set = new TreeSet<Integer>(); public static void main(String[] args) throws IOException { Scanne...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
8e1926fa4b444e9e42f14c91393b885f
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.*; import java.util.*; //import java.math.BigInteger; public class Main { public static void main(String args[]) { try { //BufferedReader br = new BufferedReader(new FileReader(new File("input.txt"))); BufferedReader br = new BufferedReader(new InputStr...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
c9dc1f416be6d44c6403fd72789d3f2e
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
//package Round_169; import java.util.*; import java.io.*; import static java.lang.Math.*; public class c { void solve() throws Exception { int n = in.nextInt(); int k = in.nextInt(); long []a = in.readLongArray(n); for (int i = 0; i<n; i++){ int j = (int)(random() * n); long sw = a[j]; a[j] = a[i...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
30783b5d911e9db5ac8650f89902078a
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; import java.util.TreeSet; public class Main { //http://www.codeforces.com/contest/275/problem/C public static void main(String[] args) thr...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
f7c95a46bf55d4e97fae5b9ff0f56f1f
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.util.*; import static java.lang.System.*; public class C275 { Scanner sc = new Scanner(in); public void run() { int n=sc.nextInt();long k=sc.nextInt(); long[] a=new long[n]; boolean[] used=new boolean[n]; for(int i=0;i<n;i++){ a[i]=sc.nextInt(); } int res=0; Arrays.sort(a); for(int i...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
3179cf2c6d134bff14f6da7192e034cb
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class C { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); int[] a = new int[n]; for (int i = 0; i...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
39e906b9da38e8b96f27fa9fc4054e5e
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.util.Scanner; import java.util.Set; import java.util.TreeSet; import java.util.Arrays; public class C { public static void main(String args[]) { Scanner input = new Scanner(System.in); int n = input.nextInt(); long k = input.nextInt(); long[] nums = new long[n]; ...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
03caa9f0b5a7fbc251d131f159289e90
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; public class B_168 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n =sc.nextInt(); long a[]=new long [n+1]; long k =sc.nextInt(); HashSet<Long> set=new HashSet<Long>(); for (int i = 1; i <=n; i++) {...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
e19ae0baf6ddd5b1c99efbb568353392
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.math.*; public class Task { public static void main(String[] args) throws IOException { new Task().run(); } StreamTokenizer in; Scanner ins; PrintWriter out; int nextInt() throws IOException { ...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
d68ae9aad8c2a2119858b871b9afa249
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.HashSet; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author George Marcus */ public class Main...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
6d4f296b1a6917b427afea0a6fbd2eea
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.util.List; import java.io.IOException; import java.util.InputMismatchException; import java.util.ArrayList; import java.util.Set; import java.io.OutputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.Collections; import java.io.InputStream; /** * Built using CHelper plug-in ...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
94b53c43e11f4b7f7f250551130690be
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.util.List; import java.io.IOException; import java.util.InputMismatchException; import java.util.ArrayList; import java.io.OutputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.Collections; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is a...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
2a88c429a4b08f6cd3828134f570e45f
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.util.Arrays; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author George Marcus */ public class Main { public static void mai...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
0ab04b5038d286af67eae0bc19caa74a
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.util.Arrays; import java.util.HashMa...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
754de29ceb794ab0724918e87f11fe3b
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import static java.lang.Math.*; import static java.util.Arrays.*; import java.util.*; import java.io.*; public class C { int[] a; void run() { Scanner sc = new Scanner(System.in); int n = sc.nextInt();int k = sc.nextInt(); a = new int[n]; boolean[] used = new boolean[n]; ...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
ed38e7ab03f9f07417b0a6f11b25911f
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.util.*; /** * * @author ADMIND */ public class Codeforce { public static void main(String[] args) { Scanner cin=new Scanner(System.in); int n=cin.nextInt(); int k=cin.nextInt(); int a[]=new int [n]; boolean f[]=new boolean[n]; ...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
406e59fca4c2cfc9c96696a228f79209
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.*; import java.util.*; public class C { void run() throws IOException { int n = ni(); long k = ni(); TreeSet<Long> a = new TreeSet<Long>(); TreeSet<Long> b = new TreeSet<Long>(); int s = 0; for (int i = 0; i < n; i++) { a.add((long) ni()); } b.addAll(a); for (int i = 0; i < n; i++...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
15524ee59d72a0346132abe2f0efbdd5
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.System.*; public class C { public static void main(String[] args) { Scanner sc = new Scanner(in); int n = sc.nextInt(); long k = sc.nextLong(); long[] arr = new long[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextLong(); } Arrays.sort(a...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
613632d638dcb8c753336c3e680296da
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Set; import java.util.StringTokenizer; import java.util.TreeSet; pub...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
6d29697fdcb0a2060cd994aab077500d
train_001.jsonl
1361374200
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x &lt; y) from the set, such that y = x·k.You're given a set of n distinct positive integers. Your task is to find the size of it's largest k-m...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchEx...
Java
["6 2\n2 3 6 5 4 10"]
2 seconds
["3"]
NoteIn the sample input one of the possible maximum 2-multiple free subsets is {4, 5, 6}.
Java 7
standard input
[ "binary search", "sortings", "greedy" ]
4ea1de740aa131cae632c612e1d582ed
The first line of the input contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109). The next line contains a list of n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 109). All the numbers in the lines are separated by single spaces.
1,500
On the only line of the output print the size of the largest k-multiple free subset of {a1, a2, ..., an}.
standard output
PASSED
5d0895844574066489e445a023db6f70
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
//https://codeforces.com/contest/1291/problem/B 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) { FastReader sc = new FastReader(); int t; t= sc.nextInt(...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
7e6eab364deb01475406f8ba4b29c89d
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
//https://codeforces.com/contest/1291/problem/B 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) { FastReader sc = new FastReader(); int t; t= sc.nextInt(...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
64a4a310ea872940da9d0e6f46ec8f2a
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ArraySharp { public static void main(String[] args) throws IOException { int t; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); t = Integer.parseInt(br.readLi...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
04a7194c4ba42fc750ef1d4eaa02ea3a
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Solve { FastScanner in; PrintWriter out; void solve() { int T = in.nextInt(); t: while (0 < T--) { int n = in.nextInt(); int[] a = in.nextIntArray(n); if (n == 1 ) { ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
d4b3ab304d2631a3c8cf907403f31a45
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Solve { FastScanner in; PrintWriter out; void solve() { int T = in.nextInt(); t: while (0 < T--) { int n = in.nextInt(); int[] a = in.nextIntArray(n); int i = 0; ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
648cfe380eedde0de461903467d31194
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Solve { FastScanner in; PrintWriter out; void solve() { int T = in.nextInt(); t: while (0 < T--) { int n = in.nextInt(); int[] a = in.nextIntArray(n); // out.println(Arrays.t...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
e57c58c9c117e426bc57009497671e57
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.HashSet; import java.util.StringTokenizer; public class gym { static class FenwickTree { int[] ft; FenwickTree(int n) { ft = new int[n + 1]; ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
adb1bafaffce035578f1cea3af09eaf0
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { new Thread(null, new Runnable() { public void run() { solve(); } ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
677db7a9254142dc3359f304a34a09b8
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.util.*; public class B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int u = 0; u < t; u++) { int n = in.nextInt(); int a[] = new int[n]; for (int i = 0; i < n; i++) { ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
44820de8dc98bcaa954424d3c90c1571
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class spoj { InputStream is; PrintWriter out; void solve() { int t=ni(); while(t-->0) { int n=ni(); int a[]=na(n); int dumm[]=new int[n]; int si=-1,sd=-1; for(int i=0;i<n-1;i++) { if(a[i]<=a[i+1]) ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
bd9eaa73d13df31ee86e9af5000118f0
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.util.*; import java.io.*; public class P1291B { private static void solve() { int tests = nextInt(); while (tests-- != 0) { int n = nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } int first = 0; for (int i = 0; i <...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
e545ddd91c918c26790de3e163a0b24b
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.BufferedInputStream; import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(new BufferedInputStream(System.in)); int v=sc.nextInt(); while(v-->0){ int a=sc.nextInt(); i...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
be334550de1dfbc09ade0d05fcfd0ba3
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.BufferedInputStream; import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(new BufferedInputStream(System.in)); int v=sc.nextInt(); while(v-->0){ int a=sc.nextInt(); i...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
677ec03af588570e4d8446fe1b84b805
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import javax.print.attribute.standard.PrintQuality; import java.awt.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; import java.util.List; public class Main { static int mod = (int) 1e9 + 7;...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
9dcf53c79c26522d061ebdac35096d36
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; public class ArraySharpening { private static StreamTokenizer st; private static int nextInt() throws IOException{ st.nextToken(); return (int)st.nval; } public static void main(String[] args) throws IOException{ st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
1446253c04179be2966ce08dbe1ebe22
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.BufferedReader; import java.io.InputStreamReader; public class CodingLegacy { public static void main(String[] args) { InputStream inputStream = System.in; ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
9d250f2298727d5f143d31e065ff58a7
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.util.*; import java.io.*; public class Main{ public static void main(String[] args) throws IOException { OutputStream outputStream = System.out; InputStream inputStream = System.in; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(output...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
d04c19e57b3c43bc774a0a673a9980fc
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import javax.swing.plaf.synth.SynthTextAreaUI; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * */ public class TaskB { public static void main(String[] arg) { fin...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
05b5f8f3a8a5177ae0654f752aa79080
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br; static int cin() throws Exception { return Integer.valueOf(br.readLine()); } static int[] split() throws Exception { String[] cmd=br.readLine().split(" "); int[] ans=new int[cmd.length]; for(int i=0;i<cmd.length;i++) { ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
4709cbccbfbcd6230b780f7bb9d8f7e9
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class MakingString implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; pri...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
05c18b75f3ed108fc15b3591c40c7e2f
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class MakingString implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; pri...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
b8d5ba3a4f1ac38fed170e515d50e91d
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.util.InputMismatchException; public class E { static class Print { private final BufferedWriter bw; public Print() { this.bw=new BufferedWriter(new OutputStreamWriter(System.out)); } public void print(Object object)throws IOExceptio...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
ac6022b0853d1c0fa83701caf27596c8
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn = new Scanner(System.in); int t =scn.nextInt(); while(t-->0){ int n=scn.nextInt(); int [] arr = new int[n]; boolean flag=false; for(int i=0;i<n;i++){ ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
7b65bc2b38fd97ec4206ce7b4437be97
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
/* Author: @__goku__ ssrivastava990@gmail.com `\-. ` \ `. ` \ \ | __.._ | \. S O N - G O K U ..---~~ ~ . | Y ~-. `| | `. `~~--. \ ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
16c6d5aeb8918aeb937690fc83397154
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { solution s = new solution(); s.solve(); s.close(); } } interface IO { Scanner in = new Scanner(new BufferedInputStream(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); } cla...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
1229a213b1146c82c6845e43d80788cc
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { solution s = new solution(); s.solve(); s.close(); } } interface IO { Scanner in = new Scanner(new BufferedInputStream(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); } cla...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
de5f6a8ba418f4489a2ff834436e77a6
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { solution s = new solution(); s.solve(); s.close(); } } interface IO { Scanner in = new Scanner(new BufferedInputStream(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); } cla...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
5bae545fc0125a19361b5c92a7ca0d5c
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.util.*; import java.lang.*; import java.lang.reflect.Array; import java.io.*; import java.math.*; import java.text.DecimalFormat; public class Prac{ static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar,...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
d22c2b56381b2b5de4c1fe541284b058
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.util.*; public class MyClass { public static void main(String args[]) { FastReader sc = new FastReader(); //For Fast IO StringBuilder sb = new StringBuilder(); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); int arr[] = new...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
92f30e757190b89c050f661adee2589b
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import javax.swing.text.html.HTMLDocument; import java.awt.*; import java.io.*; import java.util.*; import java.util.logging.Level; public class Main { static class point { double x; double y; public point(double xx,double yy){ x=xx; y=yy; } public b...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
e7d52bc26caaf347d35bce115e673a42
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.util.*; /** * * @author Pruthvi */ public class JavaApplication74 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t--!=0) { boolean fl...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
5c608dc69aba15e3f3a83f654689956b
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void solve(InputReader in) { int n = in.readInt(); int a[] = new int[n]; for(int i = 0; i<n; i++){ a[i] = in.readInt(); } int prefixend = -1; int suffixend = n-1; for(int i = 0; i<n; i++) { if(a[i] < i) break; ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
d9a4153e1dc107b5ac63e45a0607d223
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { private static final Scanner in = new Scanner(System.in); public static void main(String[] args) { int t = in.nextInt(); ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
f5db78440c7b046d7337ff4888a551e1
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.io.*; import java.util.*; public class Main { static long mod = (long) 1e9 + 7; public static void main(String[] args) throws NumberFormatException, IOException { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); A: while (t-- > 0) { int n = scn.nextInt(); int a[] = new int[n]; ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
4a862034767f042a30e834e56b35ded7
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.util.*; import java.io.*; public class K { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int t = Integer.parseInt(br.readLine())...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
fb3579e476f7e4c2b1231d17f7dcc320
train_001.jsonl
1580652300
You're given an array $$$a_1, \ldots, a_n$$$ of $$$n$$$ non-negative integers.Let's call it sharpened if and only if there exists an integer $$$1 \le k \le n$$$ such that $$$a_1 &lt; a_2 &lt; \ldots &lt; a_k$$$ and $$$a_k &gt; a_{k+1} &gt; \ldots &gt; a_n$$$. In particular, any strictly increasing or strictly decreasin...
256 megabytes
import java.util.*; public class CF_1291_B { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a[]=new int[n]; for(int i=0;i<n;++i) a[i]=sc.nextInt(); ...
Java
["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo"]
NoteIn the first and the second test case of the first test, the given array is already sharpened.In the third test case of the first test, we can transform the array into $$$[3, 11, 15, 9, 7, 4]$$$ (decrease the first element $$$97$$$ times and decrease the last element $$$4$$$ times). It is sharpened because $$$3 &lt...
Java 8
standard input
[ "implementation", "greedy" ]
b9d5e58459baf2a2c294225b73b7229b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 15\ 000$$$)  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$). The second line of each tes...
1,300
For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.
standard output
PASSED
7be87d8890b455fd5f60e12d25070ff6
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.InputMismatchException; public class Task4 { static class FastScanner{ private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; public FastScanner...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
22230a864fb99695257afbe8f7d842ce
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.io.*; import java.util.*; public class Hello { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); boolean hash[] = new boolean[N+1]; for(int i=1;i<=N;i++) hash[i] = false; for(int i=0;i<N;i++) ...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
c08a8efef2a09e92f349b262e8a04472
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.io.BufferedInputStream; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(new BufferedInputStream(System.in)); int n = sc.nextInt(); boolean[] exist = new boolean[n]; for (int i = 0; i < n; i++) { ...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
ec55b70df31c9641894b60a018f345da
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.util.ArrayList; import java.util.Comparator; import java.util.HashSet; import java.util.Scanner; public class Permutation { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Comparator<Integer> comparator = new Comparator<Integer>() { @Override ...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
3c2ab3bfc242752596f95a85db045cbd
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
//package hiougyf; import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //int t=sc.nextInt(); //while(t-->0) { int n=sc.nextInt(); int a[]=new int[n]; for(int i=0;i<n;i++) a[i]=sc.nextInt(); HashSet<Integer>h=ne...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
fa91767be67570b0b4f8d250fd6097e9
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
// Imports import java.util.*; import java.io.*; public class B137 { /** * @param args the command line arguments * @throws IOException, FileNotFoundException */ public static void main(String[] args) throws IOException, FileNotFoundException { // TODO UNCOMMENT WHEN ALGORITH...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
639e2c6c2fb43ca7fe714aa87e1ef43d
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.util.Scanner; public class Permutation { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int n= scan.nextInt(); int arr[]=new int[5001]; int ctr=0,temp; for(int i=0;i<n;i++) { temp=scan.nextInt(); arr[temp]++; } sc...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
74e046b1139582ecdba732c32b41445f
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.util.*; public class permutation { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=in.nextInt(); ArrayList<Integer> list = new ArrayList<Integer>(); for(int i=0;i<n;i++) { int a=in.nextInt(); list.add(a); } int c=0; for(int i=1;i<=n;i++) { if(...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
afbcdbdac1b37f570f100cb0a9100728
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.util.*; public class Shubh{ public static void main(String []args){ Scanner s=new Scanner(System.in); int n=s.nextInt(); int arr[]=new int[n+1]; int c=0; for(int i=0;i<n;i++) { int t=s.nextInt(); if(t>n) ...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
6f9769d5f8a03ef29d70914b62fc2a1e
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Permutation { private static Scanner in = new Scanner(System.in); public static void main(String[] args) { int n =in.nextInt(); int[] arr = new int[n]; Set<Integer> set = new...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
1a887be3f48197ab3c9b321fefb030fe
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class permutation { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt();...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
f94b31e80476db59f5d17d6cb25e3a2b
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashSet; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcep...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
fc7a976d1dce3f5d0ce7e174efd8a3e1
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.io.BufferedReader; import java.util.Scanner; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterat...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
2167d1a1c4874dfffda705200780a8fe
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.util.Scanner; public class Permutation { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); boolean [] arr = new boolean[5001]; for (int i=0;i<n;i++) arr[s.nextInt()] = true; int count = 0; for (int i=1;i<=n;...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
5fd45f0ecb8494fe2ee54566d7ae1ed7
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; import java.util.Arrays; public class B { public static void main(String[] args) { FastScanner fs=new FastScanner(); int n = fs...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
dcfa90b45f8483485f1ad1c85831de27
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.util.*; import java.io.*; public class changetomakepermutation{ static int n; static Integer arr[]; static Integer ml,mr,block; static Integer ans[]; static StringBuilder answer; static HashMap<Integer,Integer> map=new HashMap<>(); public static void main(String[] args) throws IOEx...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
21d416a6970ee280902c7ce31122e3bd
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ar { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
f221ad6b88047cf5d07419a161bbbc6e
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class CF137B { static BufferedReader __in; static PrintWriter __out; static StringTokenizer input; public static void main(String[] args) throws IOException { __in = new BufferedRead...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
1a0d0c077429e371be4789628415bc15
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; import java.util.HashSet; import java.util.Set; public class Codeforces { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new Input...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
0575276017f1212456f0888d8d54d890
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.util.*; public class c{ public static void main(String a[]){ Scanner sc=new Scanner(System.in); int n=0; n=sc.nextInt(); int i,k=0; ArrayList<Integer> li=new ArrayList<>(); for(i=0;i<n;i++){ k=sc.nextInt(); li.add(k); } ...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
a377657b665c80e5dfa1c6a40b4a24b4
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
/* package codechef; // don't place package name! */ import java.math.BigInteger; import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Solution { // Complete the maximumSum function below. public static class InputReader {...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
c84c460e7493ad997ca69d2348fea823
train_001.jsonl
1324015200
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashSet; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputReader in = new InputReader(System.in...
Java
["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1"]
2 seconds
["0", "1", "2"]
NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with...
Java 11
standard input
[ "greedy" ]
bdd86c8bc54bbac6e2bb5a9d68b6eb1c
The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).
1,000
Print the only number — the minimum number of changes needed to get the permutation.
standard output
PASSED
ad9d4accf0217516e136ea06512e9f2c
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; /* br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); br = new ...
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
1d7e813310e897bd1e56af8a885d2268
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Java7Version { public static StreamTokenizer in = new StreamTokenizer(System.in); public static int ni (){ try { in.nextToken(); } catch (IOException e) { e.printStackTrace(); } ...
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
4acbd1e04bacb1a040adbe315d809624
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.io.*; import java.util.*; public class R63qESubsegments { public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter w = new PrintWriter(System.out); StringTokenizer st1 = new StringTokenizer(br....
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
eb0debc81f4686d0002435d4cf467f05
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.util.NavigableSet; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.Iterator; import java.io.IOException; import java....
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
61cbb99772d90071e39a5fa8ae899e02
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.util.NavigableSet; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.HashMap; import java.util.SortedSet; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.Map; import java.io.IOException; import jav...
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
9176ab89eabed402fc5223dc89ca8629
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.util.*; public class Subsegments { public static void main(String [] args){ Scanner in=new Scanner(System.in); int n=in.nextInt(); int k=in.nextInt(); int array[]=new int[n]; for(int i=0;i<n;i++)array[i]=in.nextInt(); TreeSet<Integer>ts=new TreeSet<Integer>(); HashMap<Integer,Integer>hm=new HashMap<I...
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
7d2cd7097f3809b44fc9548a0221e572
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class Codeforces implements Runnable { BufferedReader in; PrintWrite...
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
85f6835a62e011d37adc0e5b1cfa0cde
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.lang.reflect.Constructor; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; public class CodeF { static class Scanner { BufferedReader br = new BufferedReader(new InputStreamR...
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
53dba7436c7a7e3cbc406c4223110e22
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub InputReader in = new InputReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); new Task().go(in, out); out.c...
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
aa67dd0ad195df936568f6a57284a1a3
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.PriorityQueue; import java.util.StringTokenizer; import java.util.Tr...
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
0211653aaf554acaf146a8a8b77eb530
train_001.jsonl
1300809600
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java...
Java
["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2"]
1 second
["1\n3\n2", "4\nNothing\n3"]
null
Java 7
standard input
[ "data structures", "implementation" ]
1f6675459b1eca7a3fdb422f03f91563
The first line contains two positive integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n) — the number of array elements and the length of the segment. Then follow n lines: the i-th one contains a single number ai ( - 109 ≤ ai ≤ 109).
1,800
Print n–k + 1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai + 1 … ai + k - 1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".
standard output
PASSED
2a2318cd79e846e318ea1e58508b2a1a
train_001.jsonl
1484499900
It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ...
256 megabytes
// package codeforces.other2017.venturecup2017.qual; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; public class F { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(Syst...
Java
["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"]
1.5 seconds
["2 4", "2 2"]
NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ...
Java 8
standard input
[ "dp", "bitmasks", "greedy" ]
a0ddb8f02a91865dc65a214f1de111e3
The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F...
2,600
You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order.
standard output
PASSED
eefb432d3aca947de7643d51d381e070
train_001.jsonl
1484499900
It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.BitSet; import java.util.HashMap; import java.util.StringTokenizer; public class FVenture { public static void main(String[] args) { FS scan = new FS...
Java
["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"]
1.5 seconds
["2 4", "2 2"]
NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ...
Java 8
standard input
[ "dp", "bitmasks", "greedy" ]
a0ddb8f02a91865dc65a214f1de111e3
The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F...
2,600
You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order.
standard output
PASSED
73f637e84d531d183af740d605225d88
train_001.jsonl
1484499900
It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.*; public class Main { Input in; PrintWriter out; final static int INF = (int) 1e9; final static int MOD = (int) 1e9 + 7; final static long LINF = (long) 1e18; final static double PI = (double) Math.acos(-1.0); final static double EPS = (double) 1e-...
Java
["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"]
1.5 seconds
["2 4", "2 2"]
NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ...
Java 8
standard input
[ "dp", "bitmasks", "greedy" ]
a0ddb8f02a91865dc65a214f1de111e3
The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F...
2,600
You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order.
standard output
PASSED
1fe3e233711f3f668293b7d3199e2bd5
train_001.jsonl
1484499900
It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ...
256 megabytes
//package eightvc.e; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class F { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), K = ...
Java
["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"]
1.5 seconds
["2 4", "2 2"]
NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ...
Java 8
standard input
[ "dp", "bitmasks", "greedy" ]
a0ddb8f02a91865dc65a214f1de111e3
The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F...
2,600
You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order.
standard output
PASSED
31b1744625d28634464b5f6031af1e43
train_001.jsonl
1484499900
It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ...
256 megabytes
import javax.print.attribute.IntegerSyntax; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.StringTokenizer; /** * Created by Meepo on 3/11/2017. */ ...
Java
["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"]
1.5 seconds
["2 4", "2 2"]
NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ...
Java 8
standard input
[ "dp", "bitmasks", "greedy" ]
a0ddb8f02a91865dc65a214f1de111e3
The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F...
2,600
You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order.
standard output
PASSED
37305fcdf9cfe3fb07667ed7bc2fe8df
train_001.jsonl
1484499900
It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ...
256 megabytes
import javax.print.attribute.IntegerSyntax; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.StringTokenizer; /** * Created by Meepo on 3/11/2017. */ ...
Java
["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"]
1.5 seconds
["2 4", "2 2"]
NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ...
Java 8
standard input
[ "dp", "bitmasks", "greedy" ]
a0ddb8f02a91865dc65a214f1de111e3
The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F...
2,600
You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order.
standard output
PASSED
988eb2f259d9691ebfb542a6a9ac2217
train_001.jsonl
1484499900
It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ...
256 megabytes
import javax.print.attribute.IntegerSyntax; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.StringTokenizer; /** * Created by Meepo on 3/11/2017. */ ...
Java
["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"]
1.5 seconds
["2 4", "2 2"]
NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ...
Java 8
standard input
[ "dp", "bitmasks", "greedy" ]
a0ddb8f02a91865dc65a214f1de111e3
The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F...
2,600
You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order.
standard output
PASSED
ca8717e7f540379c85d179f20c8b22cc
train_001.jsonl
1484499900
It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i.Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their ...
256 megabytes
import javax.print.attribute.IntegerSyntax; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.StringTokenizer; /** * Created by Meepo on 3/11/2017. */ ...
Java
["5 2\n3 4 1 5 2", "10 1\n2 3 4 5 6 7 8 9 10 1"]
1.5 seconds
["2 4", "2 2"]
NoteIn the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answ...
Java 8
standard input
[ "dp", "bitmasks", "greedy" ]
a0ddb8f02a91865dc65a214f1de111e3
The first line of input contains two integers n and k (2 ≤ n ≤ 106, 0 ≤ k ≤ n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. F...
2,600
You should output two values — minimum and maximum possible number of Balls who will not get their presents, in that order.
standard output