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
7cf1b1e67f22e6ffa8f0265a4aeeb05b
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void solve(InputReader in, PrintWriter out) { int t = in.nextInt(); while (t-- > 0) { int n = in.nextInt(); int[] A = new int[n]; for (int i = 0; i < n; i++) { A[i] = ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
76538a20b4950be1aba11c0084de4372
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class D { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = in.nextInt(); for(int tt = 0; tt < t; tt++) { ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
98cd94b3148740b802c0c7a3ff2a95c5
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /* I can't live without doing CP! Never Give UP! Consistency is the key! */ public class Coder { static StringBuffer str=new StringBuffer(); static long x,n; static List<Long> blue; static List<Long> red; static void solve(){ Co...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
52b56adc38af589bf57dc09ab4f3566d
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Arrays; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Collections; import java.util.Tr...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
d7d8c13a8f8cdccee711721d62e91a87
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; public class SolutionB { public static long gcd(long a, long b){ if(b==0){ return a; } return gcd(b, a%b); } public static long gcdSum(long b){ long a = 0; long temp = b; while(temp!=0){ a = a + t...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
bc5296dbd19fb54b96bc81cd4b642c7b
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static int M = 998244353; static Random rng = new Random(); private static boolean testCase(int n, int[] a, String colors) { boolean[] contains = new boolean[n]; int any = 0, rem = n, idx; List<Integer> fromLef...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
ce9e46c20dc02ed49eef5a0cd01ab4ef
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; /** * * @author eslam */ public class Solution { // Beginning of the solution static Kattio input = new Kattio(); static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out)); static ArrayList<Ar...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
9d72a3f73ffe38643ff32464ef1b3b3e
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
/* || श्री राम समर्थ || || जय जय रघुवीर समर्थ || */ import java.io.*; import java.math.BigInteger; import java.util.*; import static java.util.Arrays.sort; public class CodeforcesTemp { static Reader scan = new Reader...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
d56802e9765c8b51ab74991cc2d8995d
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void solve() { int n = in.nextInt(); int[] arr = in.na(n); String st = in.next(); int[] blues = new int[n]; int[] reds = new int[n]; int cb = 0, cr = 0; for(int i = 0; i < n; i++) { ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
28cbd7bf86d704b41b81bba1f73e4008
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.StringTokenizer; public class Main { static FastReader fr; static int defMod = 1000000007; static in...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
0f1603d3394b8bb731c389f48520317e
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.security.KeyPair; 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.Stack; ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
155aedccaa6f0eba4f1bc462e4d9d5be
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class cp { static PrintWriter w = new PrintWriter(System.out); static FastScanner s = new FastScanner(); static int mod = 1000000007; static class Edge { int src; int wt; int nbr; Edge...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
d7b7699c8333c475363243ebbdda84f4
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; /** * @author KaiXin * @version 11 * @date 2022-06-14 16:20 */ public class Main { static final int SIZE = (int)2e5 + 5; static int[] a = new int[SIZE]; static ArrayList<Integer>red = new ArrayList<>(); static ArrayList<Integer>blue = new Arra...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
ef3effe3d975edff2d2cfd98ae6c2cd8
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
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.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.PriorityQueue; import java.util.Random...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
b50d8168b3402d088c1e122b01c00c3c
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class D1607 { public static void main(String []args) throws Exception { PrintWriter pw = new PrintWriter(System.out); BufferedReade...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
94f74ab9a6c90804a68abb78a09fd078
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.Buffer; import java.util.*; public class Main2 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); i...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
8ffb58158b3aeeb368df91c3cd363feb
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class D1607 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t = 0; t < T; t++) { int N = i...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
31de57719e149fc053723ac3ebc8f52e
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
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 Codechef { public static class pair { int val; int ch; pair(int val,int ch) { this.val=val; th...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
573a70ed8c1431683d1b11e052689c38
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
//package CodeForces.RoadMap.Diff1300; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Scanner; /** * Given: * You are given an array of integers a of length n. * * The elements of the array can be either different or the same. * * Each eleme...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
c70ade65334ee13d5eba58ad535189c4
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
/* Author:Farhan Shaikh */ 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 Pupil { static FastReader sc = new FastReader(); public static void main (String[] args) throws java.lang.Exception { ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
524e0b187c2ccd4629319066359df545
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; import java.io.*; public class _1607D { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n=sc.nextInt(); int []arr= new int[n]...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
505b64e47d6f40786a5cac35cfdeab00
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
/*package whatever //do not write package name here */ import java.util.*; public class Main { public static void main (String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int a[]=new int[n]; int i; for(i=0;i<n;i++) a[i]=sc.next...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
467742a3bc9f779ddcdecc85624cb784
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; import java.io.*; import java.lang.Math; public class Main { public class MainSolution extends MainSolutionT { // global vars public void init(int tests_count){} public class TestCase extends TestCaseT { public Object solve() { int n =...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
3ce9991e7696eb5bf65bc1fd5c0166e0
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static class Pair implements Comparable < Pair > { int d; int i; Pair(int d, int i) { this.d = d; this.i = i; } public int compareTo(Pair o) { if (this.d - o.d == 0) ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
c209ebf00e5937c704cea8df9752a71c
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger; public final class NotPassed_Q1607D_BlueRedPermutation { static PrintWriter out = new Pri...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
e18d60b4b73a3aa9cdebc02b3bc8d6cc
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.LinkedList; import java.util.*; import java.util.StringTokenizer; public class C { static class FastReader { BufferedReader br; StringTokenizer st; public...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
166f61444bd228e43b0ac521fd61d120
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; import java.io.*; public class brperm { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(f.readLine()); while(t-->0) { int n=Integer.parseInt(f.readLine()); StringToken...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
bb9e2c858efe0ac987e789b687da207a
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.Math.sqrt; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class Main { static FastReader sc; // static FastWriter...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
06e7004c20373e7a3460ff7a75ff6b5d
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
//package com.rajan.codeforces.leve_1300; import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class BlueRedPermutation { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
f095cb18a04345082daea29e9edd772d
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws Exception { int tc = io.nextInt(); for (int i = 0; i < tc; i++) { solve(); } io.close(); } private static void solve() throws Exception { ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
fa47acf2fc0b46905baf1f6950ab5056
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.lang.*; import java.util.*; import java.io.*; public class D_Blue_Red_Permutation { public static void main(String[] arg){ Scanner s=new Scanner(System.in); try { int t=s.nextInt(); while(t-->0){ int n=s.nextInt(); int arr...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
e5d2a3b6afe6b875033fdaa7a919c16a
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class D_Blue_Red_Permutation{ static Scanner in=new Scanner(); static PrintWriter out=new PrintW...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
d552e9ab832450dc0f8445d7b36d175f
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; import java.util.stream.Collectors; import java.io.*; import java.math.*; public class R753_D{ public static FastScanner sc; public static PrintWriter pw; public static StringBuilder sb; public static int MOD= 1000000007; public static class FastScanner { BufferedRead...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
91e6d9012f562b686505b429a2ee34d6
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; public class BlueRedPermutation{ static MyScanner sc = new MyScanner(); static void solve(){ int n = sc.nextInt(); int arr[] = new int[n]; for(int i = 0;i<n;i++){ arr[i] = sc.nextInt(); } String str = sc.next...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
4b6129a2f43b0a895184f3401f1498b5
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; import java.util.stream.Collectors; import java.io.*; import java.math.*; public class R753_D{ public static FastScanner sc; public static PrintWriter pw; public static StringBuilder sb; public static int MOD= 1000000007; public static class FastScanner { BufferedReade...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
8264860d40ec8af5e68f932126755016
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
/* stream Butter! eggyHide eggyVengeance I need U xiao rerun when */ import static java.lang.Math.*; import java.util.*; import java.io.*; import java.math.*; public class x1607D { public static void main(String hi[]) throws Exception { BufferedReader infile = new BufferedReader(new Inp...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
040661439b0ca3281d699d2f0ca044e1
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; public class Main { public static void main(Stri...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
8d6653a5a2ac109b97a07ed05f94bfe4
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; public class S{ public static boolean b(ArrayList<Integer> bl, int r, int l){ if (l<r) return true; int c=0; for (int i=r;i<=l;i++){ if (bl.get(c)<i) return false; c++; } return true; } public s...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
969296bdb9f2de163d00b1b07835181f
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.util.stream.IntStream; public class Main { static class Pair implements Comparable<Pair> { int index; long value; boolean check=false; Pair(int index, long value,boolean check) { this.in...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
510df2b5370afc45db0ea9dcce92b5ac
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; public class RBPermutation { public static void main(String[] args) throws IOException { FastReader fr = new FastReader(); PrintWriter pr = new PrintWriter(new OutputStreamWriter(System.out)); int t = fr.nextInt(); while (t-- > 0) { ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
7895a33f41b979bd2be1868d5b63d6bc
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; import java.lang.Math; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; public class Main { static PrintWriter pw; static Scanner sc; static StringBuilder ans; static long mod = 1000000000+...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
14a5244ae7e556385901b3ddabe3ce3c
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.util.ArrayList; import java.util.Collections; public class C { static FastScanner sc = new FastScanner(); public static void main(String[] args) { int t = sc.nextInt(); while(t-->0) { if(solve()) ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
555b65981a338d6e46ac574dd1656510
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class D { public static void main(String args[]) { Scanner fs = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int T = fs.nextInt(); for(int loop=1; loop<=T; loop++) {...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
9cc5b761eced025b19121e2139137d6a
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.math.*; import java.util.* ; import java.io.* ; @SuppressWarnings("unused") /* * * I am working for the day i will surpass you * */ //Scanner s = new Scanner(new File("input.txt")); //s.close(); //PrintWriter writer = new PrintWriter("output.txt"); //writer.close(); public class cf { ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
747889d437e2a6f3a2d15ae8ef11f696
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; import java.util.function.ToIntFunction; public class BlueRedPerm { public static void main(String[] args){ Scanner s = new Scanner(System.in); int N = s.nextInt(); for(int i=0; i<N;...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
6ddf61d6ab1c572442bd19cfc4d437ab
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.awt.Container; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class Main { public stat...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
ed362e6f94330f79061dc9e303f867d8
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
//package CodeForces.RoadMap.Diff1300; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Scanner; /** * Given: * You are given an array of integers a of length n. * * The elements of the array can be either different or the same. * * Each element of the arr...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
fe472f95fff827fad71185ccdcf58e2e
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; import java.io.*; public class D { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); while(T-- > 0) { int n = in.nextInt(); int[] a = new int[n]; for(int j=0;j<n;j+...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
c5a1577a1999dc059fdefbafd63178cf
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner s= new Scanner(System.in); int t = s.nextInt(); for(int i=0;i<t;i++) { int n = s.nextInt(); int[] arr = new int[n]; char[] arr1 = new char[n...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
f0f08a16f8d291bd51cb3a441acfeeec
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; public class blueredperm{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = Integer.parseInt(sc.nextLine()); while(t-- > 0){ int n = Integer.parseInt(sc.nextLine()); int[] arr = new int[n]; fo...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
edbd7886fc9ff225634452e423f1ceca
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Task { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
3c0b048b55ec2561617090e7dc1ae68a
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class problemD { 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++) ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
c319d60c15396ccdc74d546e1ac0c3d2
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; public class Question4 { public static void main(String[] args) { int t,n,i; Scanner sc = new Scanner(System.in); t = sc.nextInt(); while(t--> 0) { n = sc.nextInt(); int arr[] = new int[n]; for(i=0;i<n;i++) arr[i] = sc.nextInt(); String str = sc.next();...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
c379c81aac82ab26bc8bb1dcde880f63
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; /** * * @author Acer */ public class RedBluePermutation_D { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); k: while(T-- > 0)...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
1ea4ff9a48ec756c85e692f32bd21606
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
/* * akshaygupta26 */ import java.io.*; import java.util.*; public class D { static long mod =(long)(1e9+7); public static void main(String[] args) { FastReader sc=new FastReader(); StringBuilder ans=new StringBuilder(); int test=sc.nextInt(); outer:while(test-->0) { int n=sc.n...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
6d64412695754a7e0eb2fe9e89c813ee
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.TreeMap; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public clas...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
e7c5a68bbabb6cde2d2da6bcbb7205b7
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; public class Problem3 { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int T =sc.nextInt(); while(T-->0) { int n =sc.nextInt(); int[] ar = new int[n]; PriorityQueue<Integer> blue= new PriorityQueue<Integer>(); PriorityQueue<Inte...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
22acfe4bb0b4e127ef6f033d0263bc97
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Blue_Red_Permutation { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int tc = scanner.nextInt(); while(tc-- > 0) { int n = scanner....
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
1417592c70762a64a936b2c349d9c2db
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; public class Templ { static StreamTokenizer in; static int nextInt() throws IOException { in.nextToken(); return (int) in.nval; } public static void main(String[] args) throws IOException { in = new StreamTokenizer(new Buffered...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
47023f63a5a1d7cf05b4b357be7753b5
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; public class Soltion{ public static void main(String []args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); Integer[] arr = new Integer[n]; for(int i=0;i<n;i++){ ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
79cf195386a6055b3c1aae4c7027f226
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; public class D { public static void main(String[] args) { new D().solve(System.in, System.out); } public void solve(InputStream in, OutputStream out) { InputReader inputReader = new InputReader(in); PrintWriter writer = new PrintWriter(new Buff...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
add244207454e50032abd3a290232929
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.AbstractMap; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.PriorityQueue; import java.util.*; import java.io.*; // Java Te...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
fd7161373e997d58729a52a7eb185321
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
d77efca652b497881907f024e8f257c4
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; public class main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while (t-- > 0) { int n = scn.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = scn.nextInt(); ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
69b84d9e4aa6a49f916a8dd90f25a6f0
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.util.*; //CODE FORCES public class anshulvmc { public static void sort(int[] a) { ArrayList<Integer> l=new ArrayList<>(); for (int i:a) l.add(i); Collections.sort(l); for (int i=0; i<a.length; i++) a[i]=l.get(i); } public static int gcd(int a, int b) { if (b==0...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
ef98a11b7cf8229198d73809923aa1ec
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java.math.BigInteger; public class Main { ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
04cc9488a26a90cfb60ae07f9f8cfbf7
train_108.jsonl
1635863700
You are given an array of integers $$$a$$$ of length $$$n$$$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: eith...
256 megabytes
import java.io.*; import java.util.*; public class D { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder bw = new StringBuilder(); int TC = Integer.parseInt(br.readLine()); while (TC-- > 0) { int N ...
Java
["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR"]
1 second
["YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES"]
NoteIn the first test case of the example, the following sequence of moves can be performed: choose $$$i=3$$$, element $$$a_3=5$$$ is blue, so we decrease it, we get $$$a=[1,2,4,2]$$$; choose $$$i=2$$$, element $$$a_2=2$$$ is red, so we increase it, we get $$$a=[1,3,4,2]$$$; choose $$$i=3$$$, element $$$a_3=4$$$ is ...
Java 8
standard input
[ "greedy", "math", "sortings" ]
c3df88e22a17492d4eb0f3239a27d404
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of input data sets in the test. The description of each set of input data consists of three lines. The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the original array $$$a$$$. The second line ...
1,300
Print $$$t$$$ lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise. You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a pos...
standard output
PASSED
b80ea924d8b02187bd0adf3bd390c245
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
/* codeforces (Linear keyboard) * You are given a keyboard that consists of 26 keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter. You have to type the word s on this keyboard. It also consists only of lowercase Latin letters. To type a wo...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
8db1f23a79924a48e1d126a7ea62757d
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class keyboard2 {public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String s[]=new String[1]; String s1=""; int sum=0; for(int i=0;i<n;i++) ...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
eeb26e649f4c80f4a07fa12db3c1dd3e
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
//package com.tdorosz._1607; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class LinearKeyboard { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int testCases = scanner.nextInt(); scanner.nextLine(); for (int i = 0; i < testCases; i++) { ...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
dcab698d6f5c46da20e25860d3849478
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; // Berhasil public class LinearKeyboard { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int banyak = scn.nextInt(); ArrayList<String> arrKalimat = new ArrayList<String>(); ArrayList<Str...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
618f013e5dd92ef5dd9c9ffcd2eca129
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Scanner; public class LinearKeyboard { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int banyak = scn.nextInt(); ArrayLis...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
d458b52ec0a4833e86d5aa40f8d73586
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class A1607 { public static void main(String[] args) throws Exception { final Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t ; i++) { fn(sc); } } private static void f...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
9448bd6c902cc9dd67e19651058e2362
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class Main { public static void main (String[]args) { Scanner sc = new Scanner (System.in); int t = sc.nextInt (); while (t-- > 0) { String s=sc.next(); String c=sc.next(); ArrayList<Character> arr=new Arr...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
aae9932ddb39eaacb998870866865ee6
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class Training1 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t=input.nextInt(); for (int k = 0; k < t; k++) { String line=input.next(); char[] s=input.next().toCharArray(); ...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
9f4bd6bdc0583333dd2f9597e7548038
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.Scanner; public class main{ public static void main(String [] args){ Scanner in = new Scanner(System.in); int nt, n, ans, xi, yi; char x, y; String alp, s; nt = in.nextInt(); while(nt > 0){ alp = in.next(); s = in.next(); n = s.length(); ans = 0; for(int i = 0; ...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
b981467f528fe0dbcefd1442ee88d43e
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class HelloWorld { public static void main(String[] args) { Scanner sc = new Scanner (System.in); int t = sc.nextInt(); while(t>0){ t--; String str = sc.next(); String s = sc.next(); int a = s.length(); ...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
260b6e2c877689e2e57acca2696946cd
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class Round753A { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String IMPO...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
ac3fbe759ec20a689d0ccac091c6dbd1
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class LinearKeyboard { public static void main(String[]args) throws NumberFormatException, IOException { InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(is); ...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
5e168dd48a12a9b4d67c088d83bd3645
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.Scanner; public class codeforce_keyboardproblem { public static void main(String[] args) { Scanner scn = new Scanner(System.in); // System.out.println("Enter the number of test cases."); int t = scn.nextInt(); while (t-->0) { String keyboard, word; // System.out.println("Ente...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
5439c3dc21747b697686bd2cf994378e
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.Scanner; import java.lang.Math; import java.lang.String; public class LinearKeyboard { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t > 0) { String keyboard = sc.next...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
ba701244dc24fc3f6b6cdf1ff7ec0f87
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.nio.charset.StandardCharsets; import java.util.Scanner; public class CF1607A { public static void main(String[] args) { Scanner scanner = new Scanner(System.in, StandardCharsets.UTF_8); int t = scanner.nextInt(); for (int i = 0; i < t; i++) { String keyboard ...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
0a5e07fc088b14c491879b9a0178cf87
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.Scanner; public class LinearKeyboard { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { String k = sc.next(); String s = sc.next(); int ans = 0;...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
0381e64b38a303401378c2f2383351a7
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.Scanner; public class linearKeyboard { public static void p (Object o) {System.out.println(o);} public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testCases = sc.nextInt(); while (testCases --> 0) { String keybo...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
dc1b49a3492817ecd6768d39075425f8
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class Testing { public static void main(String[] args) { Scanner s = new Scanner (System.in); int t=s.nextInt(); for(int i=0;i<t;i++){ int firstindex=0,secondindex=0,sum=0; String input=s.next(),word=s.next(); for(int j=0;j<wor...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
31d4514f20a64a8721fc41ae291b4337
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); for(int i=0; i<t; i++) { String alphabet = scanner.next(); String word = scanner.next(); int sum = 0; for(int j=1...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
9cc679827492b565e84c88ed6b257261
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.Scanner; public class test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { String s=sc.next(); String s1 = sc.next(); int...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 17
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
bb64b3a556412efdd2ea85da9cb5966b
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int t =sc.nextInt(); while ( t-->0){ String str =sc.next(); String s = sc.next(); int count =0; for (int i=1;i<s.length();...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
bc269481c530ad2b0c5371e226141b1b
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class codeforces { public static void main(String[] args) { Scanner s= new Scanner(System.in); int t=s.nextInt(); while(--t>=0) { String str=s.next(); String word=s.next(); int sum=0,first=str.indexOf(word.charAt(0)); for(int i=0;i<word.length();i++) { i...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
3e53fddce026a11e57b8db503526c43e
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int j=0;j<n;j++){ String k = sc.next(); String s = sc.next(); int sum = 0; for(int i=1...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
e01c3eeecb97b23513a62f21b63d94df
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ String alpha=sc.next(); String str=sc.next(); int arr[]=new int[str.length()]; ...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
7eff63350bcf0ea912011cdeec22f4dc
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner s=new Scanner(System.in) ; int n=s.nextInt(); s.nextLine(); while(2*n-->0){ String c=s.nextLine(); char[] v=c.toCharArray(); int sum=0; ...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
85de817960d5153dcaa0d464f90228bd
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args){ int t = sc.nextInt(); while(t-->0){ solve(); } } public static void solve() { char[] arr = sc.n...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
09ae5b45ce2e41a300824cf7fc2399c0
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); scan.nextLine(); for(int i = 0;i<t;i++){ String alphabet = scan.next...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
fc09f822b288e5c2f3301621d9cb885a
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class Solution { private static Scanner scan = new Scanner(System.in); public static void main(String[] args) { int t = scan.nextInt(); scan.nextLine(); for(int i = 0;i<t;i++){ String alphabet = scan.nextLine(); String s...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
3742e6960a331d1451920b6cbff9ea09
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class ln { public static void main(String[] args){ Scanner sc= new Scanner(System.in); int t=sc.nextInt(); sc.nextLine(); int[] a= new int[t]; for(int j=0;j<t;j++){ String keyb = sc.nextLine(); String str=sc.nextLine(); int[] map= new int[...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
a4a8bc0ec5728e61bee939f65db9ff88
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.*; public class my { public static void main(String[] args){ int t; Scanner sc= new Scanner(System.in); t=sc.nextInt(); sc.nextLine(); int[] a =new int[t]; for(int j=0;j<t;j++){ String keyboard; String str; keyboard = sc.nextLine...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
1aea109e478fb667524388e2978fb10a
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class LinearKeyboard { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { int t = sc.nextInt(); for (int i = 0; i < t; i++) { String keyb...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
c45a06465d80ef1baa85895e836bfd9a
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.stream.IntStream; public class MockCompetition { public static void main(String[] args) { Scanner scanner = new Scanner(Sy...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output
PASSED
32782b22ebdae8ad732f56776f387245
train_108.jsonl
1635863700
You are given a keyboard that consists of $$$26$$$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.You have to type the word $$$s$$$ on this keyboard. It also consists only of lowercase Latin letters.To type a word, you need to type all its...
256 megabytes
import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.stream.IntStream; public class MockCompetition { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String caseNumber...
Java
["5\nabcdefghijklmnopqrstuvwxyz\nhello\nabcdefghijklmnopqrstuvwxyz\ni\nabcdefghijklmnopqrstuvwxyz\ncodeforces\nqwertyuiopasdfghjklzxcvbnm\nqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba"]
1 second
["13\n0\n68\n0\n74"]
null
Java 11
standard input
[ "implementation", "strings" ]
7f9853be7ac857bb3c4eb17e554ad3f1
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The next $$$2t$$$ lines contain descriptions of the test cases. The first line of a description contains a keyboard — a string of length $$$26$$$, which consists only of lowercase Latin letters. Each of the letters from 'a...
800
Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to the test case is the minimal time it takes to type the word $$$s$$$ on the given keyboard.
standard output